{
  "openapi": "3.1.0",
  "info": {
    "title": "NewLedger API Ecosystem",
    "description": "External gateway API. Access requires the documented token audience and permissions.\n\n## Integration conventions\n\n### Request headers\n* `x-partner-domain` is required where the operation declares it as a required header. It is optional but recommended on `POST /v1/app-connect/oauth/token`: the token exchange can resolve the partner from the client’s company. The `/partner/*` operations resolve the partner from credentials or the partner token and do not use this header. OAuth discovery and other explicitly exempt operations also do not require it. On operations that require it, omission is rejected with HTTP 400 and `Missing required x-partner-domain header`. A domain that is not registered returns HTTP 404 `PARTNER_DOMAIN_NOT_ALLOWED`, which deliberately does not say whether the domain exists.\n* Send an identifying `User-Agent`. Default library agents (for example the stock Python `urllib` one) can be blocked at the edge with `error code: 1010`, which looks like an authentication failure.\n\n### Request examples\n* Example UUIDs and credentials are fictional. Replace record IDs with IDs from your own company, use an open accounting date, and choose the company base currency or supply the required exchange rate.\n\n### Workflow inputs\n\n| Task | What to send | Where to find it |\n| --- | --- | --- |\n| Find accounts for items, payments and journals | Account `id` values, looked up by `account_code` (for example `sales_revenue`, `operating_cash`, `capital`). | `GET /v1/accounting/accounts` for the company. |\n| Create an item | `item_type`: `goods` or `service`. Only these two values are accepted. | Choose the value that describes the item. |\n| Send an invoice | `to_state` in `PUT /v1/invoices/{id}/state-transition`; in the default workflow, use `sent` from `draft`. | `GET /v1/invoices/setting/state-transition` lists each `from_state` and its allowed `to_state` values; use the company's configured transitions. |\n| Record a payment: deposit account | `deposit_account`: the `id` of an asset account from the chart, for example operating cash. | `GET /v1/accounting/accounts`. A new company has no bank accounts, so `GET /v1/accounting/bank-accounts` returns an empty list until bank accounts are added. |\n| Record a payment: payment mode | `payment_mode`: a label such as `Bank Transfer`, `Cash` or `Credit Card`. | `GET /v1/company/payment-modes` lists the company's labels. |\n| Retry a payment safely | Reuse the same `Idempotency-Key` header and an identical body, including `payment_date`. | A matching retry returns the saved payment; changed payment details under the same key are refused with HTTP 409. |\n\n### Responses\n* Successful responses carry the payload under `data`; error responses are top level. The OAuth token endpoint (`POST /app-connect/oauth/token`) is the exception: it returns the standard RFC 6749 token response, so read `access_token` from the top level.\n* Most list endpoints are page-numbered: `page` (1-based) and `page_size` (1 to 200, default 50; larger values return 200). The response repeats `page_number`, `page_size` and `total_records`; walk pages until you have `total_records` rows. A few lists name these differently and say so on the operation (custom FX rates use `page_number`; webhook deliveries use `per_page`, at most 100). Dimensions, the dimension worklist and the activity feed are cursor-paged: pass `next_cursor` back as `cursor` with the same filters. Unknown query parameters are ignored, not rejected. List envelopes use different keys per module (for example `peoples`, `items`, `docs`, `accounts`).\n\n### Access tokens\n* App Connect access tokens expire after `expires_in` seconds (one hour by default). Request a new token when yours expires; the same client may be handed the same token until it nears expiry.\n\n### Rate limits\n* Rate-limited operations document their limit on their `429` response: requests per minute per client, and the burst allowed. Payment and other money-movement operations (recording or deleting a payment, applying credits, online payment, bulk payments) allow 20 requests per minute (burst of 25); imports, mail sends and other heavy writes 6; reports 12.\n* A `429` has no body and no `Retry-After` header. Wait 60 divided by the per-minute limit, in seconds, before the next call (3 seconds at 20 per minute). A `503` with no body means the operation's shared limit across all clients was reached; retry with backoff.\n* To record many payments, `POST /invoices/payments/bulk` records full payments for a list of invoices that share one payment mode, date and deposit account in a single call; payments that differ in date, mode or amount still need one call each. Prefer other bulk variants too (for example `PUT /invoices/state-transition/bulk`).\n\n### Document lifecycle and posting\n* New invoices, bills and expenses are created as `draft`. A draft has not reached a posting transition, so it is not in the ledger, receivables or payables.\n* Move invoices and bills forward with their `state-transition` operations, and expenses with `POST /expenses/state-transition` (`draft` -> `submitted` -> `approved`).\n* Which transition posts the ledger entry is set per company on the status transitions (see the `/state-transition/ledger-effects` operations). In the default workflow an invoice posts when it is marked `sent`, and a bill or expense when it is `approved`.\n",
    "termsOfService": "https://newledger.io/terms",
    "contact": {
      "name": "NewLedger Support",
      "url": "https://newledger.io/contact",
      "email": "support@newledger.io"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://newledger.io/license"
    },
    "version": "1.1.0"
  },
  "paths": {
    "/v1/accounting/accounts": {
      "get": {
        "tags": [
          "Accounting / Accounts"
        ],
        "summary": "List Flat Chart of Accounts",
        "description": "Returns a comprehensive, flat-mapped registry of the organization's accounts. While this endpoint does not return a nested tree structure, each record includes its primary classification (Asset, Liability, etc.) and relational metadata (Parent ID), making it ideal for high-performance search, filtering, and data-table rendering.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:account-add, accounting:account-list, accounting:account-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_accounts",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Accounts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingAccountListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:account-add",
            "accounting:account-list",
            "accounting:account-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Accounting / Accounts"
        ],
        "summary": "Create Account",
        "description": "Adds a new account definition to the organization's financial registry. This process assigns the account to a specific classification (Asset, Liability, Equity, etc.) and establishes its position within the ledger hierarchy. Once created, the account becomes available for journal entries and financial reporting.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:account-add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "add_account",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankingAccountFormModel"
              },
              "example": {
                "account": "Payments Clearing",
                "account_subtype": "00000000-0000-4000-8000-000000000003",
                "currency": "USD",
                "is_sub_account": false
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Account successfully registered and activated in the ledger",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingAccountDetailResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:account-add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/accounts-tree": {
      "get": {
        "tags": [
          "Accounting / Accounts"
        ],
        "summary": "Get Account Tree",
        "description": "Get Account Tree\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:account-add, accounting:account-list, accounting:account-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_account_tree",
        "parameters": [
          {
            "name": "is_archived",
            "in": "query",
            "description": "`true` for archived accounts only, `false` for active only. Omitted returns both.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Account Tree",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingAccountTypeListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:account-add",
            "accounting:account-list",
            "accounting:account-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/accounts/subtype": {
      "get": {
        "tags": [
          "Accounting / Accounts"
        ],
        "summary": "List Account Subtypes",
        "description": "Retrieves the standard library of account subtypes. These classifications provide a second-level layer of categorization (e.g., distinguishing 'Petty Cash' from 'Operating Bank Account') and are used to drive specific automated logic for tax mappings and financial statement grouping.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:account-list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_account_subtypes",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved the classification subtype registry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingAccountSubtypeListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:account-list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Accounting / Accounts"
        ],
        "summary": "Create Account Subtype",
        "description": "Registers a new account subtype within the system. This allows for more granular financial categorization beyond standard types. Subtypes created here will immediately become available in account creation forms, enabling precise tax mapping and balance sheet grouping.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:account-add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "add_account_subtype",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankingAccountSubtypeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Subtype successfully registered and integrated into the classification engine",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingAccountSubtypeFormResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:account-add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/accounts/subtype/{account_id}": {
      "put": {
        "tags": [
          "Accounting / Accounts"
        ],
        "summary": "Update Account Subtype",
        "description": "Updates the metadata and classification logic for an existing account subtype. This action allows for the refinement of financial reporting categories without needing to reclassify individual accounts. **Note:** Updating a subtype's primary mapping will immediately reflect across all linked accounts in the Chart of Accounts and on generated financial statements.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:account-add, accounting:account-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "edit_account_subtype",
        "parameters": [
          {
            "name": "account_id",
            "in": "path",
            "description": "Account subtype identifier (`id` from the account subtype list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankingAccountSubtypeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Subtype configuration successfully updated and propagated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingAccountSubtypeFormResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:account-add",
            "accounting:account-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/accounts/{id}": {
      "get": {
        "tags": [
          "Accounting / Accounts"
        ],
        "summary": "Get Account Profile",
        "description": "Provides a detailed view of a specific account, including its configuration metadata and real-time financial statistics. This view aggregates current balances, last activity dates, and period-over-period performance metrics, serving as the primary data source for Account Detail 'White Cards' in the dashboard.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:account-add, accounting:account-list, accounting:account-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_account_by_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully retrieved account profile with associated statistics",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingAccountWithStatsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:account-add",
            "accounting:account-list",
            "accounting:account-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/accounts/{account_id}": {
      "put": {
        "tags": [
          "Accounting / Accounts"
        ],
        "summary": "Update Account",
        "description": "Updates the configuration of an existing account in the Chart of Accounts. Use this to adjust the account name, internal code, or re-parent it within the ledger hierarchy. **Note:** Changing an account's primary classification (e.g., Asset to Expense) is restricted if the account contains existing journal entries to prevent ledger corruption.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:account-add, accounting:account-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "edit_account",
        "parameters": [
          {
            "name": "account_id",
            "in": "path",
            "description": "Unique identifier of the account to modify",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankingAccountFormModel"
              },
              "example": {
                "account": "Payments Clearing",
                "account_subtype": "00000000-0000-4000-8000-000000000003",
                "currency": "USD",
                "is_sub_account": false
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Account configuration successfully updated and synced",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingAccountDetailResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:account-add",
            "accounting:account-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Accounting / Accounts"
        ],
        "summary": "Delete Account",
        "description": "Permanent removal of an account from the Chart of Accounts. **Safety Restriction:** An account can only be deleted if it has a zero balance and no historical journal entries. If the account has transaction history, consider deactivating it via the Update endpoint instead to preserve the audit trail.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:account-delete, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_account",
        "parameters": [
          {
            "name": "account_id",
            "in": "path",
            "description": "Unique identifier of the account to be removed",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Account successfully purged from the system registry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingAccountDeleteResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:account-delete",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/bank-accounts": {
      "get": {
        "tags": [
          "Accounting / Accounts"
        ],
        "summary": "List Bank & CC Accounts",
        "description": "Retrieves all high-liquidity accounts, including Bank Accounts (Checking/Savings) and Credit Cards. This endpoint provides specialized financial metadata such as current balances, currency types, and bank-specific identifiers required for cash flow monitoring and statement reconciliation.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:account-add, accounting:account-list, accounting:account-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_bank_cc_accounts",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Bank Accounts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankAccountsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:account-add",
            "accounting:account-list",
            "accounting:account-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions": {
      "get": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "list",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-list, accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "list_get_accounting_dimensions",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "description": "`active` (default), `archived` or `all`.",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/DimensionStatus"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "description": "Only dimensions enabled for this scope.",
            "required": false,
            "schema": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/components/schemas/DimensionScope"
                }
              ]
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Case-insensitive prefix match on the name or code.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque `next_cursor` from the previous page. Omit for the first page; keep every other filter unchanged between pages.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Dimensions per page, 1 to 100. Omitted means 25; other values are rejected.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "include",
            "in": "query",
            "description": "`values` nests each listed dimension's values, so a screen needs one read instead of one per\ndimension. Refused with `DIMENSION_INCLUDE_LIMIT_EXCEEDED` past `MAX_EMBEDDED_VALUES`.",
            "required": false,
            "schema": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/components/schemas/DimensionInclude"
                }
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_Page_Dimension"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-list",
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "create",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_accounting_dimensions",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDimensionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_Dimension"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/initialize": {
      "post": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "initialize",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "initialize",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_InitializeDimensionsResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/worklist": {
      "get": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "list",
        "description": "Posted records that have taggable revenue/expense lines without a value for at least one dimension, newest first, one row per record. module is documents (with doc_type invoice, bill or credit-note), expenses or journals (manual journals). Cursor-paged. Requires the income-statement report permission and the owner's list permission.\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:income-statement, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "list_get_accounting_dimensions_worklist",
        "parameters": [
          {
            "name": "module",
            "in": "query",
            "description": "`documents`, `expenses` or `journals`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "doc_type",
            "in": "query",
            "description": "`invoice`, `bill` or `credit-note`; required for `documents`, rejected otherwise.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "date_range",
            "in": "query",
            "description": "Required, `YYYY-MM-DD,YYYY-MM-DD`, inclusive, at most 366 days.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dimension_ids",
            "in": "query",
            "description": "Comma-separated dimension ids; absent means every active dimension enabled for transactions.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque `next_cursor` from the previous page. Omit for the first page; keep every other filter unchanged between pages.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Records per page, 1 to 100. Omitted means 25; other values are rejected.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_Page_DimensionWorklistItem"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "404": {
            "description": "Dimension not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:income-statement",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/worklist/summary": {
      "get": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "summary",
        "description": "How many records need a value, in total, per record type and per dimension, by the same rule as the worklist. Requires the income-statement report permission.\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:income-statement, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "summary_get_accounting_dimensions_worklist_summary",
        "parameters": [
          {
            "name": "date_range",
            "in": "query",
            "description": "Required, `YYYY-MM-DD,YYYY-MM-DD`, inclusive, at most 366 days.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "dimension_ids",
            "in": "query",
            "description": "Comma-separated dimension identifiers. Omitted means every active dimension enabled for transactions.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionWorklistSummary"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "404": {
            "description": "Dimension not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:income-statement",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/{dimension_id}": {
      "get": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "get",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-list, accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "get_get_accounting_dimensions_dimension_id",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_Dimension"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-list",
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "patch": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "update",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_patch_accounting_dimensions_dimension_id",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDimensionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_Dimension"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/{dimension_id}/account-lines": {
      "get": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "account lines",
        "description": "Cursor-paged lines of one account (newest first) with their current value for the dimension. value_id filters to a value (descendants included) or `unassigned`. Entry point for the account-detail list. Requires the general-ledger report permission.\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:general-ledger, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "account_lines",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account_id",
            "in": "query",
            "description": "Account identifier (`id` from the chart of accounts).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "date_range",
            "in": "query",
            "description": "Required, `YYYY-MM-DD,YYYY-MM-DD`, inclusive, at most 366 days.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value_id",
            "in": "query",
            "description": "A value id (its descendants are included) or `unassigned`; omit for every line.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque `next_cursor` from the previous page. Omit for the first page; keep every other filter unchanged between pages.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Lines per page, 1 to 100. Omitted means 25; other values are rejected.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_Page_DimensionAccountLine"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "404": {
            "description": "Dimension, account or value not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:general-ledger",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/{dimension_id}/archive": {
      "post": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "archive",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "archive_post_accounting_dimensions_dimension_id_archive",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_Dimension"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/{dimension_id}/income-statement": {
      "get": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "income statement",
        "description": "Income statement grouped by one dimension: direct and inclusive (descendant) amounts per value plus a computed Unassigned bucket whose total reconciles to the unfiltered statement. With value_id (a value id or `unassigned`) it drills into that selection's accounts. Requires the income-statement report permission.\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:income-statement, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "income_statement",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "date_range",
            "in": "query",
            "description": "Required, `YYYY-MM-DD,YYYY-MM-DD`, inclusive, at most 366 days.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value_id",
            "in": "query",
            "description": "Drill-down: a value id (its descendants are included) or `unassigned`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionIncomeStatement"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "404": {
            "description": "Dimension or value not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:income-statement",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/{dimension_id}/restore-label": {
      "post": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "restore label",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "restore_label",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_Dimension"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/{dimension_id}/unarchive": {
      "post": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "unarchive",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "unarchive",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_Dimension"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/{dimension_id}/values": {
      "get": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "list values",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-list, accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "list_values",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "`active` (default), `archived` or `all`.",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/DimensionStatus"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Case-insensitive prefix match on the name or code.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque `next_cursor` from the previous page. Omit for the first page; keep every other filter unchanged between pages.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Values per page, 1 to 100. Omitted means 25; other values are rejected.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "parent_value_id",
            "in": "query",
            "description": "Only values directly under this parent value.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "assignable",
            "in": "query",
            "description": "`true` returns only values that can be set on a line (leaf values that are not archived).",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_Page_DimensionValue"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-list",
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "create value",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_value",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDimensionValueRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionValue"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/{dimension_id}/values/{value_id}": {
      "get": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "get value",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-list, accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "get_value",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value_id",
            "in": "path",
            "description": "Dimension value identifier (`id` from the dimension's values list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionValue"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-list",
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "patch": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "update value",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_value",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value_id",
            "in": "path",
            "description": "Dimension value identifier (`id` from the dimension's values list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateDimensionValueRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionValue"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/{dimension_id}/values/{value_id}/archive": {
      "post": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "archive value",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "archive_value",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value_id",
            "in": "path",
            "description": "Dimension value identifier (`id` from the dimension's values list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionValue"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/{dimension_id}/values/{value_id}/restore-label": {
      "post": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "restore label value",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "restore_label_value",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value_id",
            "in": "path",
            "description": "Dimension value identifier (`id` from the dimension's values list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionValue"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/dimensions/{dimension_id}/values/{value_id}/unarchive": {
      "post": {
        "tags": [
          "Accounting / Dimensions"
        ],
        "summary": "unarchive value",
        "description": "Tenant-scoped Dimensions operation. Requires dimension management permission for writes; list or management permission for reads.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:dimension-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "unarchive_value",
        "parameters": [
          {
            "name": "dimension_id",
            "in": "path",
            "description": "Dimension identifier (`id` from the dimensions list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "value_id",
            "in": "path",
            "description": "Dimension value identifier (`id` from the dimension's values list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionValue"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Permission denied",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:dimension-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/expense-accounts": {
      "get": {
        "tags": [
          "Accounting / Accounts"
        ],
        "summary": "List Expense Accounts",
        "description": "Retrieves all accounts categorized as Expenses, including Operating Expenses (OPEX), Cost of Goods Sold (COGS), and Other Expenses. This endpoint is optimized for categorizing transactions that reduce equity, providing essential data for P&L reporting and budgetary control.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:account-add, accounting:account-list, accounting:account-edit, expense:add, expense:edit, expense:list, expense:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_expense_accounts",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List Expense Accounts",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingAccountListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:account-add",
            "accounting:account-list",
            "accounting:account-edit",
            "expense:add",
            "expense:edit",
            "expense:list",
            "expense:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/journals": {
      "get": {
        "tags": [
          "Accounting / Journals"
        ],
        "summary": "List Journal Entries",
        "description": "Lists current journal headers. Default (posted and void omitted) is posted journals plus the caller's own drafts; voided journals are excluded unless void=true. Supports filtering by date range, account, identifier, and related fields.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:journal-add, accounting:journal-edit, accounting:journal-list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "get_group_journals",
        "parameters": [
          {
            "name": "date_range",
            "in": "query",
            "description": "Date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with 400 `INVALID_DATE_RANGE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Only journals with at least one line on this account.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "deleted",
            "in": "query",
            "description": "`true` returns only deleted drafts; omitted or `false` excludes them.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "identifier",
            "in": "query",
            "description": "Exact journal identifier.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact journal reference.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "posted",
            "in": "query",
            "description": "When true, only posted journals. When omitted with `void`, the default\nlist is posted journals plus the caller's own drafts.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "void",
            "in": "query",
            "description": "When true, only voided journals. When omitted, voids are excluded.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "reversed",
            "in": "query",
            "description": "`true` returns only reversal journals.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "manual",
            "in": "query",
            "description": "`true` returns only manual journals.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List Journals",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingJournalListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed `date_range` filter (`INVALID_DATE_RANGE`).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:journal-add",
            "accounting:journal-edit",
            "accounting:journal-list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Accounting / Journals"
        ],
        "summary": "Create Journal Entry",
        "description": "Registers a new double-entry journal transaction into the ledger. This process validates that debits and credits are balanced, assigns a unique transaction hash for the audit trail, and links the entry to the relevant fiscal period.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:journal-add, accounting:journal-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "add_journal",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankingJournalFormModel"
              },
              "example": {
                "currency": "USD",
                "date": "2026-10-15",
                "description": "Revenue received",
                "lines": [
                  {
                    "account_id": "00000000-0000-4000-8000-000000000001",
                    "debit": "100.00",
                    "description": "Cash received"
                  },
                  {
                    "account_id": "00000000-0000-4000-8000-000000000002",
                    "credit": "100.00",
                    "description": "Revenue earned"
                  }
                ],
                "posted": true
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Create Journal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingJournalFormResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:journal-add",
            "accounting:journal-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/journals/for-entity": {
      "get": {
        "tags": [
          "Accounting / Journals"
        ],
        "summary": "Get Journal by Source Entity",
        "description": "Fetches the full journal entry associated with a specific root business entity (e.g., an Invoice, Payment, or Expense). This provides the underlying double-entry ledger details, including all debits and credits generated by the source document.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:journal-add, accounting:journal-edit, accounting:journal-list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "get_journal_by_root_entity_id",
        "parameters": [
          {
            "name": "entity_id",
            "in": "query",
            "description": "Identifier of the source record.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entity_type",
            "in": "query",
            "description": "Type of the source record, as stored on the journal: for example `invoice` or `expense` for postings Core creates, or the value set on a manual journal (such as `marketplace_order`).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalDetailListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Missing `entity_id` or `entity_type`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:journal-add",
            "accounting:journal-edit",
            "accounting:journal-list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/journals/void": {
      "put": {
        "tags": [
          "Accounting / Journals"
        ],
        "summary": "Void Journal Entries (Batch)",
        "description": "Voids one or more journal entries. Marks them inactive, reverses their financial impact, and preserves the audit trail. Per-item outcomes (`success` / `error`) are returned in a 200 body: already-voided, locked, reconciled, not-found, and not-current do not abort the rest of the batch. Only an unexpected 5xx fails the request.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:journal-add, accounting:journal-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "void_journal",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VoidJournalForm"
              },
              "example": {
                "journal_ids": [
                  "00000000-0000-4000-8000-000000000008"
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Void Journal Entries (Batch)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalVoidResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:journal-add",
            "accounting:journal-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/journals/{anchor_id}": {
      "get": {
        "tags": [
          "Accounting / Journals"
        ],
        "summary": "Get Journal Entry",
        "description": "Returns a journal by its anchor_id. The response is the current version (id, version_number, is_current) plus a short version_history. Pass version to return one earlier version instead, by its version_number or by an id listed in version_history.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:journal-add, accounting:journal-edit, accounting:journal-list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "get_journal_by_id",
        "parameters": [
          {
            "name": "anchor_id",
            "in": "path",
            "description": "Stable journal anchor_id. The same value across every version of the journal; use it for links, edits, void and delete. Transitional: a version row id (any entry of version_history) is still resolved to its journal; that fallback will be removed in a later release, so send anchor_id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "version",
            "in": "query",
            "description": "Earlier version to return: a version_number, or an id from version_history. Omit for the current version.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Journal Entry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalDetailResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:journal-add",
            "accounting:journal-edit",
            "accounting:journal-list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Accounting / Journals"
        ],
        "summary": "Update Journal Entry",
        "description": "Updates the current version of a journal, addressed by anchor_id. Drafts are edited in place. Posted journals reject operator edits; posted corrections require a dedicated versioned correction action. Re-validates double-entry balance, stamps the transaction hash, and enforces fiscal period locks.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:journal-add, accounting:journal-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "edit_journal",
        "parameters": [
          {
            "name": "anchor_id",
            "in": "path",
            "description": "Stable journal anchor_id. The same value across every version of the journal; use it for links, edits, void and delete. Transitional: a version row id (any entry of version_history) is still resolved to its journal; that fallback will be removed in a later release, so send anchor_id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankingJournalFormModel"
              },
              "example": {
                "currency": "USD",
                "date": "2026-10-15",
                "description": "Revenue received",
                "lines": [
                  {
                    "account_id": "00000000-0000-4000-8000-000000000001",
                    "debit": "100.00",
                    "description": "Cash received"
                  },
                  {
                    "account_id": "00000000-0000-4000-8000-000000000002",
                    "credit": "100.00",
                    "description": "Revenue earned"
                  }
                ],
                "posted": true
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update Journal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingJournalFormResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:journal-add",
            "accounting:journal-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Accounting / Journals"
        ],
        "summary": "Delete Draft Journal",
        "description": "Permanently removes a draft journal, addressed by anchor_id. **Constraint:** only 'Draft' (unposted) journals can be deleted. Once posted, a journal cannot be deleted and must be voided instead to keep the audit chain.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:journal-delete, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "delete_journal",
        "parameters": [
          {
            "name": "anchor_id",
            "in": "path",
            "description": "Stable journal anchor_id. The same value across every version of the journal; use it for links, edits, void and delete. Transitional: a version row id (any entry of version_history) is still resolved to its journal; that fallback will be removed in a later release, so send anchor_id.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete Journal",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingJournalDeleteResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:journal-delete",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/journals/{anchor_id}/dimensions": {
      "put": {
        "tags": [
          "Accounting / Journals"
        ],
        "summary": "Correct Journal line dimensions",
        "description": "Changes the dimension values of a posted manual journal's lines and nothing else (amounts, accounts and dates cannot be sent). Each listed line gets exactly the values sent (an empty list clears it); lines not listed keep theirs. The journal is restated: the current version is frozen and a new version is minted on the same anchor with identical lines and the new resolved values, so line ids change. Send expected_version (the current version_number). Refused for voided, reconciled and system-generated journals. Transaction Locking applies as for an edit: a hard lock refuses the call, a soft lock lets a user with the bypass permission through and is logged.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:journal-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "correct_dimensions_put_accounting_journals_anchor_id_dimensions",
        "parameters": [
          {
            "name": "anchor_id",
            "in": "path",
            "description": "Stable journal anchor_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DimensionCorrectionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Corrected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionCorrectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or lock error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Journal not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, unknown line, or journal not correctable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:journal-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/match-policies": {
      "get": {
        "tags": [
          "Accounting / Transactions"
        ],
        "summary": "List Transaction Match Policies",
        "description": "Returns the available transaction matching policies for the authenticated company, including which policy is currently the company default.\n\nThe API Gateway requires a bearer access token. Required permissions (any): role:admin, accounting:match-policy-apply, accounting:match-policy-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "list_get_accounting_match_policies",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Match policies retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingMatchPolicyListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "role:admin",
            "accounting:match-policy-apply",
            "accounting:match-policy-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/match-policies/default": {
      "put": {
        "tags": [
          "Accounting / Transactions"
        ],
        "summary": "Set Default Transaction Match Policy",
        "description": "Persists the authenticated company's default transaction matching policy used by the core deterministic engine whenever a runtime override is not supplied.\n\nThe API Gateway requires a bearer access token. Required permissions (any): role:admin, accounting:match-policy-manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "set_default",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankingMatchPolicySettingFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Default match policy updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingMatchPolicySettingResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "role:admin",
            "accounting:match-policy-manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/reconciliations": {
      "get": {
        "tags": [
          "Accounting / Reconciliations"
        ],
        "summary": "List Reconciliations",
        "description": "Retrieves a history of bank reconciliation periods. This endpoint provides the audit trail for verified ledger accuracy, including opening/closing balances and status indicators. Essential for identifying discrepancies between internal books and external bank statements to ensure financial integrity.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_reconciliations",
        "parameters": [
          {
            "name": "date_range",
            "in": "query",
            "description": "Period `YYYY-MM-DD,YYYY-MM-DD`: returns reconciliations whose period lies inside it.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Bank account identifier. Required.",
            "required": true,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "`draft`, `completed`, `voided` or `all` (default). Other values behave as `all`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of reconciliation periods retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingReconciliationListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Missing `account`, or a `date_range` that is not `YYYY-MM-DD,YYYY-MM-DD`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Accounting / Reconciliations"
        ],
        "summary": "Create Reconciliation",
        "description": "Initiates or finalizes a bank reconciliation record. This endpoint maps the user-provided statement balance against the system-calculated book balance to determine discrepancies. Successful submission validates the integrity of the ledger for the specified date range and updates the reconciliation status.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_reconciliation",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconciliationFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Reconciliation record created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconciliationFormResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/reconciliations/{reconciliation_id}": {
      "get": {
        "tags": [
          "Accounting / Reconciliations"
        ],
        "summary": "Get Reconciliation Details",
        "description": "Retrieves a single bank reconciliation record by its unique identifier. This provides the full audit context, including the calculated ledger balance, the user-entered statement balance, and the resulting discrepancy ('diff').\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_reconciliation_by_id",
        "parameters": [
          {
            "name": "reconciliation_id",
            "in": "path",
            "description": "Unique identifier of the reconciliation record",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Reconciliation details retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingReconciliationResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Reconciliation record not found"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Accounting / Reconciliations"
        ],
        "summary": "Update Reconciliation",
        "description": "Modifies an existing bank reconciliation record. Use this to update the closing balance, notes, or transition the status. Updating a record recalculates the discrepancy ('diff') between the statement and ledger, ensuring the audit trail remains accurate before finalization.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "edit_basic_reconciliation",
        "parameters": [
          {
            "name": "reconciliation_id",
            "in": "path",
            "description": "Unique identifier of the reconciliation record",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconciliationFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Reconciliation record updated and recalculated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconciliationFormResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Reconciliation record not found"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Accounting / Reconciliations"
        ],
        "summary": "Delete Reconciliation",
        "description": "Permanently removes a reconciliation record from the system. This is intended for deleting draft or erroneous entries that have not been finalized. If the reconciliation was already posted, this operation will unlock linked transactions, but unlike 'Void', it may remove the audit history of this specific attempt.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_reconciliation",
        "parameters": [
          {
            "name": "reconciliation_id",
            "in": "path",
            "description": "Unique identifier of the reconciliation record",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Reconciliation record permanently deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconciliationFormResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Reconciliation record not found"
          },
          "409": {
            "description": "Conflict: Cannot delete a finalized reconciliation; use the 'Void' endpoint instead to preserve audit logs"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/reconciliations/{reconciliation_id}/save": {
      "put": {
        "tags": [
          "Accounting / Reconciliations"
        ],
        "summary": "Confirm & Post Reconciliation",
        "description": "Finalizes the reconciliation by updating the record and generating the necessary journal entries to bridge discrepancies. This endpoint automates the transition from ledger balance to bank statement balance, ensuring the general ledger is synchronized. Re-saving will recalculate the difference and update the linked journal records.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "confirm_reconciliation",
        "parameters": [
          {
            "name": "reconciliation_id",
            "in": "path",
            "description": "Unique identifier of the reconciliation record",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconciliationConfirmFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Reconciliation confirmed and journals posted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconciliationFormResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Reconciliation record not found"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/reconciliations/{reconciliation_id}/void": {
      "put": {
        "tags": [
          "Accounting / Reconciliations"
        ],
        "summary": "Void Reconciliation",
        "description": "Voids a finalized reconciliation record and unlocks the associated bank transactions for re-editing. This operation may also reverse any linked journal adjustments created during the finalization process. Essential for correcting historical errors while maintaining a clear audit trail of the voided state.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "void_reconciliation",
        "parameters": [
          {
            "name": "reconciliation_id",
            "in": "path",
            "description": "Unique identifier of the reconciliation record",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReconciliationVoidFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Reconciliation record successfully voided and transactions unlocked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconciliationFormResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Forbidden: Cannot void a reconciliation that has been officially closed in a prior fiscal year"
          },
          "404": {
            "description": "Reconciliation record not found"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/transactions": {
      "get": {
        "tags": [
          "Accounting / Transactions"
        ],
        "summary": "List Bank Transactions",
        "description": "Retrieves a detailed list of bank and ledger transactions. This endpoint provides the raw financial data required for reconciliation and P&L reporting, including transaction dates, descriptions, amounts, and categorization status. Supports filtering by date range and account type to facilitate precise audit lookups.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-add, accounting:banking-transaction-edit, accounting:banking-transaction-list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_transactions",
        "parameters": [
          {
            "name": "match_policy_id",
            "in": "query",
            "description": "Matching policy used to rank suggestions. Omitted uses the company default policy.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "description",
            "in": "query",
            "description": "Case-insensitive partial match on the bank description.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "date_range",
            "in": "query",
            "description": "Date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with 400 `INVALID_DATE_RANGE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Bank account identifier (`id` from the bank account list).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "excluded",
            "in": "query",
            "description": "`true` returns ignored transactions instead of active ones.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "posted",
            "in": "query",
            "description": "`true` returns transactions with at least part of their amount allocated; `false` returns transactions with an unallocated balance. Omitted (with `reconciled` omitted) behaves as `false`.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "reconciled",
            "in": "query",
            "description": "`true` for reconciled transactions only, `false` for unreconciled only.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Records per page, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact bank transaction identifier.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of bank transactions retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingTransactionListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed `date_range` filter (`INVALID_DATE_RANGE`).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-add",
            "accounting:banking-transaction-edit",
            "accounting:banking-transaction-list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/transactions/confirm-match": {
      "post": {
        "tags": [
          "Accounting / Transactions"
        ],
        "summary": "Confirm Transaction Match",
        "description": "Atomically allocates selected bank transactions to one ledger entity. Amounts are explicit in bank currency and are never silently recalculated. Document matches require the same bank and document currency, matching original amounts, and the bank transaction settlement rate. Exact retries are idempotent; changed allocation payloads return a conflict. Statement reconciliation is a separate operation.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-add, accounting:banking-transaction-edit, accounting:banking-transaction-category, accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "confirm_match_transaction",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionConfirmFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Transaction match confirmed and ledger synchronized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BankingTransactionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid match: Amount mismatch or entity already linked",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Transaction or Target Entity not found"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-add",
            "accounting:banking-transaction-edit",
            "accounting:banking-transaction-category",
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/transactions/exclude": {
      "post": {
        "tags": [
          "Accounting / Transactions"
        ],
        "summary": "Exclude Transactions",
        "description": "Marks one or more bank transactions as 'Ignored'. This prevents them from appearing in reconciliation queues or financial reports. Used for non-business expenses or duplicate entries. A mandatory 'reason' must be provided to maintain an audit-compliant history of why these records were bypassed.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-add, accounting:banking-transaction-edit, accounting:banking-transaction-category, accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "exclude_transactions",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionExcludeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Transactions successfully excluded and moved to ignored status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AffectedCountResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid Request: Missing mandatory exclusion reason",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Forbidden: Cannot exclude transactions belonging to another organization"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-add",
            "accounting:banking-transaction-edit",
            "accounting:banking-transaction-category",
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/transactions/find-group-match": {
      "post": {
        "tags": [
          "Accounting / Transactions"
        ],
        "summary": "Match Grouped Transactions",
        "description": "Returns bounded matching suggestions for a selected group of bank transactions using their remaining balances. This is a discovery operation and does not create allocations, payments, or statement reconciliations.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-add, accounting:banking-transaction-edit, accounting:banking-transaction-category, accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "match_group_transactions",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MatchGroupTransactionModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Group match successfully validated and ledger records linked",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MatchGroupTransactionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Mathematical mismatch: Total transaction sum does not equal total entity allocation",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "422": {
            "description": "Unprocessable Entity: One or more records are already reconciled or locked"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-add",
            "accounting:banking-transaction-edit",
            "accounting:banking-transaction-category",
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/transactions/restore": {
      "post": {
        "tags": [
          "Accounting / Transactions"
        ],
        "summary": "Restore Transactions",
        "description": "Reverses the 'Ignored' status for one or more bank transactions. This action reinstates the records into the active reconciliation queue and includes them in financial reporting once again. Use this to correct accidental exclusions or when a previously ignored transaction is identified as a valid business expense.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-add, accounting:banking-transaction-edit, accounting:banking-transaction-category, accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "restore_transactions",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionRestoreFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Transactions successfully restored to active status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AffectedCountResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Forbidden: Unauthorized access to specified transaction records"
          },
          "404": {
            "description": "Not Found: One or more transaction IDs do not exist"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-add",
            "accounting:banking-transaction-edit",
            "accounting:banking-transaction-category",
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/transactions/revert": {
      "post": {
        "tags": [
          "Accounting / Transactions"
        ],
        "summary": "Revert Transaction Match",
        "description": "Disconnects a bank transaction from its linked ledger entities (Invoices, Bills, or Journal Entries). This action resets the 'is_reconciled' status to false and removes associated mappings, effectively returning the transaction to the 'Unmatched' queue for re-categorization. Essential for correcting matching errors after they have been confirmed.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-add, accounting:banking-transaction-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "revert_transactions",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransactionRevertFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Transaction mappings successfully removed and status reset",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AffectedCountResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Not Found: Transaction ID or mapping record not found"
          },
          "409": {
            "description": "Conflict: Cannot revert a transaction that is part of a locked reconciliation period"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-add",
            "accounting:banking-transaction-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/transactions/settlement-preview": {
      "post": {
        "tags": [
          "Accounting / Transactions"
        ],
        "summary": "Preview Bank Settlement",
        "description": "Returns estimated FX conversion, explicit bank/document allocations, fees, remaining balances and projected realised FX. Estimates do not establish settlement: confirm-match accepts the returned explicit amounts and revalidates current balances.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-add, accounting:banking-transaction-edit, accounting:banking-transaction-category, accounting:banking-transaction-reconcile, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "settlement_preview",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettlementPreviewForm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettlementPreviewResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-add",
            "accounting:banking-transaction-edit",
            "accounting:banking-transaction-category",
            "accounting:banking-transaction-reconcile",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/accounting/transactions/{transaction_id}": {
      "get": {
        "tags": [
          "Accounting / Transactions"
        ],
        "summary": "Get Transaction Detail",
        "description": "Retrieves the full profile of a specific bank transaction, including its ledger mappings and allocation history. This endpoint reveals how an amount is split across different entities (Invoices, Bills, or Expenses), providing the granular audit trail necessary for precise financial reconciliation.\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:banking-transaction-add, accounting:banking-transaction-edit, accounting:banking-transaction-list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_transaction_detail",
        "parameters": [
          {
            "name": "transaction_id",
            "in": "path",
            "description": "Unique identifier of the bank transaction",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Transaction details and entity mappings retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransactionDetailResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Transaction not found"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:banking-transaction-add",
            "accounting:banking-transaction-edit",
            "accounting:banking-transaction-list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/acl/module": {
      "get": {
        "tags": [
          "Access & Permissions"
        ],
        "summary": "Get Modules List",
        "description": "Get Modules List\n\nThe API Gateway requires a bearer access token. Required permissions (any): staff-role:list, staff-role:add, staff-role:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_acl_modules",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Modules List",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AclModuleListResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "staff-role:list",
            "staff-role:add",
            "staff-role:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/acl/permission": {
      "get": {
        "tags": [
          "Access & Permissions"
        ],
        "summary": "Get Modules Permissions",
        "description": "Lists the permissions you may put on a role: the values accepted in `role_permission`. A caller cannot grant a permission they do not hold, so a caller with a narrower role sees a shorter list.\n\nThe API Gateway requires a bearer access token. Required permissions (any): staff-role:list, staff-role:add, staff-role:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_acl_module_permissions",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Modules Permissions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PermissionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "staff-role:list",
            "staff-role:add",
            "staff-role:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/acl/role": {
      "post": {
        "tags": [
          "Access & Permissions"
        ],
        "summary": "Create Acl Role",
        "description": "Creates a company role. `role_permission` is a JSON array, sent as a string, of names from `GET /acl/permission`. An unknown name fails validation on that field with `ROLE_PERMISSION_INVALID`, and one you do not hold with `ROLE_PERMISSION_NOT_HELD`. The name `admin` is reserved.\n\nThe API Gateway requires a bearer access token. Required permissions (any): staff-role:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_acl_role",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AclCompanyRoleFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Create Acl Role",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AclCompanyRoleFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Malformed, unknown, not held or reserved value",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "staff-role:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/acl/role/{id}": {
      "get": {
        "tags": [
          "Access & Permissions"
        ],
        "summary": "Acl Role Detail",
        "description": "Acl Role Detail\n\nThe API Gateway requires a bearer access token. Required permissions (any): staff-role:list, staff-role:add, staff-role:edit, staff-role:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "role_detail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Acl Role Detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AclCompanyRolePermission"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "staff-role:list",
            "staff-role:add",
            "staff-role:edit",
            "staff-role:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Access & Permissions"
        ],
        "summary": "Update Acl Role",
        "description": "Updates a custom role. `role_permission` is a JSON array, sent as a string, of names from `GET /acl/permission`. An unknown name fails validation on that field with `ROLE_PERMISSION_INVALID`, and one you do not hold with `ROLE_PERMISSION_NOT_HELD`. You may keep a permission the role already has without holding it yourself. The name `admin` is reserved. A system-defined role cannot be changed and fails with `SYSTEM_DEFINED_ROLE`.\n\nThe API Gateway requires a bearer access token. Required permissions (any): staff-role:add, staff-role:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_acl_role_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AclCompanyRoleFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update Acl Role",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AclCompanyRoleFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Malformed, unknown, not held or reserved value",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "System-defined role"
          },
          "404": {
            "description": "Role not found"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "staff-role:add",
            "staff-role:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Access & Permissions"
        ],
        "summary": "Delete Acl Role",
        "description": "Delete Acl Role\n\nThe API Gateway requires a bearer access token. Required permissions (any): staff-role:delete, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_delete_acl_role_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete Acl Role",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AclCompanyRoleFormResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "staff-role:delete",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/action-confirmation/email-code": {
      "post": {
        "tags": [
          "Action Verification"
        ],
        "summary": "Send public email action confirmation code",
        "description": "Send public email action confirmation code",
        "operationId": "send_public_email_code",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PublicEmailConfirmationCodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Confirmation code queued successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailConfirmationCodeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 5 requests per minute per client (bursts up to 6). The response has no body and no `Retry-After` header; wait 12 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": false
        }
      }
    },
    "/v1/action-confirmation/me/email-code": {
      "post": {
        "tags": [
          "Action Verification"
        ],
        "summary": "Send authenticated email action confirmation code",
        "description": "Send authenticated email action confirmation code\n\nThe API Gateway requires a bearer access token.",
        "operationId": "send_authenticated_email_code",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthenticatedEmailConfirmationCodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Confirmation code queued successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailConfirmationCodeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 30 requests per minute per client (bursts up to 40). The response has no body and no `Retry-After` header; wait 2 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true
        }
      }
    },
    "/v1/activity": {
      "get": {
        "tags": [
          "Audit Activity"
        ],
        "summary": "List activities",
        "description": "List activities\n\nThe API Gateway requires a bearer access token. Required permissions (any): activity:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "activity_list",
        "parameters": [
          {
            "name": "entity_id",
            "in": "query",
            "description": "Only activity for this record.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "description": "User identifier.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page number for page-mode paging. Cannot be combined with cursor-mode filters (`cursor`, `limit`, `from`, `to`, `event`, `source_type`, `app_type`, `app_connect_id`).",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "created_date",
            "in": "query",
            "description": "Date range `YYYY-MM-DD,YYYY-MM-DD` (UTC, both ends inclusive). Cannot be combined with `from` or `to`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "module",
            "in": "query",
            "description": "Module identifier, as returned by the activity list.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Records per page in page mode, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque `next_cursor` from the previous page. Omit for the first page; keep every other filter unchanged between pages.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Records per page in cursor mode, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "Earliest timestamp (RFC 3339), inclusive. Uses cursor paging.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "Latest timestamp (RFC 3339), exclusive. Uses cursor paging.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "event",
            "in": "query",
            "description": "Exact event key, as returned in the activity list. Uses cursor paging.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "source_type",
            "in": "query",
            "description": "Actor source, for example `app_connect` for changes made through an App Connect client. Uses cursor paging.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "app_type",
            "in": "query",
            "description": "Application type of the actor, for example `mcp_agent`. Requires `source_type`. Uses cursor paging.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "app_connect_id",
            "in": "query",
            "description": "App Connect client identifier of the actor. Requires `source_type=app_connect`. Uses cursor paging.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of user activities fetched successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActivityListResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Invalid activity filters or cursor",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "activity:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/activity/entity": {
      "get": {
        "tags": [
          "Audit Activity"
        ],
        "summary": "List activities for an entity",
        "description": "List activities for an entity\n\nThe API Gateway requires a bearer access token. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "entity_activity",
        "parameters": [
          {
            "name": "entity_id",
            "in": "query",
            "description": "Identifier of the record. Required.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "module",
            "in": "query",
            "description": "Module the record belongs to. Required.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Records per page, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Entity-specific activity logs fetched successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EntityActivityListModel"
                }
              }
            }
          },
          "400": {
            "description": "Missing `entity_id` or `module`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true
        }
      }
    },
    "/.well-known/oauth-authorization-server": {
      "get": {
        "tags": [
          "App Connect"
        ],
        "summary": "Get OAuth Authorization Server Metadata",
        "description": "Get OAuth Authorization Server Metadata",
        "operationId": "oauth_authorization_server_metadata",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OAuth authorization server metadata fetched successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthAuthorizationServerMetadataModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 5 requests per minute per client (bursts up to 6). The response has no body and no `Retry-After` header; wait 12 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [],
        "x-api-gateway-auth": {
          "bearer": false
        }
      }
    },
    "/.well-known/oauth-protected-resource": {
      "get": {
        "tags": [
          "App Connect"
        ],
        "summary": "Get OAuth Protected Resource Metadata",
        "description": "Get OAuth Protected Resource Metadata",
        "operationId": "oauth_protected_resource_metadata",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OAuth protected resource metadata fetched successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthProtectedResourceMetadataModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 5 requests per minute per client (bursts up to 6). The response has no body and no `Retry-After` header; wait 12 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [],
        "x-api-gateway-auth": {
          "bearer": false
        }
      }
    },
    "/oauth/authorize": {
      "get": {
        "tags": [
          "App Connect"
        ],
        "summary": "Authorize OAuth Client",
        "description": "Authorize OAuth Client\n\nThe API Gateway requires a bearer access token.",
        "operationId": "oauth_authorize_client",
        "parameters": [
          {
            "name": "response_type",
            "in": "query",
            "description": "OAuth 2.0 response type. Only `code` is supported.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "description": "OAuth client identifier of the requesting application.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "description": "Redirect URI registered for the OAuth client; the authorization response is sent here.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "description": "Only dimensions enabled for this scope.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state, comma-separated: `active`, `archived`, `deleted` (or `0`, `1`, `2`). Omitted means active only.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code_challenge",
            "in": "query",
            "description": "PKCE code challenge (RFC 7636) derived from the client's code verifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code_challenge_method",
            "in": "query",
            "description": "PKCE challenge method. Use `S256`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "OAuth authorization code issued successfully"
          },
          "400": {
            "description": "Missing or invalid authorization request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 30 requests per minute per client (bursts up to 40). The response has no body and no `Retry-After` header; wait 2 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true
        }
      }
    },
    "/v1/app-connect/oauth/authorize/preview": {
      "get": {
        "tags": [
          "App Connect"
        ],
        "summary": "Preview OAuth Authorization Request",
        "description": "Preview OAuth Authorization Request\n\nThe API Gateway requires a bearer access token.",
        "operationId": "oauth_authorization_preview",
        "parameters": [
          {
            "name": "response_type",
            "in": "query",
            "description": "OAuth 2.0 response type. Only `code` is supported.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "client_id",
            "in": "query",
            "description": "OAuth client identifier of the requesting application.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "redirect_uri",
            "in": "query",
            "description": "Redirect URI registered for the OAuth client; the authorization response is sent here.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scope",
            "in": "query",
            "description": "Only dimensions enabled for this scope.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state, comma-separated: `active`, `archived`, `deleted` (or `0`, `1`, `2`). Omitted means active only.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code_challenge",
            "in": "query",
            "description": "PKCE code challenge (RFC 7636) derived from the client's code verifier.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code_challenge_method",
            "in": "query",
            "description": "PKCE challenge method. Use `S256`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OAuth authorization request preview fetched successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthAuthorizationPreviewResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid authorization request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true
        }
      }
    },
    "/v1/app-connect/oauth/register": {
      "post": {
        "tags": [
          "App Connect"
        ],
        "summary": "Register OAuth Client",
        "description": "Register OAuth Client",
        "operationId": "oauth_register_client",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OAuthClientRegistrationFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OAuth client registered successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OAuthClientRegistrationModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 5 requests per minute per client (bursts up to 6). The response has no body and no `Retry-After` header; wait 12 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": false
        }
      }
    },
    "/v1/app-connect/oauth/token": {
      "post": {
        "tags": [
          "App Connect"
        ],
        "summary": "OAuth Token Exchange",
        "description": "Server-to-server client credentials exchange. Call this operation only from a partner BFF; never expose client_secret to browser code. The response is the standard OAuth 2.0 token response (RFC 6749), not wrapped in `data`: read `access_token` from the top level.",
        "operationId": "oauth_token_exchange",
        "parameters": [
          {
            "name": "x-partner-domain",
            "in": "header",
            "description": "Optional but recommended registered partner domain. When omitted, the token exchange resolves the partner from the client’s company.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "grant_type",
                  "client_id",
                  "client_secret"
                ],
                "properties": {
                  "grant_type": {
                    "type": "string",
                    "enum": [
                      "client_credentials"
                    ]
                  },
                  "client_id": {
                    "type": "string"
                  },
                  "client_secret": {
                    "type": "string"
                  },
                  "member_company_id": {
                    "type": "string",
                    "description": "Mint the token for a company in your organization instead of the client's own company. Requires a client of the organization company holding `organization:company-token`; any other company is refused with 403 `ORGANIZATION_COMPANY_MISMATCH`."
                  }
                }
              },
              "example": {
                "grant_type": "client_credentials",
                "client_id": "YOUR_CLIENT_ID",
                "client_secret": "YOUR_CLIENT_SECRET"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OAuth token issued successfully (RFC 6749, not wrapped in `data`)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppConnectTokenModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "App Connect client credentials are invalid or unauthorized."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 5 requests per minute per client (bursts up to 6). The response has no body and no `Retry-After` header; wait 12 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "x-api-gateway-auth": {
          "bearer": false
        }
      }
    },
    "/v1/app-connect/oauth/token/validate": {
      "post": {
        "tags": [
          "App Connect"
        ],
        "summary": "Validate App Connect OAuth Access Token",
        "description": "Validate App Connect OAuth Access Token",
        "operationId": "oauth_validate_token",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ValidateAppTokenFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OAuth access token validated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AppConnectTokenValidationResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 5 requests per minute per client (bursts up to 6). The response has no body and no `Retry-After` header; wait 12 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [],
        "x-api-gateway-auth": {
          "bearer": false
        }
      }
    },
    "/v1/bills": {
      "get": {
        "tags": [
          "Bills"
        ],
        "summary": "List Bills",
        "description": "List Bills\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, bill:list, bill:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_bills",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "vendor",
            "in": "query",
            "description": "Vendor identifier (`id` of a vendor). Accepts a comma-separated list on document lists.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Comma-separated status keys from this module's status settings; any of them matches.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Exact document number.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Minimum total, as a decimal string: returns records whose total is greater than or equal to it.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact reference to match.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "issue_date",
            "in": "query",
            "description": "Issue date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with `INVALID_ISSUE_DATE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state, comma-separated: `active`, `archived`, `deleted` (or `0`, `1`, `2`). Omitted means active only.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Records per page, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "recurring",
            "in": "query",
            "description": "`true` returns only recurring templates; `false` only one-off records. Omitted returns both.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "past_due",
            "in": "query",
            "description": "Only documents whose due date has passed (the list's overdue view for modules whose workflow\nhas no `overdue` status, such as bills). Combine with `status` for the open statuses.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of documents",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentListResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "bill:list",
            "bill:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Bills"
        ],
        "summary": "Create Bill",
        "description": "Create Bill\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_bills",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFormModel"
              },
              "example": {
                "currency": "USD",
                "document_issue_date": "2026-10-15",
                "document_number": "INV-1042",
                "items": [
                  {
                    "item_cost": "100.00",
                    "item_id": "00000000-0000-4000-8000-000000000005",
                    "item_quantity": "1"
                  }
                ],
                "people_id": "00000000-0000-4000-8000-000000000004"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Create a new document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/setting/status": {
      "get": {
        "tags": [
          "Bills"
        ],
        "summary": "Get All Status",
        "description": "Get All Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, bill:view, bill:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_all_status_get_bills_setting_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get All Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusListModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "bill:view",
            "bill:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Bills"
        ],
        "summary": "Add New Status",
        "description": "Add New Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "document_status_post_bills_setting_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add New Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/attribute": {
      "put": {
        "tags": [
          "Bills"
        ],
        "summary": "Bulk Update Attributes",
        "description": "Bulk Update Attributes\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "attr_update_put_bills_attribute",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentAttrFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bulk update attributes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentAttrFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/setting": {
      "get": {
        "tags": [
          "Bills"
        ],
        "summary": "Get Settings",
        "description": "Get Settings\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, bill:list, bill:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_document_setting_get_bills_setting",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSettingModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "bill:list",
            "bill:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Bills"
        ],
        "summary": "Save Settings",
        "description": "Save Settings\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, bill:list, bill:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "save_document_setting_put_bills_setting",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettingFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Save Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSettingModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "bill:list",
            "bill:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/setting/state-transition": {
      "get": {
        "tags": [
          "Bills"
        ],
        "summary": "Get Transitions",
        "description": "Get Transitions\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, bill:list, bill:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_state_transition_get_bills_setting_state_transition",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Transitions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransitionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "bill:list",
            "bill:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/setting/state-transition/ledger-effects": {
      "get": {
        "tags": [
          "Bills"
        ],
        "summary": "List ledger effects for a document type",
        "description": "Returns the LedgerEffect enum variants available for this document type. Workflow forms should load the dropdown from this list rather than hardcoding values.\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, bill:list, bill:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "get_ledger_effect_options_get_bills_setting_state_transition_ledger_effects",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Available ledger effects",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerEffectOptionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "bill:list",
            "bill:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/setting/status/categorize": {
      "post": {
        "tags": [
          "Bills"
        ],
        "summary": "Categorise the uncategorised Bill statuses",
        "description": "Gives every status the company defined itself (and that has no category yet) the chosen category: draft, open, settled or void. System statuses are never changed.\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "categorize_statuses_post_bills_setting_status_categorize",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusCategorizeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "How many statuses were categorised",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusCategorizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/setting/status/{id}": {
      "put": {
        "tags": [
          "Bills"
        ],
        "summary": "Update Status",
        "description": "Update Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_document_status_put_bills_setting_status_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Workflow status identifier (`id` from this module's status settings).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Bills"
        ],
        "summary": "Delete Status",
        "description": "Delete Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_status_delete_bills_setting_status_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Workflow status identifier (`id` from this module's status settings).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/summary": {
      "get": {
        "tags": [
          "Bills"
        ],
        "summary": "Summary of Bill",
        "description": "Per-status counts and base-currency totals (gross, balance, balance due soon) plus documents per record state, for the list's status strip. Takes the list's search filters but never status, recurring or paging. Reports every status and leaves grouping them to the caller.\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, bill:list, bill:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "summary_get_bills_summary",
        "parameters": [
          {
            "name": "vendor",
            "in": "query",
            "description": "Vendor identifier (`id` of a vendor). Accepts a comma-separated list on document lists.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Exact document number.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Minimum total, as a decimal string: returns records whose total is greater than or equal to it.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact reference to match.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "issue_date",
            "in": "query",
            "description": "Issue date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with `INVALID_ISSUE_DATE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state (`0|active`, `1|archived`, `2|deleted`) the `statuses` are scoped to.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "due_soon_days",
            "in": "query",
            "description": "Window for `due_soon_balance_bcy`, in days (default 7, at most 90).",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Document summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSummaryResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "bill:list",
            "bill:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/{id}": {
      "get": {
        "tags": [
          "Bills"
        ],
        "summary": "Get Bill",
        "description": "Get Bill\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, bill:list, bill:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_document_by_anchor_get_bills_id",
        "parameters": [
          {
            "name": "version",
            "in": "query",
            "description": "A `document_version_id` from the document's `version_history`, to read that earlier version. Omitted returns the current version.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get document detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentDetailResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "bill:list",
            "bill:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Bills"
        ],
        "summary": "Update Bill",
        "description": "Update Bill\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_bills_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFormModel"
              },
              "example": {
                "currency": "USD",
                "document_issue_date": "2026-10-15",
                "document_number": "INV-1042",
                "items": [
                  {
                    "item_cost": "100.00",
                    "item_id": "00000000-0000-4000-8000-000000000005",
                    "item_quantity": "1"
                  }
                ],
                "people_id": "00000000-0000-4000-8000-000000000004"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update the document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/{id}/comment": {
      "get": {
        "tags": [
          "Bills"
        ],
        "summary": "List comment",
        "description": "List comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, bill:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_comment_get_bills_id_comment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "bill:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Bills"
        ],
        "summary": "Add comment",
        "description": "Add comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, bill:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "add_comment_post_bills_id_comment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentCommentFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "bill:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/{id}/comment/{comment_id}": {
      "delete": {
        "tags": [
          "Bills"
        ],
        "summary": "Delete comment",
        "description": "Delete comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_comment_delete_bills_id_comment_comment_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "comment_id",
            "in": "path",
            "description": "Comment identifier (`id` from the document's comment list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentDeleteListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/{id}/dimensions": {
      "put": {
        "tags": [
          "Bills"
        ],
        "summary": "Correct Bill line dimensions",
        "description": "Changes the dimension values of an issued document's lines and nothing else (amounts, accounts, taxes and dates cannot be sent). Each listed line gets exactly the values sent (an empty list clears it); lines not listed keep theirs. The document's current version is updated in place and its journal re-posted with the new resolved values. Send expected_version (the current version_number). Transaction Locking applies as for an edit: a hard lock refuses the call, a soft lock lets a user with the bypass permission through and is logged.\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "correct_dimensions_put_bills_id_dimensions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DimensionCorrectionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Corrected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionCorrectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or lock error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Document not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, unknown line, or document not issued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/{id}/mail/send": {
      "post": {
        "tags": [
          "Bills"
        ],
        "summary": "Send via Email",
        "description": "Send via Email\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:send, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "send_mail_post_bills_id_mail_send",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentMailFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Send Email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMailFromResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:send",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/{id}/mail/{template_id}": {
      "get": {
        "tags": [
          "Bills"
        ],
        "summary": "Get Mail Content",
        "description": "Get Mail Content\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:send, bill:edit, bill:list, bill:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_email_template_get_bills_id_mail_template_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "template_id",
            "in": "path",
            "description": "Email template type to render for this document.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Mail Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplateTypeModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:send",
            "bill:edit",
            "bill:list",
            "bill:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/{id}/meta-data": {
      "post": {
        "tags": [
          "Bills"
        ],
        "summary": "Update meta data",
        "description": "Update meta data\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "meta_data_post_bills_id_meta_data",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentMetaData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update meta data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/{id}/payment": {
      "post": {
        "tags": [
          "Bills"
        ],
        "summary": "Add Bill Payment",
        "description": "Payment and required settlement/FX effects commit together. Optional Idempotency-Key (1–128 characters) is company-scoped: identical retries return the recorded payment, including its reversal state; changed details return 409. Without a key each request is a new payment. References remain free-form.\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:payment, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "save_payment_post_bills_id_payment",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable client request identity; reuse only for identical retries",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentFromModel"
              },
              "example": {
                "deposit_account": "00000000-0000-4000-8000-000000000001",
                "payment_amount": "100.00",
                "payment_date": "2026-10-15",
                "payment_mode": "bank_transfer",
                "reference_number": "TRANSFER-1042"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add payment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentFromResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 20 requests per minute per client (bursts up to 25). The response has no body and no `Retry-After` header; wait 3 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:payment",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/{id}/payment/{payment_id}": {
      "delete": {
        "tags": [
          "Bills"
        ],
        "summary": "Delete Bill Payment",
        "description": "Delete Bill Payment\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:payment, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_payment_delete_bills_id_payment_payment_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "payment_id",
            "in": "path",
            "description": "Payment identifier (`id` of the payment recorded against this document).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete payment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentFromResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 20 requests per minute per client (bursts up to 25). The response has no body and no `Retry-After` header; wait 3 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:payment",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/bills/{id}/state-transition": {
      "put": {
        "tags": [
          "Bills"
        ],
        "summary": "Status Transition",
        "description": "Status Transition\n\nThe API Gateway requires a bearer access token. Required permissions (any): bill:add, bill:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "transition_to_put_bills_id_state_transition",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransitionFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Status Transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "bill:add",
            "bill:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/clients": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "List Client",
        "description": "List Client\n\nThe API Gateway requires a bearer access token. Required permissions (any): client:add, client:edit, client:list, client:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_clients",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Records per page, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "name",
            "in": "query",
            "description": "Case-insensitive partial match on the name.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "email",
            "in": "query",
            "description": "Case-insensitive partial match on the email address.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "deleted",
            "in": "query",
            "description": "`true` returns only deleted records; omitted or `false` returns records that are not deleted.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of people (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleListResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "client:add",
            "client:edit",
            "client:list",
            "client:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Clients"
        ],
        "summary": "Create Client",
        "description": "Create Client\n\nThe API Gateway requires a bearer access token. Required permissions (any): client:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_clients",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PeopleFormModel"
              },
              "example": {
                "company_email": "billing@example.com",
                "company_name": "Example Studio",
                "contact_first_name": "Alex",
                "currency": "USD",
                "locale": "en-US"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Create people (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "client:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/clients/dimension-defaults/lookup": {
      "post": {
        "tags": [
          "Clients"
        ],
        "summary": "Look up Client default dimensions",
        "description": "Batch read of the default dimension values saved on up to 100 clients or vendors, one call instead of one detail read per contact. A read sent as POST because the ids do not fit a query string. One entry per requested id, in request order; a contact with none, or an id that is not this tenant's contact of the asked type, has an empty state. The items list is empty while Dimensions is not activated, like the contact detail.\n\nThe API Gateway requires a bearer access token. Required permissions (any): client:add, client:edit, client:list, client:view, invoice:add, invoice:edit, invoice:list, invoice:view, quote:add, quote:edit, quote:list, quote:view, credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "dimension_defaults_lookup_post_clients_dimension_defaults_lookup",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DefaultsLookupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Defaults per contact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DefaultsLookupResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown people type, empty list, more than 100 ids, or a blank id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "client:add",
            "client:edit",
            "client:list",
            "client:view",
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/clients/get-all": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "List All Client",
        "description": "List All Client\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:list, invoice:view, quote:add, quote:edit, quote:list, quote:view, credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_all_people_get_clients_get_all",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get all of people (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleFullListResponseModel"
                },
                "example": {
                  "data": {
                    "00000000-0000-4000-8000-000000000001": {
                      "attributes": null,
                      "company_email": "client@example.com",
                      "company_name": "Example Studio",
                      "contact_first_name": "Alex",
                      "contact_last_name": "Lee",
                      "contacts": null,
                      "created_at": "2026-10-23T08:00:00",
                      "credit": null,
                      "credit_bcy": null,
                      "currency": "USD",
                      "deleted_at": null,
                      "external_id": null,
                      "external_source": null,
                      "id": "00000000-0000-4000-8000-000000000001",
                      "is_active": true,
                      "locale": "en-US",
                      "outstanding": null,
                      "outstanding_bcy": null,
                      "people_type": "client"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/clients/{id}": {
      "get": {
        "tags": [
          "Clients"
        ],
        "summary": "Get Client",
        "description": "Get Client\n\nThe API Gateway requires a bearer access token. Required permissions (any): client:add, client:edit, client:list, client:view, invoice:add, invoice:edit, invoice:list, invoice:view, quote:add, quote:edit, quote:list, quote:view, credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "detail_get_clients_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get people detail (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleDetailResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "client:add",
            "client:edit",
            "client:list",
            "client:view",
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Clients"
        ],
        "summary": "Update Client",
        "description": "Update Client\n\nThe API Gateway requires a bearer access token. Required permissions (any): client:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_clients_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PeopleFormModel"
              },
              "example": {
                "company_email": "billing@example.com",
                "company_name": "Example Studio",
                "contact_first_name": "Alex",
                "currency": "USD",
                "locale": "en-US"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update people (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "client:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Clients"
        ],
        "summary": "Delete Client",
        "description": "Delete Client\n\nThe API Gateway requires a bearer access token. Required permissions (any): client:delete, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_delete_clients_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete people (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleDeleteResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "client:delete",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company": {
      "post": {
        "tags": [
          "Company"
        ],
        "summary": "Create Company",
        "description": "Creates a new company profile under the authenticated user. Also provisions the company's subscription: a trial, or partner-licensed coverage when the serving partner licenses its workspaces.\n\nThe API Gateway requires a bearer access token. Required permissions (any): company:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_company",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Company successfully created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "company:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "get": {
        "tags": [
          "Company"
        ],
        "summary": "Get Company by ID",
        "description": "Retrieves the full company profile by its unique identifier, including attributes and subscription information.\n\nThe API Gateway requires a bearer access token. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_company_by_id",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Company detail retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyDetailResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Company not found"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true
        }
      },
      "put": {
        "tags": [
          "Company"
        ],
        "summary": "Update Company",
        "description": "Updates an existing company profile. Validates all required fields before persisting changes.\n\nThe API Gateway requires a bearer access token. Required permissions (any): company:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "update_put_company",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Company successfully updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyUpdateResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "company:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/banks": {
      "get": {
        "tags": [
          "Company / Payment Instructions"
        ],
        "summary": "List Company Bank Accounts",
        "description": "Retrieves a paginated list of the organization's registered bank accounts and payment instructions. Used primarily for populating payout destinations and internal treasury management views.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:view, company:edit, app-setting:banks, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_company_banks",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of bank accounts retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyBankListResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:view",
            "company:edit",
            "app-setting:banks",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Company / Payment Instructions"
        ],
        "summary": "Create Bank Account",
        "description": "Creates a new set of payment instructions within the organization's profile. Validates provided financial identifiers (IBAN, Account Number) before committing to the secure ledger.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:banks, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_company_banks",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyBankFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bank account successfully created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyBankDetailResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:banks",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/banks/{id}": {
      "get": {
        "tags": [
          "Company / Payment Instructions"
        ],
        "summary": "Get Bank Account",
        "description": "Returns the comprehensive metadata for a specific bank account, including routing numbers, SWIFT/BIC codes, and currency constraints. Essential for validating high-value disbursement tasks.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:view, company:banks, company:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "detail_get_company_banks_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Bank account detail retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyBankDetailResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Bank account not found"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:view",
            "company:banks",
            "company:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Company / Payment Instructions"
        ],
        "summary": "Update Bank Account",
        "description": "Modifies existing payment instructions. This endpoint performs full schema validation to ensure that updated routing or account details maintain data integrity for future bank reconciliations.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:banks, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_company_banks_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyBankFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bank account successfully updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyBankDetailResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:banks",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/connections": {
      "get": {
        "tags": [
          "Company / Connections"
        ],
        "summary": "List Company Connections",
        "description": "Retrieves all company-to-company connection mappings for the specified receiver company, enriched with company metadata.\n\nThe API Gateway requires a bearer access token. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_company_connections",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of connections retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyMappingListResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true
        }
      }
    },
    "/v1/company/connections/{id}": {
      "put": {
        "tags": [
          "Company / Connections"
        ],
        "summary": "Update Connection Status",
        "description": "Updates the status of a company-to-company connection mapping (e.g., accept or reject a connection request).\n\nThe API Gateway requires a bearer access token. Required permissions (any): company:add, company:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "update_connection_status",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyCompanyStatusUpdateFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Connection status updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyMappingDetailResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "company:add",
            "company:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/currency": {
      "get": {
        "tags": [
          "Company / Currency"
        ],
        "summary": "List Company Currencies",
        "description": "Retrieves all currencies configured for the specified company, including default currency and symbol information.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:currency, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_all",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of currencies retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyCurrencyListResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:currency",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Company / Currency"
        ],
        "summary": "Save Company Currencies",
        "description": "Saves one or more currencies to the company's profile. Validates currency codes before persisting.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:currency, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "save",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyCurrencyFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Currencies saved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyCurrencyListResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:currency",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/currency-rates": {
      "get": {
        "tags": [
          "Company / Currency FX"
        ],
        "summary": "List Custom FX Rate Windows",
        "description": "Lists a company's custom FX rate windows (current, upcoming, expired). Tenant is derived from the auth context; automatic currencies are not returned as rows. Ordered by status (current, upcoming, expired), pair, then effective_from descending.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:currency, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "list_get_company_currency_rates",
        "parameters": [
          {
            "name": "base",
            "in": "query",
            "description": "Base currency (ISO 4217).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "target",
            "in": "query",
            "description": "Target currency (ISO 4217).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "Matches either side of the pair (ISO 4217).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "`active` (current + upcoming) | `current` | `upcoming` | `expired` | `all` (default `active`). Anything else is 400 `INVALID_FILTER`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "deleted",
            "in": "query",
            "description": "`active` | `deleted` | `all` (default `active`).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "description": "Compatibility alias for `deleted=all`. Must not contradict `deleted`.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "page_number",
            "in": "query",
            "description": "1-based page number. Omitted or zero values use page 1.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "default": 1,
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Page size. Omitted or zero values use 20; values above 100 are capped at 100.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "default": 20,
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Custom FX windows retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyFxRateListResponse"
                }
              }
            }
          },
          "400": {
            "description": "INVALID_FILTER: invalid currency code, status or deleted filter, or conflicting include_deleted and deleted values",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:currency",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Company / Currency FX"
        ],
        "summary": "Set Custom FX Rate",
        "description": "Creates a custom FX rate window (`1 target = exchange_rate company-base`) for a currency already added to the company. Dates are `YYYY-MM-DD` in the company timezone; `effective_to` is inclusive. Overlapping windows are rejected with `OVERLAPPING_FX_WINDOW` (details: `conflicting_id`, `replaceable`), except that `replace_open_ended: true` ends a single covering open-ended window the day before the new start (or retires it when it starts the same day).\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:currency, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_company_currency_rates",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyFxRateCreateForm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Custom FX window created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyFxRateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:currency",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/currency-rates/history": {
      "get": {
        "tags": [
          "Company / Currency FX"
        ],
        "summary": "Custom FX Rate Change History",
        "description": "Audit trail of custom FX rate changes (created, updated, ended, deleted), newest first, from the activity log. Requires only the currency settings permission, not the general activity feed. Dates are company-local `YYYY-MM-DD`.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:currency, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "history",
        "parameters": [
          {
            "name": "currency",
            "in": "query",
            "description": "Only changes to windows of this currency (ISO 4217).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page_number",
            "in": "query",
            "description": "1-based page number. Omitted or zero values use page 1.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "default": 1,
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Page size. Omitted or zero values use 20; values above 100 are capped at 100.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "default": 20,
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Change history retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyFxRateHistoryResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:currency",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/currency-rates/{currency}/switch-automatic": {
      "post": {
        "tags": [
          "Company / Currency FX"
        ],
        "summary": "Switch Currency To Automatic",
        "description": "Returns the target currency to the automatic rate from today: the current window is ended yesterday (or retired if it started today) and upcoming windows are soft-deleted. Expired windows are preserved as history.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:currency, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "switch_automatic",
        "parameters": [
          {
            "name": "currency",
            "in": "path",
            "description": "ISO 4217 currency code, for example `EUR`.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Currency switched to automatic",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyFxRateSwitchAutomaticResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:currency",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/currency-rates/{id}": {
      "put": {
        "tags": [
          "Company / Currency FX"
        ],
        "summary": "Edit Custom FX Rate",
        "description": "Edits the rate/window of a current or upcoming custom FX window. Expired or deleted windows are not editable. The start date of a window already in effect cannot change (`FX_RATE_START_LOCKED`).\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:currency, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_company_currency_rates_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyFxRateUpdateForm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Custom FX window updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyFxRateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:currency",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Company / Currency FX"
        ],
        "summary": "Remove Custom FX Rate",
        "description": "Removes a current or upcoming custom FX window, returning the pair to the automatic rate from today. A window that was in effect before today is ended yesterday (`outcome: ended`) so its history stays; an upcoming window, or one that started today, is soft-deleted (`outcome: deleted`). Repeating the call on a deleted window returns `outcome: already_deleted`. Expired windows cannot be removed.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:currency, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "delete_delete_company_currency_rates_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Custom FX window removed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyFxRateDeleteResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:currency",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/currency/add": {
      "post": {
        "tags": [
          "Company / Currency"
        ],
        "summary": "Add Company Currencies",
        "description": "Appends one or more currencies to the company's profile without touching the ones already configured (their ids and any linked FX rates are preserved). Currencies already present are ignored. Use DELETE to remove a currency.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:currency, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "add",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyCurrencyAddForm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Currencies added successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyCurrencyListResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:currency",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/currency/{id}": {
      "delete": {
        "tags": [
          "Company / Currency"
        ],
        "summary": "Delete Company Currency",
        "description": "Removes a specific currency from the company's configuration.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:currency, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_delete_company_currency_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Currency deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyCurrencyDeleteResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:currency",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/delete/{id}": {
      "post": {
        "tags": [
          "Company"
        ],
        "summary": "Soft Delete Company",
        "description": "Performs a soft delete on the specified company after email or TOTP confirmation.\n\nThe API Gateway requires a bearer access token. Required permissions (any): company:delete, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "soft_delete",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthenticatedActionChallengeForm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Company soft deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyDeleteResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "company:delete",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/emails": {
      "get": {
        "tags": [
          "Company / Email Templates"
        ],
        "summary": "List Email Templates",
        "description": "Retrieves all email templates configured for the specified company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:email-template, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_company_emails",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of email templates retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEmailTemplateListResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:email-template",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/emails/{doc_type_id}/{template_type}": {
      "get": {
        "tags": [
          "Company / Email Templates"
        ],
        "summary": "Get Email Template",
        "description": "Retrieves a specific email template by document type ID and template type for the specified company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:email-template, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_get_company_emails_doc_type_id_template_type",
        "parameters": [
          {
            "name": "doc_type_id",
            "in": "path",
            "description": "Document type the email template belongs to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "template_type",
            "in": "path",
            "description": "Email template type within the document type.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Email template retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEmailTemplateDetailResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Email template not found"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:email-template",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/emails/{id}": {
      "put": {
        "tags": [
          "Company / Email Templates"
        ],
        "summary": "Update Email Template",
        "description": "Updates an existing email template's subject and body content.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:email-template, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_company_emails_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyEmailTemplateFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Email template updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyEmailTemplateDetailResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:email-template",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/list": {
      "get": {
        "tags": [
          "Company"
        ],
        "summary": "List Companies",
        "description": "Returns all companies associated with the authenticated user, including basic metadata such as name, email, and logo.\n\nThe API Gateway requires a bearer access token. Required permissions (any): company:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "company_list",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of companies retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyListResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "company:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/logo-inline": {
      "post": {
        "tags": [
          "Company"
        ],
        "summary": "Save Logo Data URL",
        "description": "Saves a company logo from a base64-encoded data URL. Validates image type (JPEG, PNG, WEBP) and enforces a 200KB size limit.\n\nThe API Gateway requires a bearer access token. Required permissions (any): company:add, company:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "save_logo_data_url",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyLogoDataUrlForm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Logo saved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyLogoDataUrlResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "company:add",
            "company:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Company"
        ],
        "summary": "Delete Logo Data URL",
        "description": "Removes the company's inline logo data URL from the profile.\n\nThe API Gateway requires a bearer access token. Required permissions (any): company:add, company:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_logo_data_url",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Logo deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyLogoDataUrlResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "company:add",
            "company:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/payment-modes": {
      "get": {
        "tags": [
          "Company / Payment Modes"
        ],
        "summary": "List Payment Modes",
        "description": "Retrieves a paginated list of payment modes configured for the specified company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:view, invoice:payment, app-setting:payment-mode, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_company_payment_modes",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of payment modes retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyPaymentModeListResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:view",
            "invoice:payment",
            "app-setting:payment-mode",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Company / Payment Modes"
        ],
        "summary": "Create Payment Mode",
        "description": "Creates a new payment mode for the specified company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:view, invoice:payment, app-setting:payment-mode, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_company_payment_modes",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyPaymentModeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Payment mode created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyPaymentModeDetailResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:view",
            "invoice:payment",
            "app-setting:payment-mode",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/payment-modes/{id}": {
      "put": {
        "tags": [
          "Company / Payment Modes"
        ],
        "summary": "Update Payment Mode",
        "description": "Updates an existing payment mode's label or configuration.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:view, invoice:payment, app-setting:payment-mode, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_company_payment_modes_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyPaymentModeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Payment mode updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyPaymentModeDetailResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:view",
            "invoice:payment",
            "app-setting:payment-mode",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Company / Payment Modes"
        ],
        "summary": "Delete Payment Mode",
        "description": "Removes a payment mode from the company's configuration.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:payment-mode, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_delete_company_payment_modes_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Payment mode deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyPaymentModeDetailResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:payment-mode",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/payment-terms": {
      "get": {
        "tags": [
          "Company / Payment Terms"
        ],
        "summary": "List Payment Terms",
        "description": "Retrieves a paginated list of payment terms configured for the specified company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:view, app-setting:payment-term, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_company_payment_terms",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of payment terms retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyPaymentTermListResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:view",
            "app-setting:payment-term",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Company / Payment Terms"
        ],
        "summary": "Create Payment Term",
        "description": "Creates a new payment term with a label and number of days value for the specified company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:view, app-setting:payment-term, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_company_payment_terms",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyPaymentTermFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Payment term created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyPaymentTermDetailResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:view",
            "app-setting:payment-term",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/payment-terms/{id}": {
      "put": {
        "tags": [
          "Company / Payment Terms"
        ],
        "summary": "Update Payment Term",
        "description": "Updates an existing payment term's label or value.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:view, app-setting:payment-term, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_company_payment_terms_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyPaymentTermFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Payment term updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyPaymentTermDetailResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:view",
            "app-setting:payment-term",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Company / Payment Terms"
        ],
        "summary": "Delete Payment Term",
        "description": "Removes a payment term from the company's configuration.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:payment-term, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_delete_company_payment_terms_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Payment term deleted successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyPaymentTermDetailResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:payment-term",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/smtp": {
      "get": {
        "tags": [
          "Company / Email Delivery"
        ],
        "summary": "Get SMTP Configuration",
        "description": "Retrieves the SMTP configuration for the specified company, including server, port, and security settings.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:smtp, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_get_company_smtp",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "SMTP configuration retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmtpPublicDetailResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "SMTP configuration not found"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:smtp",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Company / Email Delivery"
        ],
        "summary": "Update SMTP Configuration",
        "description": "Updates the existing SMTP configuration. Validates connection settings before persisting changes.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:smtp, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_company_smtp",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SmtpFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "SMTP configuration updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmtpPublicFormResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:smtp",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Company / Email Delivery"
        ],
        "summary": "Create SMTP Configuration",
        "description": "Creates a new SMTP configuration for the company. Validates connection settings including server, port, and security method before saving.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:smtp, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_company_smtp",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SmtpFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "SMTP configuration created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmtpPublicFormResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:smtp",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Company / Email Delivery"
        ],
        "summary": "Delete SMTP Configuration",
        "description": "Removes the SMTP configuration for the specified company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:smtp, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_delete_company_smtp",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "SMTP configuration deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SmtpDeleteResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:smtp",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/stripe-connect": {
      "get": {
        "tags": [
          "Company / Stripe Connect"
        ],
        "summary": "List Stripe Connect Accounts",
        "description": "Retrieves all Stripe Connect accounts associated with the specified company, regardless of connection status.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:online-payment, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_company_stripe_connect",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Connected accounts listed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeConnectRawListResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:online-payment",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Company / Stripe Connect"
        ],
        "summary": "Connect Stripe Account",
        "description": "Initiates a new Stripe Connect account connection for the company. Creates the account and begins the onboarding flow.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:online-payment, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "connect",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompanyStripConnectFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Stripe account connection initiated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeConnectUrlResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:online-payment",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/stripe-connect/accounts/ready": {
      "get": {
        "tags": [
          "Company / Stripe Connect"
        ],
        "summary": "Get Fully Connected Accounts",
        "description": "Retrieves all Stripe Connect accounts that have completed the onboarding process and are fully operational for the specified company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:online-payment, invoice:add, invoice:edit, invoice:list, invoice:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_fully_connected_accounts",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Fully connected accounts retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeConnectListResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:online-payment",
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/stripe-connect/resume-onboarding/{id}": {
      "get": {
        "tags": [
          "Company / Stripe Connect"
        ],
        "summary": "Resume Stripe Onboarding",
        "description": "Generates a new onboarding link for a Stripe Connect account that has not completed the onboarding process.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:online-payment, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "resume_onboading",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Onboarding link generated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StripeConnectUrlResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:online-payment",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/stripe-connect/{id}": {
      "delete": {
        "tags": [
          "Company / Stripe Connect"
        ],
        "summary": "Delete Stripe Connect Account",
        "description": "Removes a Stripe Connect account from the company's configuration.\n\nThe API Gateway requires a bearer access token. Required permissions (any): app-setting:online-payment, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_delete_company_stripe_connect_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Stripe account deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeleteStripeConnectAccountResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "app-setting:online-payment",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/company/mark-onboarding-completed": {
      "put": {
        "tags": [
          "Company"
        ],
        "summary": "Mark Onboarding Completed",
        "description": "Marks the onboarding process as completed for the specified company, enabling full platform features.\n\nThe API Gateway requires a bearer access token. Required permissions (any): company:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "update_onboarding_flag",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Onboarding flag updated successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompanyUpdateResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "company:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes": {
      "get": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "List Credit Notes",
        "description": "List Credit Notes\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, credit-note:view, credit-note:payment, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_credit_notes",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "client",
            "in": "query",
            "description": "Client identifier (`id` of a client). Accepts a comma-separated list on document lists.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Comma-separated status keys from this module's status settings; any of them matches.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Exact document number.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Minimum total, as a decimal string: returns records whose total is greater than or equal to it.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact reference to match.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "issue_date",
            "in": "query",
            "description": "Issue date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with `INVALID_ISSUE_DATE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state, comma-separated: `active`, `archived`, `deleted` (or `0`, `1`, `2`). Omitted means active only.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "past_due",
            "in": "query",
            "description": "Only documents whose due date has passed (the list's overdue view for modules whose workflow\nhas no `overdue` status, such as bills). Combine with `status` for the open statuses.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of documents",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentListResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "credit-note:view",
            "credit-note:payment",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Create Credit Note",
        "description": "Create Credit Note\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_credit_notes",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFormModel"
              },
              "example": {
                "currency": "USD",
                "document_issue_date": "2026-10-15",
                "document_number": "INV-1042",
                "items": [
                  {
                    "item_cost": "100.00",
                    "item_id": "00000000-0000-4000-8000-000000000005",
                    "item_quantity": "1"
                  }
                ],
                "people_id": "00000000-0000-4000-8000-000000000004"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Create a new document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/setting/status": {
      "get": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Get All Status",
        "description": "Get All Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_all_status_get_credit_notes_setting_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get All Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusListModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Add New Status",
        "description": "Add New Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "document_status_post_credit_notes_setting_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add New Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/attribute": {
      "put": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Bulk Update Attributes",
        "description": "Bulk Update Attributes\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "attr_update_put_credit_notes_attribute",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentAttrFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bulk update attributes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentAttrFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/setting": {
      "get": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Get Settings",
        "description": "Get Settings\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_document_setting_get_credit_notes_setting",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSettingModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Save Settings",
        "description": "Save Settings\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "save_document_setting_put_credit_notes_setting",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettingFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Save Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSettingModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/setting/state-transition": {
      "get": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Get Transitions",
        "description": "Get Transitions\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_state_transition_get_credit_notes_setting_state_transition",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Transitions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransitionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/setting/state-transition/ledger-effects": {
      "get": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "List ledger effects for a document type",
        "description": "Returns the LedgerEffect enum variants available for this document type. Workflow forms should load the dropdown from this list rather than hardcoding values.\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "get_ledger_effect_options_get_credit_notes_setting_state_transition_ledger_effects",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Available ledger effects",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerEffectOptionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/setting/status/categorize": {
      "post": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Categorise the uncategorised Credit Note statuses",
        "description": "Gives every status the company defined itself (and that has no category yet) the chosen category: draft, open, settled or void. System statuses are never changed.\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "categorize_statuses_post_credit_notes_setting_status_categorize",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusCategorizeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "How many statuses were categorised",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusCategorizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/setting/status/{id}": {
      "put": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Update Status",
        "description": "Update Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_document_status_put_credit_notes_setting_status_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Workflow status identifier (`id` from this module's status settings).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Delete Status",
        "description": "Delete Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_status_delete_credit_notes_setting_status_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Workflow status identifier (`id` from this module's status settings).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/summary": {
      "get": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Summary of Credit Note",
        "description": "Per-status counts and base-currency totals (gross, balance, balance due soon) plus documents per record state, for the list's status strip. Takes the list's search filters but never status, recurring or paging. Reports every status and leaves grouping them to the caller.\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "summary_get_credit_notes_summary",
        "parameters": [
          {
            "name": "client",
            "in": "query",
            "description": "Client identifier (`id` of a client). Accepts a comma-separated list on document lists.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Exact document number.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Minimum total, as a decimal string: returns records whose total is greater than or equal to it.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact reference to match.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "issue_date",
            "in": "query",
            "description": "Issue date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with `INVALID_ISSUE_DATE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state (`0|active`, `1|archived`, `2|deleted`) the `statuses` are scoped to.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "due_soon_days",
            "in": "query",
            "description": "Window for `due_soon_balance_bcy`, in days (default 7, at most 90).",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Document summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSummaryResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/{id}": {
      "get": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Get Credit Note",
        "description": "Get Credit Note\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_document_by_anchor_get_credit_notes_id",
        "parameters": [
          {
            "name": "version",
            "in": "query",
            "description": "A `document_version_id` from the document's `version_history`, to read that earlier version. Omitted returns the current version.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get document detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentDetailResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Update Credit Note",
        "description": "Update Credit Note\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_credit_notes_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFormModel"
              },
              "example": {
                "currency": "USD",
                "document_issue_date": "2026-10-15",
                "document_number": "INV-1042",
                "items": [
                  {
                    "item_cost": "100.00",
                    "item_id": "00000000-0000-4000-8000-000000000005",
                    "item_quantity": "1"
                  }
                ],
                "people_id": "00000000-0000-4000-8000-000000000004"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update the document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/{id}/comment": {
      "get": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "List comment",
        "description": "List comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_comment_get_credit_notes_id_comment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Add comment",
        "description": "Add comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "add_comment_post_credit_notes_id_comment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentCommentFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/{id}/comment/{comment_id}": {
      "delete": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Delete comment",
        "description": "Delete comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_comment_delete_credit_notes_id_comment_comment_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "comment_id",
            "in": "path",
            "description": "Comment identifier (`id` from the document's comment list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentDeleteListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/{id}/dimensions": {
      "put": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Correct Credit Note line dimensions",
        "description": "Changes the dimension values of an issued document's lines and nothing else (amounts, accounts, taxes and dates cannot be sent). Each listed line gets exactly the values sent (an empty list clears it); lines not listed keep theirs. The document's current version is updated in place and its journal re-posted with the new resolved values. Send expected_version (the current version_number). Transaction Locking applies as for an edit: a hard lock refuses the call, a soft lock lets a user with the bypass permission through and is logged.\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "correct_dimensions_put_credit_notes_id_dimensions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DimensionCorrectionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Corrected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionCorrectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or lock error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Document not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, unknown line, or document not issued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/{id}/mail/send": {
      "post": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Send via Email",
        "description": "Send via Email\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:send, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "send_mail_post_credit_notes_id_mail_send",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentMailFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Send Email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMailFromResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:send",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/{id}/mail/{template_id}": {
      "get": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Get Mail Content",
        "description": "Get Mail Content\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_email_template_get_credit_notes_id_mail_template_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "template_id",
            "in": "path",
            "description": "Email template type to render for this document.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Mail Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplateTypeModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/{id}/meta-data": {
      "post": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Update meta data",
        "description": "Update meta data\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "meta_data_post_credit_notes_id_meta_data",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentMetaData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update meta data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/credit-notes/{id}/state-transition": {
      "put": {
        "tags": [
          "Credit Notes"
        ],
        "summary": "Status Transition",
        "description": "Status Transition\n\nThe API Gateway requires a bearer access token. Required permissions (any): credit-note:add, credit-note:edit, credit-note:list, credit-note:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "transition_to_put_credit_notes_id_state_transition",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransitionFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Status Transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/expenses": {
      "get": {
        "tags": [
          "Expenses"
        ],
        "summary": "List Expense",
        "description": "List Expense\n\nThe API Gateway requires a bearer access token. Required permissions (any): expense:add, expense:edit, expense:list, expense:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_expenses",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Minimum amount, as a decimal string. An unparseable value is ignored.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "client",
            "in": "query",
            "description": "Client the expense is billed to.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Exact expense status. Takes precedence over `tab`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact expense reference number.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "date",
            "in": "query",
            "description": "Expense date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with 400 `INVALID_DATE_RANGE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "is_billable",
            "in": "query",
            "description": "`true` for billable records only, `false` for non-billable only.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "recurring",
            "in": "query",
            "description": "`true` returns only recurring templates; `false` only one-off records. Omitted returns both.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "vendor",
            "in": "query",
            "description": "Vendor the expense was paid to.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "tab",
            "in": "query",
            "description": "Saved view when `status` is omitted: `pendingApproval` (submitted expenses; approvers only), `paid` (paid or settled), `all` (everything except drafts). Omitted returns the caller's own expenses.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "include_status",
            "in": "query",
            "description": "`true` adds per-status counts to the response.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List Expense",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseListResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Malformed `date` filter (`INVALID_DATE_RANGE`).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "expense:add",
            "expense:edit",
            "expense:list",
            "expense:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Expenses"
        ],
        "summary": "Create Expense",
        "description": "Create Expense\n\nThe API Gateway requires a bearer access token. Required permissions (any): expense:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_expenses",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseFormModel"
              },
              "example": {
                "currency": "USD",
                "exchange_rate": "1",
                "expense_date": "2026-10-15",
                "items": [
                  {
                    "amount": "25.00",
                    "description": "Printer paper",
                    "expense_account_id": "00000000-0000-4000-8000-000000000006",
                    "taxes": []
                  }
                ],
                "note": "Office supplies",
                "paid_account_id": "00000000-0000-4000-8000-000000000001"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Create Expense",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseDetailResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "expense:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Expenses"
        ],
        "summary": "Delete Expense",
        "description": "Delete Expense\n\nThe API Gateway requires a bearer access token. Required permissions (any): expense:delete, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_delete_expenses",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseDeleteFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Delete Expense",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseDeleteResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "expense:delete",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/expenses/state-transition": {
      "post": {
        "tags": [
          "Expenses"
        ],
        "summary": "Transition Expense Status",
        "description": "Moves one or more expenses to a new status. Allowed path is `draft` -> `submitted` -> `approved`; the ledger entry is posted when an expense is approved. Each expense is reported individually in `successful_updates` or `failed_updates`.\n\nThe API Gateway requires a bearer access token. Required permissions (any): expense:add, expense:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "transition_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransitionStatusFormModel"
              },
              "example": {
                "expense_ids": [
                  "00000000-0000-4000-8000-000000000009"
                ],
                "status": "submitted"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Per-expense transition outcome",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseStatusUpdateResult"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "expense:add",
            "expense:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/expenses/{id}": {
      "get": {
        "tags": [
          "Expenses"
        ],
        "summary": "Get Expense",
        "description": "Get Expense\n\nThe API Gateway requires a bearer access token. Required permissions (any): expense:add, expense:edit, expense:list, expense:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "detail_get_expenses_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Expense",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseDetailResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "expense:add",
            "expense:edit",
            "expense:list",
            "expense:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Expenses"
        ],
        "summary": "Update Expense",
        "description": "Update Expense\n\nThe API Gateway requires a bearer access token. Required permissions (any): expense:add, expense:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_expenses_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpenseFormModel"
              },
              "example": {
                "currency": "USD",
                "exchange_rate": "1",
                "expense_date": "2026-10-15",
                "items": [
                  {
                    "amount": "25.00",
                    "description": "Printer paper",
                    "expense_account_id": "00000000-0000-4000-8000-000000000006",
                    "taxes": []
                  }
                ],
                "note": "Office supplies",
                "paid_account_id": "00000000-0000-4000-8000-000000000001"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update Expense",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpenseDetailResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "expense:add",
            "expense:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/expenses/{id}/dimensions": {
      "put": {
        "tags": [
          "Expenses"
        ],
        "summary": "Correct Expense line dimensions",
        "description": "Changes the dimension values of an approved expense's lines and nothing else (amounts, accounts, taxes and dates cannot be sent). Each listed line gets exactly the values sent (an empty list clears it); lines not listed keep theirs. The expense's journal is re-posted with the new resolved values. Send expected_updated_at (the expense's updated_at as listed, null when never updated). Transaction Locking applies as for an edit: a hard lock refuses the call, a soft lock lets a user with the bypass permission through and is logged.\n\nThe API Gateway requires a bearer access token. Required permissions (any): expense:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "correct_dimensions_put_expenses_id_dimensions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DimensionCorrectionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Corrected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionCorrectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or lock error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Expense not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, unknown line, or expense not approved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "expense:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "List Invoices",
        "description": "List Invoices\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_invoices",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "client",
            "in": "query",
            "description": "Client identifier (`id` of a client). Accepts a comma-separated list on document lists.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Comma-separated status keys from this module's status settings; any of them matches.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Exact document number.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Minimum total, as a decimal string: returns records whose total is greater than or equal to it.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact reference to match.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "issue_date",
            "in": "query",
            "description": "Issue date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with `INVALID_ISSUE_DATE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state, comma-separated: `active`, `archived`, `deleted` (or `0`, `1`, `2`). Omitted means active only.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Records per page, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "recurring",
            "in": "query",
            "description": "`true` returns only recurring templates; `false` only one-off records. Omitted returns both.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "past_due",
            "in": "query",
            "description": "Only documents whose due date has passed (the list's overdue view for modules whose workflow\nhas no `overdue` status, such as bills). Combine with `status` for the open statuses.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of documents",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentListResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Create Invoice",
        "description": "Create Invoice\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_invoices",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFormModel"
              },
              "example": {
                "currency": "USD",
                "document_issue_date": "2026-10-15",
                "document_number": "INV-1042",
                "items": [
                  {
                    "item_cost": "100.00",
                    "item_id": "00000000-0000-4000-8000-000000000005",
                    "item_quantity": "1"
                  }
                ],
                "people_id": "00000000-0000-4000-8000-000000000004"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Create a new document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/setting/status": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get All Status",
        "description": "Get All Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:view, invoice:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_all_status_get_invoices_setting_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get All Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusListModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:view",
            "invoice:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Add New Status",
        "description": "Add New Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "document_status_post_invoices_setting_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add New Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/attribute": {
      "put": {
        "tags": [
          "Invoices"
        ],
        "summary": "Bulk Update Attributes",
        "description": "Bulk Update Attributes\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "attr_update_put_invoices_attribute",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentAttrFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bulk update attributes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentAttrFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/payments/bulk": {
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Record full payments for selected Invoice documents",
        "description": "Record full payments for selected Invoice documents\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:payment, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "bulk_full_payment",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkFullPaymentFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Record bulk payments",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkFullPaymentResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 20 requests per minute per client (bursts up to 25). The response has no body and no `Retry-After` header; wait 3 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:payment",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/setting": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get Settings",
        "description": "Get Settings\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:list, invoice:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_document_setting_get_invoices_setting",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSettingModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Invoices"
        ],
        "summary": "Save Settings",
        "description": "Save Settings\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:list, invoice:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "save_document_setting_put_invoices_setting",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettingFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Save Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSettingModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/setting/state-transition": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get Transitions",
        "description": "Get Transitions\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:list, invoice:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_state_transition_get_invoices_setting_state_transition",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Transitions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransitionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/setting/state-transition/ledger-effects": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "List ledger effects for a document type",
        "description": "Returns the LedgerEffect enum variants available for this document type. Workflow forms should load the dropdown from this list rather than hardcoding values.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:list, invoice:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "get_ledger_effect_options_get_invoices_setting_state_transition_ledger_effects",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Available ledger effects",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerEffectOptionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/setting/status/categorize": {
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Categorise the uncategorised Invoice statuses",
        "description": "Gives every status the company defined itself (and that has no category yet) the chosen category: draft, open, settled or void. System statuses are never changed.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "categorize_statuses_post_invoices_setting_status_categorize",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusCategorizeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "How many statuses were categorised",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusCategorizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/setting/status/{id}": {
      "put": {
        "tags": [
          "Invoices"
        ],
        "summary": "Update Status",
        "description": "Update Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_document_status_put_invoices_setting_status_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Workflow status identifier (`id` from this module's status settings).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Invoices"
        ],
        "summary": "Delete Status",
        "description": "Delete Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_status_delete_invoices_setting_status_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Workflow status identifier (`id` from this module's status settings).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/state-transition/bulk": {
      "put": {
        "tags": [
          "Invoices"
        ],
        "summary": "Bulk transition documents",
        "description": "Bulk transition documents\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "bulk_transition_to",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkTransitionFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bulk transition documents",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkTransitionResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/summary": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Summary of Invoice",
        "description": "Per-status counts and base-currency totals (gross, balance, balance due soon) plus documents per record state, for the list's status strip. Takes the list's search filters but never status, recurring or paging. Reports every status and leaves grouping them to the caller.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "summary_get_invoices_summary",
        "parameters": [
          {
            "name": "client",
            "in": "query",
            "description": "Client identifier (`id` of a client). Accepts a comma-separated list on document lists.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Exact document number.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Minimum total, as a decimal string: returns records whose total is greater than or equal to it.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact reference to match.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "issue_date",
            "in": "query",
            "description": "Issue date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with `INVALID_ISSUE_DATE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state (`0|active`, `1|archived`, `2|deleted`) the `statuses` are scoped to.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "due_soon_days",
            "in": "query",
            "description": "Window for `due_soon_balance_bcy`, in days (default 7, at most 90).",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Document summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSummaryResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/{id}": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get Invoice",
        "description": "Get Invoice\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:list, invoice:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_document_by_anchor_get_invoices_id",
        "parameters": [
          {
            "name": "version",
            "in": "query",
            "description": "A `document_version_id` from the document's `version_history`, to read that earlier version. Omitted returns the current version.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get document detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentDetailResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Invoices"
        ],
        "summary": "Update Invoice",
        "description": "Update Invoice\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_invoices_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFormModel"
              },
              "example": {
                "currency": "USD",
                "document_issue_date": "2026-10-15",
                "document_number": "INV-1042",
                "items": [
                  {
                    "item_cost": "100.00",
                    "item_id": "00000000-0000-4000-8000-000000000005",
                    "item_quantity": "1"
                  }
                ],
                "people_id": "00000000-0000-4000-8000-000000000004"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update the document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/{id}/comment": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "List comment",
        "description": "List comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_comment_get_invoices_id_comment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Add comment",
        "description": "Add comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "add_comment_post_invoices_id_comment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentCommentFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/{id}/comment/{comment_id}": {
      "delete": {
        "tags": [
          "Invoices"
        ],
        "summary": "Delete comment",
        "description": "Delete comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_comment_delete_invoices_id_comment_comment_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "comment_id",
            "in": "path",
            "description": "Comment identifier (`id` from the document's comment list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentDeleteListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/{id}/credits": {
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Apply credit",
        "description": "Apply credit\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:payment, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "apply_credit",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApplyCreditFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Apply credit",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApplyCreditFromResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 20 requests per minute per client (bursts up to 25). The response has no body and no `Retry-After` header; wait 3 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:payment",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/{id}/dimensions": {
      "put": {
        "tags": [
          "Invoices"
        ],
        "summary": "Correct Invoice line dimensions",
        "description": "Changes the dimension values of an issued document's lines and nothing else (amounts, accounts, taxes and dates cannot be sent). Each listed line gets exactly the values sent (an empty list clears it); lines not listed keep theirs. The document's current version is updated in place and its journal re-posted with the new resolved values. Send expected_version (the current version_number). Transaction Locking applies as for an edit: a hard lock refuses the call, a soft lock lets a user with the bypass permission through and is logged.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "correct_dimensions_put_invoices_id_dimensions",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DimensionCorrectionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Corrected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DimensionCorrectionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or lock error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "Document not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "409": {
            "description": "Version conflict, unknown line, or document not issued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/{id}/mail/send": {
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Send via Email",
        "description": "Send via Email\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:send, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "send_mail_post_invoices_id_mail_send",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentMailFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Send Email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMailFromResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:send",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/{id}/mail/{template_id}": {
      "get": {
        "tags": [
          "Invoices"
        ],
        "summary": "Get Mail Content",
        "description": "Get Mail Content\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:send, invoice:edit, invoice:list, invoice:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_email_template_get_invoices_id_mail_template_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "template_id",
            "in": "path",
            "description": "Email template type to render for this document.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Mail Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplateTypeModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:send",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/{id}/meta-data": {
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Update meta data",
        "description": "Update meta data\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "meta_data_post_invoices_id_meta_data",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentMetaData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update meta data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/{id}/payment": {
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Add Invoice Payment",
        "description": "Payment and required settlement/FX effects commit together. Optional Idempotency-Key (1–128 characters) is company-scoped: identical retries return the recorded payment, including its reversal state; changed details return 409. Without a key each request is a new payment. References remain free-form.\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:payment, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "save_payment_post_invoices_id_payment",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "description": "Stable client request identity; reuse only for identical retries",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentFromModel"
              },
              "example": {
                "deposit_account": "00000000-0000-4000-8000-000000000001",
                "payment_amount": "100.00",
                "payment_date": "2026-10-15",
                "payment_mode": "bank_transfer",
                "reference_number": "TRANSFER-1042"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add payment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentFromResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 20 requests per minute per client (bursts up to 25). The response has no body and no `Retry-After` header; wait 3 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:payment",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/{id}/payment/{payment_id}": {
      "delete": {
        "tags": [
          "Invoices"
        ],
        "summary": "Delete Invoice Payment",
        "description": "Delete Invoice Payment\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:payment, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_payment_delete_invoices_id_payment_payment_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "payment_id",
            "in": "path",
            "description": "Payment identifier (`id` of the payment recorded against this document).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete payment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentFromResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 20 requests per minute per client (bursts up to 25). The response has no body and no `Retry-After` header; wait 3 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:payment",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/invoices/{id}/state-transition": {
      "put": {
        "tags": [
          "Invoices"
        ],
        "summary": "Status Transition",
        "description": "Status Transition\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "transition_to_put_invoices_id_state_transition",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransitionFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Status Transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/items": {
      "get": {
        "tags": [
          "Items"
        ],
        "summary": "List Item",
        "description": "List Item\n\nThe API Gateway requires a bearer access token. Required permissions (any): item:add, item:edit, item:list, invoice:add, invoice:edit, invoice:list, estimate:add, estimate:edit, estimate:list, credit-note:add, credit-note:edit, credit-note:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_items",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Records per page, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "name",
            "in": "query",
            "description": "Case-insensitive partial match on the name.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "description",
            "in": "query",
            "description": "Partial match (case-sensitive) on the sales or purchase description.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "sku",
            "in": "query",
            "description": "Case-insensitive exact SKU.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "item_unit",
            "in": "query",
            "description": "Case-insensitive exact unit, for example `PCS`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "item_type",
            "in": "query",
            "description": "Case-insensitive exact item type: `goods` or `service`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "deleted",
            "in": "query",
            "description": "`true` returns only deleted records; omitted or `false` returns records that are not deleted.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of items",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemListResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "item:add",
            "item:edit",
            "item:list",
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "estimate:add",
            "estimate:edit",
            "estimate:list",
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Items"
        ],
        "summary": "Add Item",
        "description": "Add Item\n\nThe API Gateway requires a bearer access token. Required permissions (any): item:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_items",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ItemFormModel"
              },
              "example": {
                "has_purchase_price": false,
                "has_sales_price": false,
                "item_name": "Consulting hour",
                "item_type": "service",
                "purchase_currency": "USD",
                "sales_currency": "USD",
                "sku": "CONSULTING-HOUR"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add Item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "item:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/items/dimension-defaults/lookup": {
      "post": {
        "tags": [
          "Items"
        ],
        "summary": "Look up item default dimensions",
        "description": "Batch read of the default dimension values saved on up to 100 items, so a screen that needs many items' defaults (Dimension Assignment) makes one call instead of reading each item's detail. A read sent as POST because the ids do not fit a query string. One entry per requested id, in request order; an item with none (or an id that is not this tenant's item) has an empty state. The items list is empty while Dimensions is not activated, like the item detail.\n\nThe API Gateway requires a bearer access token. Required permissions (any): item:add, item:edit, item:list, item:view, invoice:add, invoice:edit, invoice:list, estimate:add, estimate:edit, estimate:list, credit-note:add, credit-note:edit, credit-note:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "dimension_defaults_lookup_post_items_dimension_defaults_lookup",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DefaultsLookupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Defaults per item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DefaultsLookupResponse"
                }
              }
            }
          },
          "400": {
            "description": "Empty list, more than 100 ids, or a blank id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "item:add",
            "item:edit",
            "item:list",
            "item:view",
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "estimate:add",
            "estimate:edit",
            "estimate:list",
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/items/get-all": {
      "get": {
        "tags": [
          "Items"
        ],
        "summary": "List All Items",
        "description": "List All Items\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:list, estimate:add, estimate:edit, estimate:list, credit-note:add, credit-note:edit, credit-note:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_all_items",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of items",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemDirectoryResponse"
                },
                "example": {
                  "data": {
                    "00000000-0000-4000-8000-000000000002": {
                      "barcode": null,
                      "company_id": "00000000-0000-4000-8000-000000000004",
                      "cost_for_client": null,
                      "created_at": "2026-10-23T08:00:00",
                      "deleted_at": null,
                      "external_id": null,
                      "external_source": null,
                      "has_purchase_price": false,
                      "has_sales_price": true,
                      "id": "00000000-0000-4000-8000-000000000002",
                      "is_active": true,
                      "item_attribute": null,
                      "item_cost": "100.000000",
                      "item_description": "Consulting services",
                      "item_name": "Consulting hour",
                      "item_quantity": "1",
                      "item_tax": null,
                      "item_type": "service",
                      "item_unit": "hour",
                      "pricing": null,
                      "purchase_account_id": null,
                      "purchase_currency": "USD",
                      "purchase_description": null,
                      "purchase_price": "0",
                      "purchase_tax_ids": [],
                      "sales_account_id": null,
                      "sales_currency": "USD",
                      "sales_description": "Consulting services",
                      "sales_price": "100",
                      "sales_tax_ids": [],
                      "sku": "CONSULTING-HOUR",
                      "updated_at": null,
                      "user_id": "00000000-0000-4000-8000-000000000003"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "estimate:add",
            "estimate:edit",
            "estimate:list",
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/items/{id}": {
      "get": {
        "tags": [
          "Items"
        ],
        "summary": "Get Item",
        "description": "Get Item\n\nThe API Gateway requires a bearer access token. Required permissions (any): item:add, item:edit, item:list, item:view, invoice:add, invoice:edit, invoice:list, estimate:add, estimate:edit, estimate:list, credit-note:add, credit-note:edit, credit-note:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "detail_get_items_id",
        "parameters": [
          {
            "name": "currency",
            "in": "query",
            "description": "Document currency the price is returned in. Omitted uses the item's sales currency.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "document_type",
            "in": "query",
            "description": "Document the price is for: `invoice`, `quote` or `credit-note` use the item's sales price and account; `bill` or `purchase-order` use its purchase price and account.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "fx_rate",
            "in": "query",
            "description": "Manual exchange rate, `1 <document currency> = <fx_rate> <company base currency>`. Omitted uses the company FX rate for `fx_date`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "unit_price",
            "in": "query",
            "description": "Line price already entered, in the document currency. Used instead of the item's default price when non-zero (or when editing an existing line).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "document_item_id",
            "in": "query",
            "description": "Existing document line being edited, so its entered price is kept.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "banking_account_id",
            "in": "query",
            "description": "Account to post the line to, overriding the item's default sales or purchase account.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "fx_date",
            "in": "query",
            "description": "Document date (`YYYY-MM-DD`, company-local) used to pick a company custom\nFX window when an item's default price must be converted. Defaults to today.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Item detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemDetailResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed `fx_date` (`INVALID_EFFECTIVE_DATE`).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "item:add",
            "item:edit",
            "item:list",
            "item:view",
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "estimate:add",
            "estimate:edit",
            "estimate:list",
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Items"
        ],
        "summary": "Update Item",
        "description": "Update Item\n\nThe API Gateway requires a bearer access token. Required permissions (any): item:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_items_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Item identifier (`id` from the item list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ItemFormModel"
              },
              "example": {
                "has_purchase_price": false,
                "has_sales_price": false,
                "item_name": "Consulting hour",
                "item_type": "service",
                "purchase_currency": "USD",
                "sales_currency": "USD",
                "sku": "CONSULTING-HOUR"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update Item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "item:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Items"
        ],
        "summary": "Delete Item",
        "description": "Delete Item\n\nThe API Gateway requires a bearer access token. Required permissions (any): item:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "delete_delete_items_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Item identifier (`id` from the item list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete Item",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ItemDeleteResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "item:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/late-fee": {
      "get": {
        "tags": [
          "Late Fees"
        ],
        "summary": "List Late Fees",
        "description": "Returns the paginated late fee rules configured for the specified company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): late-fee:add, late-fee:edit, late-fee:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_doc_get_late_fee",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Late fee list retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LateFeeListResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "late-fee:add",
            "late-fee:edit",
            "late-fee:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Late Fees"
        ],
        "summary": "Create Late Fee",
        "description": "Creates a new late fee rule for the specified company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): late-fee:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_doc_post_late_fee",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LateFeeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Late fee created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LateFeeFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "late-fee:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/late-fee/get-all": {
      "get": {
        "tags": [
          "Late Fees"
        ],
        "summary": "Get All Late Fees",
        "description": "Returns all late fee rules for the specified company without pagination.\n\nThe API Gateway requires a bearer access token. Required permissions (any): late-fee:add, late-fee:edit, late-fee:list, invoice:add, invoice:edit, invoice:list, invoice:view, estimate:add, estimate:edit, estimate:list, credit-note:add, credit-note:edit, credit-note:list, client:add, client:edit, client:list, client:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_all_late_fees_doc",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "All late fees retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LateFeeDbListResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "late-fee:add",
            "late-fee:edit",
            "late-fee:list",
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "estimate:add",
            "estimate:edit",
            "estimate:list",
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "client:add",
            "client:edit",
            "client:list",
            "client:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/late-fee/{id}": {
      "get": {
        "tags": [
          "Late Fees"
        ],
        "summary": "Get Late Fee",
        "description": "Retrieves a single late fee rule by its identifier.\n\nThe API Gateway requires a bearer access token. Required permissions (any): late-fee:add, late-fee:edit, late-fee:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "detail_doc_get_late_fee_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Late fee id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Late fee detail retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LateFeeDetailResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "late-fee:add",
            "late-fee:edit",
            "late-fee:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Late Fees"
        ],
        "summary": "Update Late Fee",
        "description": "Updates an existing late fee rule by its identifier.\n\nThe API Gateway requires a bearer access token. Required permissions (any): late-fee:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_doc_put_late_fee_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Late fee id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LateFeeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Late fee updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LateFeeFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "late-fee:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/projects": {
      "get": {
        "tags": [
          "Projects & Timesheets"
        ],
        "summary": "List Projects",
        "description": "Returns the paginated projects visible to the authenticated company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): project:add, project:edit, project:list, project:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_doc_get_projects",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "description": "Project manager's user identifier.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code of the project.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "client",
            "in": "query",
            "description": "Client the project is for.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Exact project status.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact project reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "due_date",
            "in": "query",
            "description": "Due date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with 400 `INVALID_DATE_RANGE`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Project list retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectListResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Malformed `due_date` filter (`INVALID_DATE_RANGE`).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "project:add",
            "project:edit",
            "project:list",
            "project:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Projects & Timesheets"
        ],
        "summary": "Create Project",
        "description": "Creates a new project for the authenticated company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): project:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_doc_post_projects",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Project created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "project:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/projects/tasks": {
      "get": {
        "tags": [
          "Projects & Timesheets"
        ],
        "summary": "List Project Tasks",
        "description": "Returns the paginated project task catalog for the authenticated company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): project:add, project:edit, project:list, project:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_doc_get_projects_tasks",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Records per page, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "task",
            "in": "query",
            "description": "Prefix of the task title.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Task list retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskListResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "project:add",
            "project:edit",
            "project:list",
            "project:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Projects & Timesheets"
        ],
        "summary": "Create Project Task",
        "description": "Creates a reusable project task for the authenticated company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): project:add, project:edit, project:view, project:list, project:task-add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_doc_post_projects_tasks",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Task created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "project:add",
            "project:edit",
            "project:view",
            "project:list",
            "project:task-add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/projects/tasks/{id}": {
      "put": {
        "tags": [
          "Projects & Timesheets"
        ],
        "summary": "Update Project Task",
        "description": "Updates an existing project task for the authenticated company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): project:add, project:edit, project:view, project:list, project:task-add, project:task-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_doc_put_projects_tasks_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Task id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaskFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Task updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaskFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "project:add",
            "project:edit",
            "project:view",
            "project:list",
            "project:task-add",
            "project:task-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/projects/timesheet-for-invoice": {
      "get": {
        "tags": [
          "Projects & Timesheets"
        ],
        "summary": "List Invoice Timesheets",
        "description": "Returns grouped unbilled timesheet data for building a project invoice.\n\nThe API Gateway requires a bearer access token. Required permissions (any): project:add, project:edit, project:list, project:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "timesheet_invoice_list_doc",
        "parameters": [
          {
            "name": "project_id",
            "in": "query",
            "description": "Project to bill. Required.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "date",
            "in": "query",
            "description": "Timesheet date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with 400 `INVALID_DATE_RANGE`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "group_by",
            "in": "query",
            "description": "How to group unbilled time for the invoice: `task` (default), `project` or `timesheet`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Invoice-ready timesheets retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimesheetInvoiceResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Missing `project_id` (`REQUIRED_FIELD`) or malformed `date` filter (`INVALID_DATE_RANGE`).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "project:add",
            "project:edit",
            "project:list",
            "project:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/projects/timesheets": {
      "get": {
        "tags": [
          "Projects & Timesheets"
        ],
        "summary": "List Timesheets",
        "description": "Returns the paginated project timesheets visible to the authenticated company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): project:add, project:edit, project:list, project:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "timesheet_list_doc",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Records per page, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "project_id",
            "in": "query",
            "description": "Project identifier (`id` from the project list).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "description": "Only time logged by this user.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Exact timesheet status, for example `unbilled`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "date",
            "in": "query",
            "description": "Timesheet date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with 400 `INVALID_DATE_RANGE`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_billable",
            "in": "query",
            "description": "`true` for billable records only, `false` for non-billable only.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "task",
            "in": "query",
            "description": "Comma-separated task identifiers.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Timesheet list retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimesheetListResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Malformed `date` filter (`INVALID_DATE_RANGE`).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "project:add",
            "project:edit",
            "project:list",
            "project:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Projects & Timesheets"
        ],
        "summary": "Create Time Entry",
        "description": "Creates a project time entry for the authenticated company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): project:add, project:edit, project:view, project:list, project:timesheet-add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_time_entry_doc",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TimesheetFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Time entry created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimesheetFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "project:add",
            "project:edit",
            "project:view",
            "project:list",
            "project:timesheet-add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/projects/{id}": {
      "get": {
        "tags": [
          "Projects & Timesheets"
        ],
        "summary": "Get Project",
        "description": "Retrieves a single project with task, staff, and attachment details.\n\nThe API Gateway requires a bearer access token. Required permissions (any): project:add, project:edit, project:list, project:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "detail_doc_get_projects_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Project id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Project detail retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectDetailResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "project:add",
            "project:edit",
            "project:list",
            "project:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Projects & Timesheets"
        ],
        "summary": "Update Project",
        "description": "Updates an existing project for the authenticated company.\n\nThe API Gateway requires a bearer access token. Required permissions (any): project:add, project:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_doc_put_projects_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Project id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProjectFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Project updated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "project:add",
            "project:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders": {
      "get": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "List Purchase Orders",
        "description": "List Purchase Orders\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, purchase-order:list, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_purchase_orders",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "vendor",
            "in": "query",
            "description": "Vendor identifier (`id` of a vendor). Accepts a comma-separated list on document lists.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Comma-separated status keys from this module's status settings; any of them matches.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Exact document number.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Minimum total, as a decimal string: returns records whose total is greater than or equal to it.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact reference to match.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "issue_date",
            "in": "query",
            "description": "Issue date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with `INVALID_ISSUE_DATE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state, comma-separated: `active`, `archived`, `deleted` (or `0`, `1`, `2`). Omitted means active only.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Records per page, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "recurring",
            "in": "query",
            "description": "`true` returns only recurring templates; `false` only one-off records. Omitted returns both.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "past_due",
            "in": "query",
            "description": "Only documents whose due date has passed (the list's overdue view for modules whose workflow\nhas no `overdue` status, such as bills). Combine with `status` for the open statuses.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of documents",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentListResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:list",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Create Purchase Order",
        "description": "Create Purchase Order\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_purchase_orders",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFormModel"
              },
              "example": {
                "currency": "USD",
                "document_issue_date": "2026-10-15",
                "document_number": "INV-1042",
                "items": [
                  {
                    "item_cost": "100.00",
                    "item_id": "00000000-0000-4000-8000-000000000005",
                    "item_quantity": "1"
                  }
                ],
                "people_id": "00000000-0000-4000-8000-000000000004"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Create a new document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/setting/status": {
      "get": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Get All Status",
        "description": "Get All Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, purchase-order:view, purchase-order:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_all_status_get_purchase_orders_setting_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get All Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusListModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:view",
            "purchase-order:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Add New Status",
        "description": "Add New Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "document_status_post_purchase_orders_setting_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add New Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/attribute": {
      "put": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Bulk Update Attributes",
        "description": "Bulk Update Attributes\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "attr_update_put_purchase_orders_attribute",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentAttrFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bulk update attributes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentAttrFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/setting": {
      "get": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Get Settings",
        "description": "Get Settings\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, purchase-order:list, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_document_setting_get_purchase_orders_setting",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSettingModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:list",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Save Settings",
        "description": "Save Settings\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, purchase-order:list, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "save_document_setting_put_purchase_orders_setting",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettingFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Save Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSettingModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:list",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/setting/state-transition": {
      "get": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Get Transitions",
        "description": "Get Transitions\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, purchase-order:list, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_state_transition_get_purchase_orders_setting_state_transition",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Transitions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransitionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:list",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/setting/state-transition/ledger-effects": {
      "get": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "List ledger effects for a document type",
        "description": "Returns the LedgerEffect enum variants available for this document type. Workflow forms should load the dropdown from this list rather than hardcoding values.\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, purchase-order:list, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "get_ledger_effect_options_get_purchase_orders_setting_state_transition_ledger_effects",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Available ledger effects",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerEffectOptionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:list",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/setting/status/categorize": {
      "post": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Categorise the uncategorised Purchase Order statuses",
        "description": "Gives every status the company defined itself (and that has no category yet) the chosen category: draft, open, settled or void. System statuses are never changed.\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "categorize_statuses_post_purchase_orders_setting_status_categorize",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusCategorizeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "How many statuses were categorised",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusCategorizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/setting/status/{id}": {
      "put": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Update Status",
        "description": "Update Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_document_status_put_purchase_orders_setting_status_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Workflow status identifier (`id` from this module's status settings).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Delete Status",
        "description": "Delete Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_status_delete_purchase_orders_setting_status_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Workflow status identifier (`id` from this module's status settings).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/summary": {
      "get": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Summary of Purchase Order",
        "description": "Per-status counts and base-currency totals (gross, balance, balance due soon) plus documents per record state, for the list's status strip. Takes the list's search filters but never status, recurring or paging. Reports every status and leaves grouping them to the caller.\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, purchase-order:list, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "summary_get_purchase_orders_summary",
        "parameters": [
          {
            "name": "vendor",
            "in": "query",
            "description": "Vendor identifier (`id` of a vendor). Accepts a comma-separated list on document lists.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Exact document number.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Minimum total, as a decimal string: returns records whose total is greater than or equal to it.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact reference to match.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "issue_date",
            "in": "query",
            "description": "Issue date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with `INVALID_ISSUE_DATE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state (`0|active`, `1|archived`, `2|deleted`) the `statuses` are scoped to.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "due_soon_days",
            "in": "query",
            "description": "Window for `due_soon_balance_bcy`, in days (default 7, at most 90).",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Document summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSummaryResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:list",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/{id}": {
      "get": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Get Purchase Order",
        "description": "Get Purchase Order\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, purchase-order:list, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_document_by_anchor_get_purchase_orders_id",
        "parameters": [
          {
            "name": "version",
            "in": "query",
            "description": "A `document_version_id` from the document's `version_history`, to read that earlier version. Omitted returns the current version.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get document detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentDetailResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:list",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Update Purchase Order",
        "description": "Update Purchase Order\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_purchase_orders_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFormModel"
              },
              "example": {
                "currency": "USD",
                "document_issue_date": "2026-10-15",
                "document_number": "INV-1042",
                "items": [
                  {
                    "item_cost": "100.00",
                    "item_id": "00000000-0000-4000-8000-000000000005",
                    "item_quantity": "1"
                  }
                ],
                "people_id": "00000000-0000-4000-8000-000000000004"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update the document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/{id}/comment": {
      "get": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "List comment",
        "description": "List comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_comment_get_purchase_orders_id_comment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Add comment",
        "description": "Add comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "add_comment_post_purchase_orders_id_comment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentCommentFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/{id}/comment/{comment_id}": {
      "delete": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Delete comment",
        "description": "Delete comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_comment_delete_purchase_orders_id_comment_comment_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "comment_id",
            "in": "path",
            "description": "Comment identifier (`id` from the document's comment list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentDeleteListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/{id}/mail/send": {
      "post": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Send via Email",
        "description": "Send via Email\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:send, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "send_mail_post_purchase_orders_id_mail_send",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentMailFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Send Email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMailFromResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:send",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/{id}/mail/{template_id}": {
      "get": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Get Mail Content",
        "description": "Get Mail Content\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:send, purchase-order:edit, purchase-order:list, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_email_template_get_purchase_orders_id_mail_template_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "template_id",
            "in": "path",
            "description": "Email template type to render for this document.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Mail Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplateTypeModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:send",
            "purchase-order:edit",
            "purchase-order:list",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/{id}/meta-data": {
      "post": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Update meta data",
        "description": "Update meta data\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "meta_data_post_purchase_orders_id_meta_data",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentMetaData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update meta data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/purchase-orders/{id}/state-transition": {
      "put": {
        "tags": [
          "Purchase Orders"
        ],
        "summary": "Status Transition",
        "description": "Status Transition\n\nThe API Gateway requires a bearer access token. Required permissions (any): purchase-order:add, purchase-order:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "transition_to_put_purchase_orders_id_state_transition",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransitionFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Status Transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "purchase-order:add",
            "purchase-order:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes": {
      "get": {
        "tags": [
          "Quotes"
        ],
        "summary": "List Quotes",
        "description": "List Quotes\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_quotes",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "client",
            "in": "query",
            "description": "Client identifier (`id` of a client). Accepts a comma-separated list on document lists.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Comma-separated status keys from this module's status settings; any of them matches.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Exact document number.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Minimum total, as a decimal string: returns records whose total is greater than or equal to it.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact reference to match.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "issue_date",
            "in": "query",
            "description": "Issue date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with `INVALID_ISSUE_DATE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state, comma-separated: `active`, `archived`, `deleted` (or `0`, `1`, `2`). Omitted means active only.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "past_due",
            "in": "query",
            "description": "Only documents whose due date has passed (the list's overdue view for modules whose workflow\nhas no `overdue` status, such as bills). Combine with `status` for the open statuses.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of documents",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentListResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Quotes"
        ],
        "summary": "Create Quote",
        "description": "Create Quote\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_quotes",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFormModel"
              },
              "example": {
                "currency": "USD",
                "document_issue_date": "2026-10-15",
                "document_number": "INV-1042",
                "items": [
                  {
                    "item_cost": "100.00",
                    "item_id": "00000000-0000-4000-8000-000000000005",
                    "item_quantity": "1"
                  }
                ],
                "people_id": "00000000-0000-4000-8000-000000000004"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Create a new document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/setting/status": {
      "get": {
        "tags": [
          "Quotes"
        ],
        "summary": "Get All Status",
        "description": "Get All Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_all_status_get_quotes_setting_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get All Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusListModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Quotes"
        ],
        "summary": "Add New Status",
        "description": "Add New Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "document_status_post_quotes_setting_status",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add New Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/attribute": {
      "put": {
        "tags": [
          "Quotes"
        ],
        "summary": "Bulk Update Attributes",
        "description": "Bulk Update Attributes\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "attr_update_put_quotes_attribute",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentAttrFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Bulk update attributes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentAttrFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/setting": {
      "get": {
        "tags": [
          "Quotes"
        ],
        "summary": "Get Settings",
        "description": "Get Settings\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_document_setting_get_quotes_setting",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSettingModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Quotes"
        ],
        "summary": "Save Settings",
        "description": "Save Settings\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "save_document_setting_put_quotes_setting",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettingFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Save Settings",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSettingModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/setting/state-transition": {
      "get": {
        "tags": [
          "Quotes"
        ],
        "summary": "Get Transitions",
        "description": "Get Transitions\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_state_transition_get_quotes_setting_state_transition",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Transitions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TransitionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/setting/state-transition/ledger-effects": {
      "get": {
        "tags": [
          "Quotes"
        ],
        "summary": "List ledger effects for a document type",
        "description": "Returns the LedgerEffect enum variants available for this document type. Workflow forms should load the dropdown from this list rather than hardcoding values.\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "get_ledger_effect_options_get_quotes_setting_state_transition_ledger_effects",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Available ledger effects",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerEffectOptionListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/setting/status/categorize": {
      "post": {
        "tags": [
          "Quotes"
        ],
        "summary": "Categorise the uncategorised Quote statuses",
        "description": "Gives every status the company defined itself (and that has no category yet) the chosen category: draft, open, settled or void. System statuses are never changed.\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "categorize_statuses_post_quotes_setting_status_categorize",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusCategorizeFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "How many statuses were categorised",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusCategorizeResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/setting/status/{id}": {
      "put": {
        "tags": [
          "Quotes"
        ],
        "summary": "Update Status",
        "description": "Update Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_document_status_put_quotes_setting_status_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Workflow status identifier (`id` from this module's status settings).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatusFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Quotes"
        ],
        "summary": "Delete Status",
        "description": "Delete Status\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_status_delete_quotes_setting_status_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Workflow status identifier (`id` from this module's status settings).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete Status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusFormResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/summary": {
      "get": {
        "tags": [
          "Quotes"
        ],
        "summary": "Summary of Quote",
        "description": "Per-status counts and base-currency totals (gross, balance, balance due soon) plus documents per record state, for the list's status strip. Takes the list's search filters but never status, recurring or paging. Reports every status and leaves grouping them to the caller.\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "summary_get_quotes_summary",
        "parameters": [
          {
            "name": "client",
            "in": "query",
            "description": "Client identifier (`id` of a client). Accepts a comma-separated list on document lists.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "number",
            "in": "query",
            "description": "Exact document number.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Minimum total, as a decimal string: returns records whose total is greater than or equal to it.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "reference",
            "in": "query",
            "description": "Exact reference to match.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "issue_date",
            "in": "query",
            "description": "Issue date range `YYYY-MM-DD,YYYY-MM-DD`, both ends inclusive. Any other format is rejected with `INVALID_ISSUE_DATE`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Record state (`0|active`, `1|archived`, `2|deleted`) the `statuses` are scoped to.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "due_soon_days",
            "in": "query",
            "description": "Window for `due_soon_balance_bcy`, in days (default 7, at most 90).",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Document summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentSummaryResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/{id}": {
      "get": {
        "tags": [
          "Quotes"
        ],
        "summary": "Get Quote",
        "description": "Get Quote\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_document_by_anchor_get_quotes_id",
        "parameters": [
          {
            "name": "version",
            "in": "query",
            "description": "A `document_version_id` from the document's `version_history`, to read that earlier version. Omitted returns the current version.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get document detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentDetailResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Quotes"
        ],
        "summary": "Update Quote",
        "description": "Update Quote\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_quotes_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentFormModel"
              },
              "example": {
                "currency": "USD",
                "document_issue_date": "2026-10-15",
                "document_number": "INV-1042",
                "items": [
                  {
                    "item_cost": "100.00",
                    "item_id": "00000000-0000-4000-8000-000000000005",
                    "item_quantity": "1"
                  }
                ],
                "people_id": "00000000-0000-4000-8000-000000000004"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update the document",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/{id}/comment": {
      "get": {
        "tags": [
          "Quotes"
        ],
        "summary": "List comment",
        "description": "List comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_comment_get_quotes_id_comment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Quotes"
        ],
        "summary": "Add comment",
        "description": "Add comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "add_comment_post_quotes_id_comment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentCommentFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Add comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/{id}/comment/{comment_id}": {
      "delete": {
        "tags": [
          "Quotes"
        ],
        "summary": "Delete comment",
        "description": "Delete comment\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_comment_delete_quotes_id_comment_comment_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "comment_id",
            "in": "path",
            "description": "Comment identifier (`id` from the document's comment list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentCommentDeleteListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/{id}/mail/send": {
      "post": {
        "tags": [
          "Quotes"
        ],
        "summary": "Send via Email",
        "description": "Send via Email\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:send, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "send_mail_post_quotes_id_mail_send",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentMailFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Send Email",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMailFromResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:send",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/{id}/mail/{template_id}": {
      "get": {
        "tags": [
          "Quotes"
        ],
        "summary": "Get Mail Content",
        "description": "Get Mail Content\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_email_template_get_quotes_id_mail_template_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "template_id",
            "in": "path",
            "description": "Email template type to render for this document.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get Mail Content",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailTemplateTypeModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/{id}/meta-data": {
      "post": {
        "tags": [
          "Quotes"
        ],
        "summary": "Update meta data",
        "description": "Update meta data\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "meta_data_post_quotes_id_meta_data",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DocumentMetaData"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update meta data",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/quotes/{id}/state-transition": {
      "put": {
        "tags": [
          "Quotes"
        ],
        "summary": "Status Transition",
        "description": "Status Transition\n\nThe API Gateway requires a bearer access token. Required permissions (any): quote:add, quote:edit, quote:list, quote:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "transition_to_put_quotes_id_state_transition",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Stable document identifier: the `anchor_id` returned by create and list. It stays the same when the document is edited.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TransitionFromModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Status Transition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/ap-aging-summary": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Get accounts payable ageing summary",
        "description": "Get accounts payable ageing summary\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:ap-aging-summary, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "openapi_ap_aging_summary",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "description": "As-of date in `YYYY-MM-DD`, interpreted in the company timezone. When\nomitted, each report applies its own default as-of date.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "aging_by",
            "in": "query",
            "description": "Age by `due_date`; other values use the document issue date.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get accounts payable ageing summary",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountsPayableAgingReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "DIMENSION_FILTER_UNSUPPORTED when `dimension_filter` is sent: only the income statement, general ledger, detailed general ledger and journal reports accept it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:ap-aging-summary",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/balance-sheet": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Get balance sheet",
        "description": "Get balance sheet\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:balance-sheet, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "openapi_balance_sheet",
        "parameters": [
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 reporting currency; defaults to the authenticated company's base currency.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "date",
            "in": "query",
            "description": "As-of date in `YYYY-MM-DD`, interpreted in the company timezone. When\nomitted, each report applies its own default as-of date.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get balance sheet",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceSheetReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "DIMENSION_FILTER_UNSUPPORTED when `dimension_filter` is sent: only the income statement, general ledger, detailed general ledger and journal reports accept it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:balance-sheet",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/cash-flow": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Get cash flow statement",
        "description": "Get cash flow statement\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:general-ledger, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "openapi_cash_flow",
        "parameters": [
          {
            "name": "date_range",
            "in": "query",
            "description": "Inclusive reporting period as `YYYY-MM-DD,YYYY-MM-DD`. When omitted,\neach report applies its own default period.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 reporting currency; defaults to the authenticated company's base currency.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get cash flow statement",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CashFlowReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "DIMENSION_FILTER_UNSUPPORTED when `dimension_filter` is sent: only the income statement, general ledger, detailed general ledger and journal reports accept it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:general-ledger",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/control-account-exceptions": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "List control-account exception journals",
        "description": "List control-account exception journals\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:trial-balance, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "openapi_control_account_exceptions",
        "parameters": [
          {
            "name": "date",
            "in": "query",
            "description": "As-of date in company-local `YYYY-MM-DD`; defaults to today.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum entries to return, from 1 to 100; defaults to 20.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "before_date",
            "in": "query",
            "description": "Continuation date from the previous page; send with `before_journal_id`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "before_journal_id",
            "in": "query",
            "description": "Continuation journal version ID from the previous page; send with `before_date`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Cursor-paginated exception journals",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ControlAccountExceptionPageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed `date` (`INVALID_REPORT_DATE`) or cursor (`INVALID_EXCEPTION_CURSOR`).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:trial-balance",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/control-account-exceptions/{journal_id}/review": {
      "post": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Acknowledge an exception on the exact journal version",
        "description": "Acknowledge an exception on the exact journal version\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:journal-edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "openapi_review_control_exception",
        "parameters": [
          {
            "name": "journal_id",
            "in": "path",
            "description": "Journal version ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExceptionReviewRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Review recorded; accounting balances unchanged",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ControlAccountExceptionReviewResultResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:journal-edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/customer-statement": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Get a dated customer statement, separately by transaction currency",
        "description": "Get a dated customer statement, separately by transaction currency\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:client-balance, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "openapi_customer_statement",
        "parameters": [
          {
            "name": "client",
            "in": "query",
            "description": "Customer id within the authenticated company.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "date_range",
            "in": "query",
            "description": "Inclusive ISO dates: YYYY-MM-DD,YYYY-MM-DD.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Opening balance, activity and closing balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerStatementResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid customer id or date range",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Requires report:client-balance permission"
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:client-balance",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/general-ledger": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Get general ledger",
        "description": "Get general ledger\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:general-ledger, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "openapi_general_ledger",
        "parameters": [
          {
            "name": "date_range",
            "in": "query",
            "description": "Inclusive reporting period as `YYYY-MM-DD,YYYY-MM-DD`. When omitted,\neach report applies its own default period.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 reporting currency; defaults to the authenticated company's base currency.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Optional posting-account ID filter for ledger reports.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "dimension_filter",
            "in": "query",
            "description": "Dimension filter: `<dimension_id>:<value_id>,<value_id>,unassigned;<dimension_id>:...`. AND across dimensions, OR within one dimension's list; a selected value includes its descendants; `unassigned` matches lines with no value for that dimension. At most 5 dimensions and 50 values each.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get general ledger",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GeneralLedgerReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "DIMENSION_INVALID_REQUEST: malformed dimension_filter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "DIMENSION_NOT_FOUND or DIMENSION_VALUE_NOT_FOUND",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:general-ledger",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/general-ledger-detailed": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Get detailed general ledger",
        "description": "Get detailed general ledger\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:general-ledger-detailed, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "openapi_general_ledger_detailed",
        "parameters": [
          {
            "name": "date_range",
            "in": "query",
            "description": "Inclusive reporting period as `YYYY-MM-DD,YYYY-MM-DD`. When omitted,\neach report applies its own default period.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 reporting currency; defaults to the authenticated company's base currency.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Optional posting-account ID filter for ledger reports.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "dimension_filter",
            "in": "query",
            "description": "Dimension filter: `<dimension_id>:<value_id>,<value_id>,unassigned;<dimension_id>:...`. AND across dimensions, OR within one dimension's list; a selected value includes its descendants; `unassigned` matches lines with no value for that dimension. At most 5 dimensions and 50 values each.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get detailed general ledger",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DetailedGeneralLedgerReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "DIMENSION_INVALID_REQUEST: malformed dimension_filter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "DIMENSION_NOT_FOUND or DIMENSION_VALUE_NOT_FOUND",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:general-ledger-detailed",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/health-summary": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Read bounded accounting health checks",
        "description": "Read bounded accounting health checks\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:trial-balance, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "openapi_health_summary",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Health status; incomplete scans are explicitly indicated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReportHealthSummaryResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:trial-balance",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/income-statement": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Get income statement",
        "description": "Get income statement\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:income-statement, report:balance-sheet, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "openapi_income_statement",
        "parameters": [
          {
            "name": "date_range",
            "in": "query",
            "description": "Inclusive reporting period as `YYYY-MM-DD,YYYY-MM-DD`. When omitted,\neach report applies its own default period.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "dimension_filter",
            "in": "query",
            "description": "Dimension filter: `<dimension_id>:<value_id>,<value_id>,unassigned;<dimension_id>:...`. AND across dimensions, OR within one dimension's list; a selected value includes its descendants; `unassigned` matches lines with no value for that dimension. At most 5 dimensions and 50 values each.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get income statement",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IncomeStatementReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "DIMENSION_INVALID_REQUEST: malformed dimension_filter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "DIMENSION_NOT_FOUND or DIMENSION_VALUE_NOT_FOUND",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:income-statement",
            "report:balance-sheet",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/journal-report": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Get journal report",
        "description": "Get journal report\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:journal, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "openapi_journal_report",
        "parameters": [
          {
            "name": "date_range",
            "in": "query",
            "description": "Inclusive reporting period as `YYYY-MM-DD,YYYY-MM-DD`. When omitted,\neach report applies its own default period.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 reporting currency; defaults to the authenticated company's base currency.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "account",
            "in": "query",
            "description": "Optional posting-account ID filter for ledger reports.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "dimension_filter",
            "in": "query",
            "description": "Dimension filter: `<dimension_id>:<value_id>,<value_id>,unassigned;<dimension_id>:...`. AND across dimensions, OR within one dimension's list; a selected value includes its descendants; `unassigned` matches lines with no value for that dimension. At most 5 dimensions and 50 values each.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get journal report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "DIMENSION_INVALID_REQUEST: malformed dimension_filter",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "DIMENSION_NOT_FOUND or DIMENSION_VALUE_NOT_FOUND",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:journal",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/source-posting-audit": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Inspect source posting outcomes and missing effects",
        "description": "By default returns missing, ambiguous or mismatched posting effects. include_complete=true also returns completed sources. Acceptance means the source exists in committed storage; completion requires all expected effects. Journal IDs, version anchors and hashes link to existing journal history/proof APIs. Legacy or unversioned relationships are labeled explicitly. Rejected transactions have no accepted source outcome; use the returned error and retry only transient failures.\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:trial-balance, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "openapi_source_posting_audit",
        "parameters": [
          {
            "name": "include_complete",
            "in": "query",
            "description": "Include complete accepted sources and their journal evidence; default false.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "name": "date",
            "in": "query",
            "description": "As-of date in company-local `YYYY-MM-DD`; defaults to today.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Source class: `documents` (default), `payments`, or `expenses`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum candidates scanned, from 1 to 100; defaults to 20.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "before_date",
            "in": "query",
            "description": "Continuation date from the previous page; send with `before_id`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "before_id",
            "in": "query",
            "description": "Continuation source ID from the previous page; send with `before_date`.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Candidate-scanned source posting gaps",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourcePostingAuditPageResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed `date` (`INVALID_REPORT_DATE`) or cursor (`INVALID_POSTING_AUDIT_CURSOR`).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:trial-balance",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/source-posting-audit/preview": {
      "post": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Preview a missing source posting without writing",
        "description": "Preview a missing source posting without writing\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:journal-add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "openapi_preview_posting_repair",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RepairRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourcePostingRepairPreviewResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:journal-add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/source-posting-audit/repair": {
      "post": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Repair a missing source posting after preview",
        "description": "Repair a missing source posting after preview\n\nThe API Gateway requires a bearer access token. Required permissions (any): accounting:journal-add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "openapi_repair_posting",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RepairRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SourcePostingRepairResultResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 6 requests per minute per client (bursts up to 8). The response has no body and no `Retry-After` header; wait 10 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "accounting:journal-add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/reports/trial-balance": {
      "get": {
        "tags": [
          "Financial Reports"
        ],
        "summary": "Get trial balance",
        "description": "Get trial balance\n\nThe API Gateway requires a bearer access token. Required permissions (any): report:trial-balance, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "openapi_trial_balance",
        "parameters": [
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 reporting currency; defaults to the authenticated company's base currency.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "date",
            "in": "query",
            "description": "As-of date in `YYYY-MM-DD`, interpreted in the company timezone. When\nomitted, each report applies its own default as-of date.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get trial balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TrialBalanceReportResponse"
                }
              }
            }
          },
          "400": {
            "description": "DIMENSION_FILTER_UNSUPPORTED when `dimension_filter` is sent: only the income statement, general ledger, detailed general ledger and journal reports accept it",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 12 requests per minute per client (bursts up to 15). The response has no body and no `Retry-After` header; wait 5 seconds before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "report:trial-balance",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/settings/country": {
      "get": {
        "tags": [
          "Configuration & Reference Data"
        ],
        "summary": "List Standardized Countries",
        "description": "Returns a flat list of countries for use in address forms and tax residency validation. Includes ISO alpha-2 codes to ensure compatibility with global shipping and compliance providers.",
        "operationId": "get_all_country",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Country list retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CountryListModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": false
        }
      }
    },
    "/v1/settings/currency": {
      "get": {
        "tags": [
          "Configuration & Reference Data"
        ],
        "summary": "List Supported Currencies",
        "description": "Retrieves the registry of ISO-4217 compliant currencies supported by the system. Includes metadata such as native symbols and decimal precision required for accurate Quasar input rendering.",
        "operationId": "get_all_currency",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Currency registry retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrencyListModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": false
        }
      }
    },
    "/v1/settings/currency-rate": {
      "get": {
        "tags": [
          "Configuration & Reference Data"
        ],
        "summary": "Fetch Specific Conversion Rate",
        "description": "Retrieves the exchange rate `1 base = rate target` between two ISO-4217 currencies. For an authenticated company, a custom FX window covering `at` (default now) takes precedence when the pair includes the company base currency (`source = custom`); otherwise the real-time or cached provider rate is returned (`source = automatic`). This is the primary endpoint for calculating transaction totals and tax liabilities in multi-currency environments.\n\nThe API Gateway requires a bearer access token.",
        "operationId": "get_exchange_rate",
        "parameters": [
          {
            "name": "base",
            "in": "query",
            "description": "ISO 4217 code of the currency to convert from.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "target",
            "in": "query",
            "description": "ISO 4217 code of the currency to convert to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "at",
            "in": "query",
            "description": "Moment to resolve the rate for: `YYYY-MM-DD` (a company-local date, e.g. a\ndocument issue date) or an RFC 3339 timestamp. Defaults to now. Only selects the\ncompany custom FX window; the automatic fallback is always the latest provider rate.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Conversion rate successfully retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrencyExchangeRateResponse"
                }
              }
            }
          },
          "400": {
            "description": "Missing `base` or `target`, or malformed `at` (`INVALID_VALUE`).",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true
        }
      }
    },
    "/v1/settings/currency-rates/resolve": {
      "post": {
        "tags": [
          "Configuration & Reference Data"
        ],
        "summary": "Resolve Exchange Rates (Batch)",
        "description": "Resolves up to 500 `1 base = rate target` lookups in one call, each for its own transaction date `at` (`YYYY-MM-DD` company-local, or RFC 3339; default today). Same rules as `GET /settings/currency-rate`: for an authenticated company a custom FX window covering the date wins when the pair includes the company base currency (`source = custom`), otherwise the provider rate (`source = automatic`). Automatic rates are the latest stored rate; `as_of_date_matched = false` flags an automatic rate returned for a past date. Items that cannot be resolved come back with `rate = null` and `error = RATE_NOT_FOUND`; malformed items fail the whole request with 400.\n\nThe API Gateway requires a bearer access token.",
        "operationId": "resolve_exchange_rates",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FxResolveRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Rates resolved, in request order",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FxResolveResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed (currency codes, dates, 1–500 items)",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true
        }
      }
    },
    "/v1/settings/locale": {
      "get": {
        "tags": [
          "Configuration & Reference Data"
        ],
        "summary": "List Localization Locales",
        "description": "Fetches a registry of supported regional locales (e.g., 'en_SG'). These strings guide the frontend on how to format dates, numbers, and currency strings based on the user's cultural context.",
        "operationId": "get_all_locale",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Locales retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LocaleListModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": false
        }
      }
    },
    "/v1/settings/timezone": {
      "get": {
        "tags": [
          "Configuration & Reference Data"
        ],
        "summary": "List System Timezones",
        "description": "Returns a list of IANA-compliant timezones. This data is critical for accurate audit logging and ensuring that transaction 'locking periods' align with the organization's physical operating hours.",
        "operationId": "get_all_timezone",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Timezones retrieved",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimezoneListModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": false
        }
      }
    },
    "/v1/taxes": {
      "get": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Tax List",
        "description": "Tax List\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:add, tax:edit, tax:list, tax:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_taxes",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Tax List",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxListResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:add",
            "tax:edit",
            "tax:list",
            "tax:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Create Tax",
        "description": "Create Tax\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:add, tax:edit, item:add, item:edit, invoice:add, invoice:edit, estimate:add, estimate:edit, credit-note:add, credit-note:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_taxes",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxCreateModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Create Tax",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxCreateResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:add",
            "tax:edit",
            "item:add",
            "item:edit",
            "invoice:add",
            "invoice:edit",
            "estimate:add",
            "estimate:edit",
            "credit-note:add",
            "credit-note:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/taxes/components": {
      "get": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "List Tax Components",
        "description": "List Tax Components\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:add, tax:edit, tax:list, tax:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "list_get_taxes_components",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "description": "Matches code or name, case-insensitive (the tax form's picker).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "code",
            "in": "query",
            "description": "Code contains this, case-insensitive (list filter).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "query",
            "description": "Name contains this, case-insensitive (list filter).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "description": "Exact kind, e.g. `county` (list filter).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "country_code",
            "in": "query",
            "description": "Exact country, e.g. `IN` (list filter).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "region",
            "in": "query",
            "description": "Exact region, e.g. `US-CA` (list filter).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "`active` (default), `archived` or `all`.",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/TaxComponentStatus"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` from the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Page size, 1 to 500; default 100.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of the company's components, ordered by code, with how many active taxes use each",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxComponentListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid cursor",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              },
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:add",
            "tax:edit",
            "tax:list",
            "tax:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Create Tax Component",
        "description": "Create Tax Component\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:add, tax:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_taxes_components",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxComponentFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxComponentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed, or the code is already used (`TAX_COMPONENT_CODE_EXISTS`)",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:add",
            "tax:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/taxes/components/{id}": {
      "put": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Update Tax Component",
        "description": "Update Tax Component\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_taxes_components_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Component id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxComponentFormModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Updated. A rate change also updates the rate of every tax using it.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxComponentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed, or the code is already used",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "`TAX_COMPONENT_NOT_FOUND`"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/taxes/components/{id}/archive": {
      "post": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Archive Tax Component",
        "description": "Archive Tax Component\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "archive_post_taxes_components_id_archive",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Component id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Archived",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxComponentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "`TAX_COMPONENT_NOT_FOUND`"
          },
          "409": {
            "description": "`TAX_COMPONENT_IN_USE`: active taxes use it; `details.tax_count` says how many"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/taxes/components/{id}/restore": {
      "post": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Restore Tax Component",
        "description": "Restore Tax Component\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "restore",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Component id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Restored",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxComponentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "404": {
            "description": "`TAX_COMPONENT_NOT_FOUND`"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/taxes/get-all": {
      "get": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Get All Taxes",
        "description": "Get All Taxes\n\nThe API Gateway requires a bearer access token. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_all_taxes",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get All Taxes",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxMapResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true
        }
      }
    },
    "/v1/taxes/reports/submissions/{id}": {
      "get": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Submitted Tax Report Detail",
        "description": "Submitted Tax Report Detail\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:report-submit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_tax_report_submission",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Submitted Tax Report Detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxSubmissionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:report-submit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Submitted Tax Report Archive",
        "description": "Submitted Tax Report Archive\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:report-submit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "archive_report_submission",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Submitted Tax Report Archive",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxSubmissionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:report-submit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Submitted Tax Report Delete",
        "description": "Submitted Tax Report Delete\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:report-submit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_report_submission",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Submitted Tax Report Delete",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxSubmissionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:report-submit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/taxes/reports/submit": {
      "post": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Submit Tax Report",
        "description": "Submit Tax Report\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:report-submit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "submit_tax_report",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxReportSubmissionRequestModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Submit Tax Report",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxReportSubmitResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:report-submit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/taxes/{id}": {
      "get": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Tax Detail",
        "description": "Tax Detail\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:add, tax:edit, tax:list, tax:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "detail_get_taxes_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Tax Detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxDetailResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:add",
            "tax:edit",
            "tax:list",
            "tax:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Update Tax",
        "description": "Update Tax\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:add, tax:edit, item:add, item:edit, invoice:add, invoice:edit, estimate:add, estimate:edit, credit-note:add, credit-note:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_taxes_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxUpdateModel"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update Tax",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxUpdateResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:add",
            "tax:edit",
            "item:add",
            "item:edit",
            "invoice:add",
            "invoice:edit",
            "estimate:add",
            "estimate:edit",
            "credit-note:add",
            "credit-note:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Taxes & Submissions"
        ],
        "summary": "Delete Tax",
        "description": "Delete Tax\n\nThe API Gateway requires a bearer access token. Required permissions (any): tax:add, tax:edit, item:add, item:edit, invoice:add, invoice:edit, estimate:add, estimate:edit, credit-note:add, credit-note:edit, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_delete_taxes_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete Tax",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxUpdateResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "tax:add",
            "tax:edit",
            "item:add",
            "item:edit",
            "invoice:add",
            "invoice:edit",
            "estimate:add",
            "estimate:edit",
            "credit-note:add",
            "credit-note:edit",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/vendors": {
      "get": {
        "tags": [
          "Vendors"
        ],
        "summary": "List Vendor",
        "description": "List Vendor\n\nThe API Gateway requires a bearer access token. Required permissions (any): vendor:add, vendor:edit, vendor:list, vendor:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "list_get_vendors",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "description": "Records per page, 1 to 200. Omitted means 50.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "name",
            "in": "query",
            "description": "Case-insensitive partial match on the name.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "email",
            "in": "query",
            "description": "Case-insensitive partial match on the email address.",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "currency",
            "in": "query",
            "description": "ISO 4217 currency code. Accepts a comma-separated list on document lists, transactions and contacts (any of them matches).",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "deleted",
            "in": "query",
            "description": "`true` returns only deleted records; omitted or `false` returns records that are not deleted.",
            "required": false,
            "schema": {
              "type": [
                "boolean",
                "null"
              ]
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "List of people (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleListResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "vendor:add",
            "vendor:edit",
            "vendor:list",
            "vendor:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Vendors"
        ],
        "summary": "Create Vendor",
        "description": "Create Vendor\n\nThe API Gateway requires a bearer access token. Required permissions (any): vendor:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_post_vendors",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PeopleFormModel"
              },
              "example": {
                "company_email": "billing@example.com",
                "company_name": "Example Studio",
                "contact_first_name": "Alex",
                "currency": "USD",
                "locale": "en-US"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Create people (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "vendor:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/vendors/dimension-defaults/lookup": {
      "post": {
        "tags": [
          "Vendors"
        ],
        "summary": "Look up Vendor default dimensions",
        "description": "Batch read of the default dimension values saved on up to 100 clients or vendors, one call instead of one detail read per contact. A read sent as POST because the ids do not fit a query string. One entry per requested id, in request order; a contact with none, or an id that is not this tenant's contact of the asked type, has an empty state. The items list is empty while Dimensions is not activated, like the contact detail.\n\nThe API Gateway requires a bearer access token. Required permissions (any): vendor:add, vendor:edit, vendor:list, vendor:view, invoice:add, invoice:edit, invoice:list, invoice:view, quote:add, quote:edit, quote:list, quote:view, credit-note:add, credit-note:edit, credit-note:list, credit-note:view, purchase-order:add, purchase-order:edit, purchase-order:list, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "dimension_defaults_lookup_post_vendors_dimension_defaults_lookup",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DefaultsLookupRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Defaults per contact",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataResponse_DefaultsLookupResponse"
                }
              }
            }
          },
          "400": {
            "description": "Unknown people type, empty list, more than 100 ids, or a blank id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserErrorModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "429": {
            "description": "Rate limit exceeded: this operation allows 60 requests per minute per client (bursts up to 75). The response has no body and no `Retry-After` header; wait 1 second before retrying."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "vendor:add",
            "vendor:edit",
            "vendor:list",
            "vendor:view",
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:list",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/vendors/get-all": {
      "get": {
        "tags": [
          "Vendors"
        ],
        "summary": "List All Vendor",
        "description": "List All Vendor\n\nThe API Gateway requires a bearer access token. Required permissions (any): invoice:add, invoice:edit, invoice:list, invoice:view, quote:add, quote:edit, quote:list, quote:view, credit-note:add, credit-note:edit, credit-note:list, credit-note:view, purchase-order:add, purchase-order:edit, purchase-order:list, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "get_all_people_get_vendors_get_all",
        "parameters": [
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get all of people (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleFullListResponseModel"
                },
                "example": {
                  "data": {
                    "00000000-0000-4000-8000-000000000001": {
                      "attributes": null,
                      "company_email": "vendor@example.com",
                      "company_name": "Example Supplies",
                      "contact_first_name": "Alex",
                      "contact_last_name": "Lee",
                      "contacts": null,
                      "created_at": "2026-10-23T08:00:00",
                      "credit": null,
                      "credit_bcy": null,
                      "currency": "USD",
                      "deleted_at": null,
                      "external_id": null,
                      "external_source": null,
                      "id": "00000000-0000-4000-8000-000000000001",
                      "is_active": true,
                      "locale": "en-US",
                      "outstanding": null,
                      "outstanding_bcy": null,
                      "people_type": "vendor"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:list",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/vendors/{id}": {
      "get": {
        "tags": [
          "Vendors"
        ],
        "summary": "Get Vendor",
        "description": "Get Vendor\n\nThe API Gateway requires a bearer access token. Required permissions (any): vendor:add, vendor:edit, vendor:list, vendor:view, invoice:add, invoice:edit, invoice:list, invoice:view, quote:add, quote:edit, quote:list, quote:view, credit-note:add, credit-note:edit, credit-note:list, credit-note:view, purchase-order:add, purchase-order:edit, purchase-order:list, purchase-order:view, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "detail_get_vendors_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Get people detail (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleDetailResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "vendor:add",
            "vendor:edit",
            "vendor:list",
            "vendor:view",
            "invoice:add",
            "invoice:edit",
            "invoice:list",
            "invoice:view",
            "quote:add",
            "quote:edit",
            "quote:list",
            "quote:view",
            "credit-note:add",
            "credit-note:edit",
            "credit-note:list",
            "credit-note:view",
            "purchase-order:add",
            "purchase-order:edit",
            "purchase-order:list",
            "purchase-order:view",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Vendors"
        ],
        "summary": "Update Vendor",
        "description": "Update Vendor\n\nThe API Gateway requires a bearer access token. Required permissions (any): vendor:edit, vendor:add, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_put_vendors_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PeopleFormModel"
              },
              "example": {
                "company_email": "billing@example.com",
                "company_name": "Example Studio",
                "contact_first_name": "Alex",
                "currency": "USD",
                "locale": "en-US"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Update people (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleFormResponseModel"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "vendor:edit",
            "vendor:add",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Vendors"
        ],
        "summary": "Delete Vendor",
        "description": "Delete Vendor\n\nThe API Gateway requires a bearer access token. Required permissions (any): vendor:delete, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials. Provide only the documented query parameters; tenant context is determined by authentication and the requested operation.",
        "operationId": "delete_delete_vendors_id",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Delete people (Clients/Vendors)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PeopleDeleteResponseModel"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "vendor:delete",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/webhooks/endpoints": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook endpoints",
        "description": "List webhook endpoints\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "list_endpoints",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointListResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook endpoint",
        "description": "Create a webhook endpoint\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "create_endpoint",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateEndpointRequest"
              },
              "example": {
                "enabled_events": [
                  "invoice.created"
                ],
                "name": "Accounting events",
                "url": "https://example.com/webhooks/accounting"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndpointSecretResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/webhooks/endpoints/{id}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Get a webhook endpoint",
        "description": "Get a webhook endpoint\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "get_endpoint",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "put": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Update a webhook endpoint",
        "description": "Update a webhook endpoint\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "update_endpoint",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateEndpointRequest"
              },
              "example": {
                "description": "Receives accounting lifecycle events",
                "name": "Accounting events"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      },
      "delete": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a webhook endpoint",
        "description": "Delete a webhook endpoint\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "delete_endpoint",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "204": {
            "description": ""
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/webhooks/endpoints/{id}/deliveries": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhook deliveries",
        "description": "List webhook deliveries\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "list_deliveries",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "1-based page number. Omitted or 0 means page 1.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "description": "Deliveries per page, 1 to 100. Omitted means 50.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryListResponse"
                }
              }
            }
          },
          "400": {
            "description": "A query parameter is missing or could not be parsed. The body is plain text (`Query deserialize error: ...`).",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/webhooks/endpoints/{id}/deliveries/{delivery_id}/resend": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Resend a webhook delivery",
        "description": "Resend a webhook delivery\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "resend_delivery",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "delivery_id",
            "in": "path",
            "description": "Webhook delivery identifier (`id` from the endpoint's delivery list).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResendDeliveryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/webhooks/endpoints/{id}/pause": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Pause a webhook endpoint",
        "description": "Pause a webhook endpoint\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "pause_endpoint",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/webhooks/endpoints/{id}/resume": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Resume a webhook endpoint",
        "description": "Resume a webhook endpoint\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "resume_endpoint",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookEndpointResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/webhooks/endpoints/{id}/reveal-secret": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Reveal a webhook signing secret",
        "description": "Reveal a webhook signing secret\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "reveal_endpoint_secret",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RevealSecretResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/webhooks/endpoints/{id}/rotate-secret": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Rotate a webhook signing secret",
        "description": "Rotate a webhook signing secret\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "rotate_endpoint_secret",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EndpointSecretResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/webhooks/endpoints/{id}/verify": {
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Verify a webhook endpoint",
        "description": "Verify a webhook endpoint\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:manage, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "verify_endpoint",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Identifier of the record, as returned in `id` by its list or create operation.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyEndpointResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation failed for one or more fields, or a business rule rejected the request. Field validation returns `{\"error\": {field: [codes]}}`; other rejections return `{\"error\": {code, message, details?}}`.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ValidationErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:manage",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    },
    "/v1/webhooks/event-types": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List available webhook event types",
        "description": "List available webhook event types\n\nThe API Gateway requires a bearer access token. Required permissions (any): webhook:list, role:admin. Audience and session binding checks also apply. A browser session route is not automatically available to partner credentials.",
        "operationId": "event_types",
        "parameters": [
          {
            "$ref": "#/components/parameters/PartnerDomain"
          }
        ],
        "responses": {
          "200": {
            "description": "Partner-filtered webhook event catalog",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EventCatalogResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized: JWT Bearer token missing or expired."
          },
          "403": {
            "description": "Webhooks are disabled for this partner"
          },
          "500": {
            "description": "Internal Server Error: An unexpected error occurred on the server. The body is either the JSON string `INTERNAL_SERVER_ERROR` or the standard `{\"error\": {code, message}}` envelope, depending on the route.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/InternalServerErrorResponse"
                    },
                    {
                      "$ref": "#/components/schemas/UserErrorModel"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "x-api-gateway-auth": {
          "bearer": true,
          "scopes": [
            "webhook:list",
            "role:admin"
          ],
          "scopes_matcher": "any"
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "parameters": {
      "PartnerDomain": {
        "name": "x-partner-domain",
        "in": "header",
        "required": true,
        "description": "The domain you registered on, which identifies your partner: for example the production or sandbox host of the platform, or your own registered domain. Calls without it are rejected with HTTP 400, and a domain that is not registered returns HTTP 404 `PARTNER_DOMAIN_NOT_ALLOWED`.",
        "schema": {
          "type": "string"
        }
      }
    },
    "schemas": {
      "AccountLedgerDetail": {
        "type": "object",
        "required": [
          "account_id",
          "account_name",
          "account_currency",
          "account_subtype",
          "account_type",
          "transactions",
          "total_debit_bcy",
          "total_credit_bcy",
          "ending_balance"
        ],
        "properties": {
          "account_currency": {
            "type": "string"
          },
          "account_id": {
            "type": "string",
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "account_name": {
            "type": "string",
            "description": "Account name in the chart of accounts."
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank account number, when the account is a bank account."
          },
          "account_subtype": {
            "type": "string",
            "description": "Account subtype within its classification."
          },
          "account_type": {
            "type": "string",
            "description": "Account classification: `asset`, `liability`, `equity`, `revenue` or `expense`."
          },
          "ending_balance": {
            "type": "string",
            "description": "Balance at the end of the range, as a decimal string."
          },
          "total_credit_bcy": {
            "type": "string",
            "description": "Total credits in the company base currency, as a decimal string."
          },
          "total_debit_bcy": {
            "type": "string",
            "description": "Total debits in the company base currency, as a decimal string."
          },
          "transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerTransaction"
            }
          }
        }
      },
      "AccountsPayableAgingEntry": {
        "type": "object",
        "required": [
          "vendor_id"
        ],
        "properties": {
          "bucket_0_30_days": {
            "type": [
              "string",
              "null"
            ]
          },
          "bucket_121_plus_days": {
            "type": [
              "string",
              "null"
            ]
          },
          "bucket_31_60_days": {
            "type": [
              "string",
              "null"
            ]
          },
          "bucket_61_90_days": {
            "type": [
              "string",
              "null"
            ]
          },
          "bucket_91_120_days": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string in the record's currency."
          },
          "vendor_id": {
            "type": "string"
          }
        }
      },
      "AclCompanyRoleDbModel": {
        "type": "object",
        "required": [
          "id",
          "company_id",
          "role_name",
          "role_permission",
          "created_at",
          "updated_by",
          "is_active",
          "is_system_defined"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "is_system_defined": {
            "type": "boolean",
            "description": "Set by the system or a connected integration; read-only."
          },
          "role_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "role_name": {
            "type": "string"
          },
          "role_permission": {
            "type": "string"
          },
          "role_permission_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "updated_by": {
            "type": "string",
            "description": "User who last changed the record."
          }
        }
      },
      "AclCompanyRoleFormModel": {
        "type": "object",
        "description": "Creates or updates a company role and its permission assignments.",
        "required": [
          "role_name",
          "role_description",
          "role_permission"
        ],
        "properties": {
          "is_active": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the record is active."
          },
          "role_description": {
            "type": "string"
          },
          "role_name": {
            "type": "string"
          },
          "role_permission": {
            "type": "string",
            "description": "A JSON array of permission names, sent as a string. Pick from `GET /acl/permission`,\nwhich lists what you may grant; anything else is refused.",
            "example": "[\"invoice:list\",\"invoice:view\"]"
          }
        }
      },
      "AclCompanyRoleFormResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/AclCompanyRoleDbModel"
          }
        }
      },
      "AclCompanyRolePermission": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/AclUserRolePermission"
          }
        }
      },
      "AclModuleDbModel": {
        "type": "object",
        "required": [
          "id",
          "module",
          "is_active",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "module": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          }
        }
      },
      "AclModuleListResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AclModuleDbModel"
            }
          }
        }
      },
      "AclUserRolePermission": {
        "type": "object",
        "required": [
          "id",
          "company_id",
          "role_name",
          "role_permission",
          "created_at",
          "is_system_defined"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_system_defined": {
            "type": "boolean",
            "description": "Set by the system or a connected integration; read-only."
          },
          "role_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "role_name": {
            "type": "string"
          },
          "role_permission": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "role_permission_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "updated_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "User who last changed the record."
          }
        }
      },
      "Action": {
        "type": "object",
        "description": "An expense workflow action with its target status, display metadata, and optional confirmation requirements.",
        "required": [
          "key",
          "label",
          "description",
          "color",
          "icon",
          "disabled",
          "confirmation_required",
          "action_type"
        ],
        "properties": {
          "action_type": {
            "type": "string"
          },
          "color": {
            "type": "string"
          },
          "confirmation_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "confirmation_required": {
            "type": "boolean"
          },
          "description": {
            "type": "string"
          },
          "disabled": {
            "type": "boolean"
          },
          "icon": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "primary": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "target_status": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ExpenseStatus"
              }
            ]
          }
        }
      },
      "ActionConfirmationMethod": {
        "type": "string",
        "description": "A supported method for confirming a sensitive action.",
        "enum": [
          "email",
          "totp"
        ]
      },
      "ActivityActorSourceModel": {
        "type": "object",
        "description": "Describes where an activity's actor identity originated.",
        "required": [
          "source_type"
        ],
        "properties": {
          "app_connect_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "app_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_type": {
            "type": "string"
          }
        }
      },
      "ActivityCursorPaginationModel": {
        "type": "object",
        "description": "Cursor pagination settings for an activity list.",
        "required": [
          "has_more"
        ],
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ActivityCursorResponseModel": {
        "type": "object",
        "description": "Continuation metadata returned by an activity-list request.",
        "required": [
          "data",
          "pagination"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CursorActivityModel"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/ActivityCursorPaginationModel"
          }
        }
      },
      "ActivityDbModel": {
        "type": "object",
        "description": "A recorded audit activity with its actor, action, entity, and timestamp.",
        "required": [
          "id",
          "acl_module_id",
          "user_id",
          "company_id",
          "activity",
          "created_at"
        ],
        "properties": {
          "acl_module_id": {
            "type": "string"
          },
          "activity": {
            "type": "string"
          },
          "activity_color": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "message_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "message_params": {
            "description": "Free-form JSON; keys and values depend on the producing workflow."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "ActivityListResponseModel": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ActivityCursorResponseModel"
          },
          {
            "$ref": "#/components/schemas/UserActivityListResponseModel"
          }
        ],
        "description": "A bounded activity feed with its cursor pagination metadata."
      },
      "AccountsPayableAgingReportResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "aging_data",
              "as_of_date",
              "vendor_labels"
            ],
            "properties": {
              "aging_data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AccountsPayableAgingEntry"
                }
              },
              "as_of_date": {
                "type": "string"
              },
              "vendor_labels": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                },
                "propertyNames": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "BalanceSheetReportResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "balance_sheet"
            ],
            "properties": {
              "as_of_date": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "asset_total": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "balance_sheet": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BankingAccountTypeModel"
                }
              },
              "liability_equity_total": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "prior_fiscal_month_end": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "prior_fiscal_year_end": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "BankAccountsResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "balances",
              "accounts"
            ],
            "properties": {
              "accounts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BankingAccountModel"
                }
              },
              "balances": {
                "type": "object",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/AvailableBalanceResult"
                  }
                },
                "propertyNames": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "BankingAccountDeleteResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "deleted_id"
            ],
            "properties": {
              "deleted_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "BankingAccountDetailResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "name",
              "currency"
            ],
            "properties": {
              "account_number": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "account_subtype_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "currency": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "is_archived": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "kind": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "name": {
                "type": "string"
              },
              "parent_account_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tag": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "BankingAccountSubtypeFormResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "name",
              "account_type_id"
            ],
            "properties": {
              "account_number": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "account_type_id": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            }
          }
        }
      },
      "BankingAccountWithStatsResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "name",
              "currency",
              "account_type",
              "account_subtype",
              "is_archived",
              "is_system_defined",
              "account_kind",
              "created_at"
            ],
            "properties": {
              "account_kind": {
                "type": "string"
              },
              "account_number": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "account_subtype": {
                "type": "string"
              },
              "account_subtype_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "account_type": {
                "type": "string"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "currency": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "excluded_count": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              },
              "id": {
                "type": "string"
              },
              "is_archived": {
                "type": "boolean"
              },
              "is_system_defined": {
                "type": "boolean"
              },
              "name": {
                "type": "string"
              },
              "parent_account_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tag": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "uncategorized_count": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              },
              "unreconciled_count": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int64"
              }
            }
          }
        }
      },
      "BankingJournalDeleteResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "deleted"
            ],
            "properties": {
              "deleted": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BankingJournalDeleteModel"
                }
              }
            }
          }
        }
      },
      "BankingJournalFormResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "journal"
            ],
            "properties": {
              "journal": {
                "$ref": "#/components/schemas/BankingJournalHeaderModel"
              }
            }
          }
        }
      },
      "BankingJournalListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "total_records",
              "page_size",
              "page_number",
              "journals"
            ],
            "properties": {
              "journals": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BankingJournalModel"
                }
              },
              "page_number": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "page_size": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "total_records": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          }
        }
      },
      "BankingMatchPolicyListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "default_policy_id",
              "policies"
            ],
            "properties": {
              "default_policy_id": {
                "type": "string"
              },
              "policies": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BankingMatchPolicyModel"
                }
              }
            }
          }
        }
      },
      "BankingMatchPolicySettingResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "company_id",
              "default_policy_id"
            ],
            "properties": {
              "company_id": {
                "type": "string"
              },
              "default_policy_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "BankingReconciliationListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "total_records",
              "page_size",
              "page_number",
              "reconciliations"
            ],
            "properties": {
              "page_number": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "page_size": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "reconciliations": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BankingReconciliationModel"
                }
              },
              "total_records": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          }
        }
      },
      "BankingReconciliationResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "user_id",
              "banking_account_id",
              "start_date",
              "end_date",
              "closing_balance",
              "status",
              "created_at",
              "lines",
              "attachments"
            ],
            "properties": {
              "attachments": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BankingReconciliationAttachmentModel"
                }
              },
              "banking_account_id": {
                "type": "string"
              },
              "calculated_balance": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "closing_balance": {
                "type": "string"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "diff": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "end_date": {
                "type": "string",
                "format": "date"
              },
              "id": {
                "type": "string"
              },
              "lines": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BankingReconciliationLineModel"
                }
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "opening_balance": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "reconciled_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "start_date": {
                "type": "string",
                "format": "date"
              },
              "status": {
                "type": "string"
              },
              "user_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "BankingTransactionResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "banking_account_id",
              "date",
              "amount",
              "currency",
              "is_auto_matched",
              "is_ignored",
              "is_reconciled",
              "transaction_hash",
              "exchange_rate",
              "is_posted",
              "available_balance",
              "transaction_type"
            ],
            "properties": {
              "amount": {
                "type": "string"
              },
              "available_balance": {
                "type": "string"
              },
              "banking_account_id": {
                "type": "string"
              },
              "company_bank_link_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "created_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "credit_account_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "currency": {
                "type": "string"
              },
              "date": {
                "type": "string",
                "format": "date"
              },
              "debit_account_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entity": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entity_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "exchange_rate": {
                "type": "string"
              },
              "external_account_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "external_transaction_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "ignore_reason": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "is_auto_matched": {
                "type": "boolean"
              },
              "is_ignored": {
                "type": "boolean"
              },
              "is_posted": {
                "type": "boolean"
              },
              "is_reconciled": {
                "type": "boolean"
              },
              "meta_data": {
                "$ref": "#/components/schemas/Value"
              },
              "transaction_hash": {
                "type": "string"
              },
              "transaction_identifier": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "transaction_type": {
                "type": "string"
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "user_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "BankingTransactionListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "policy_id",
              "total_records",
              "page_size",
              "page_number",
              "transactions"
            ],
            "properties": {
              "page_number": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "page_size": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "policy_id": {
                "type": "string"
              },
              "total_records": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "transactions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BankingTransactionModel"
                }
              }
            }
          }
        }
      },
      "CashFlowReportResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "summary"
            ],
            "properties": {
              "date_range": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "summary": {
                "$ref": "#/components/schemas/CashFlowSummary"
              }
            }
          }
        }
      },
      "CompanyFxRateDeleteResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "outcome"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "outcome": {
                "$ref": "#/components/schemas/CompanyFxRateRemovalOutcome"
              }
            }
          }
        }
      },
      "CompanyFxRateHistoryResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "total_records",
              "page_number",
              "page_size",
              "entries"
            ],
            "properties": {
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CompanyFxRateHistoryEntry"
                }
              },
              "page_number": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "page_size": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "total_records": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          }
        }
      },
      "CompanyFxRateListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "total_records",
              "page_number",
              "page_size",
              "rates"
            ],
            "properties": {
              "page_number": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "page_size": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "rates": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CompanyFxRateModel"
                }
              },
              "total_records": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          }
        }
      },
      "CompanyFxRateResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "description": "One custom FX window row. Scalars are stringified for stable wire/UI parsing\n(decimals keep full precision; timestamps are UTC ISO-8601).\n\nRate direction: `1 target_currency = exchange_rate base_currency`, where\n`base_currency` is the company's base currency. This is the same convention as a\ndocument's `document_exchange_rate` (\"1 document currency = X company currency\").",
            "required": [
              "id",
              "base_currency",
              "target_currency",
              "exchange_rate",
              "status",
              "effective_from",
              "effective_from_date",
              "created_at",
              "updated_at"
            ],
            "properties": {
              "base_currency": {
                "type": "string"
              },
              "created_at": {
                "type": "string"
              },
              "created_by": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "deleted_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "effective_from": {
                "type": "string",
                "description": "First instant the window applies (UTC). Start of `effective_from_date` in the\ncompany timezone."
              },
              "effective_from_date": {
                "type": "string",
                "description": "Company-local calendar date the window starts (`YYYY-MM-DD`). UIs should display\nand edit this, not a slice of the UTC timestamp (which can be the previous day)."
              },
              "effective_to": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Last instant the window applies (UTC, inclusive). `null` = open-ended."
              },
              "effective_to_date": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Company-local calendar date the window ends, inclusive (`YYYY-MM-DD`)."
              },
              "exchange_rate": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "status": {
                "$ref": "#/components/schemas/CompanyFxRateStatus"
              },
              "target_currency": {
                "type": "string"
              },
              "updated_at": {
                "type": "string"
              },
              "updated_by": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "CompanyFxRateSwitchAutomaticResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "description": "Response for `switch-automatic`: what happened to the pair's current/upcoming windows.",
            "required": [
              "target_currency",
              "removed_ids",
              "ended_ids"
            ],
            "properties": {
              "ended_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Windows that were in effect before today and now end yesterday."
              },
              "removed_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Soft-deleted windows (upcoming, or started today)."
              },
              "target_currency": {
                "type": "string"
              }
            }
          }
        }
      },
      "ControlAccountExceptionPageResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "entries",
              "as_of_date"
            ],
            "properties": {
              "as_of_date": {
                "type": "string",
                "format": "date"
              },
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ControlAccountExceptionEntry"
                }
              },
              "next_before_date": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "next_before_journal_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "ControlAccountExceptionReviewResultResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "reviewed"
            ],
            "properties": {
              "reviewed": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "CurrencyExchangeRateResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "base",
              "target",
              "rate",
              "time"
            ],
            "properties": {
              "as_of_date_matched": {
                "type": "boolean",
                "description": "`false` when an automatic rate was returned for a date before today: no\nhistorical provider rates are stored, so it is the latest rate, not that day's.\nCustom rates always match their date."
              },
              "base": {
                "type": "string"
              },
              "custom_rate_id": {
                "type": [
                  "string",
                  "null"
                ],
                "description": "Id of the custom window that produced the rate (only when `source = custom`)."
              },
              "rate": {
                "type": "string",
                "description": "`1 base = rate target`."
              },
              "source": {
                "$ref": "#/components/schemas/FxRateSource",
                "description": "Rate source; defaults to `automatic` when omitted."
              },
              "target": {
                "type": "string"
              },
              "time": {
                "type": "string",
                "format": "date-time",
                "description": "Automatic: provider timestamp of the rate. Custom: the window's `effective_from` (UTC)."
              }
            }
          }
        }
      },
      "CustomerStatementResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "client",
              "date_range",
              "currencies"
            ],
            "properties": {
              "client": {
                "type": "string"
              },
              "currencies": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CurrencyStatement"
                },
                "description": "One company-base-currency group; source amounts use document booked rates."
              },
              "date_range": {
                "type": "string"
              }
            }
          }
        }
      },
      "DeliveryListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "items",
              "page",
              "per_page",
              "total"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DeliveryResponse"
                }
              },
              "page": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "per_page": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "total": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          }
        }
      },
      "DetailedGeneralLedgerReportResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "accounts"
            ],
            "properties": {
              "accounts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/AccountLedgerDetail"
                }
              },
              "date_range": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "DocumentSummaryResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "as_of",
              "base_currency",
              "due_soon_days",
              "statuses",
              "state_counts"
            ],
            "properties": {
              "as_of": {
                "type": "string",
                "description": "When the summary was computed (RFC 3339, UTC)."
              },
              "base_currency": {
                "type": "string"
              },
              "due_soon_days": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              },
              "state_counts": {
                "$ref": "#/components/schemas/DocumentSummaryStateCounts"
              },
              "statuses": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DocumentSummaryStatus"
                },
                "description": "One row per status that has documents, ordered by status name."
              }
            }
          }
        }
      },
      "EmailConfirmationCodeResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "prefix"
            ],
            "properties": {
              "prefix": {
                "type": "string",
                "description": "Visible part of the emailed code, which reads `<prefix>-<digits>`. Show it next to the\ncode field so the user can pick the right email; submit the full code."
              }
            }
          }
        }
      },
      "WebhookEndpointResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "description": "A registered webhook destination with its URL, enabled events, and delivery state.",
            "required": [
              "id",
              "url",
              "spec_version",
              "status",
              "enabled_events",
              "header_names",
              "created_at"
            ],
            "properties": {
              "created_at": {
                "type": "string"
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "enabled_events": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "header_names": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Configured names only. Secret header values are never returned."
              },
              "id": {
                "type": "string"
              },
              "name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "spec_version": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "url": {
                "type": "string"
              }
            }
          }
        }
      },
      "EndpointSecretResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "allOf": [
              {
                "$ref": "#/components/schemas/EndpointResponse"
              },
              {
                "type": "object",
                "required": [
                  "signing_secret"
                ],
                "properties": {
                  "signing_secret": {
                    "type": "string",
                    "description": "Returned only when a secret is created or rotated. It cannot be retrieved later."
                  }
                }
              }
            ]
          }
        }
      },
      "EventCatalogResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "spec_version",
              "protocol",
              "business_areas"
            ],
            "properties": {
              "business_areas": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EventBusinessArea"
                }
              },
              "protocol": {
                "$ref": "#/components/schemas/WebhookProtocolResponse"
              },
              "spec_version": {
                "type": "string"
              }
            }
          }
        }
      },
      "FxResolveResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "items"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/FxResolveResult"
                }
              }
            }
          }
        }
      },
      "GeneralLedgerReportResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "ledger"
            ],
            "properties": {
              "date_range": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "ledger": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/GeneralLedgerEntry"
                }
              }
            }
          }
        }
      },
      "TaxMapResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "required": [
                "id",
                "tax_name",
                "tax_value",
                "tax_type",
                "category",
                "display_label",
                "is_recoverable"
              ],
              "properties": {
                "category": {
                  "type": "string"
                },
                "components": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TaxComponentSharedModel"
                  },
                  "description": "Component components (PL-253). Empty for a simple tax. Defaults so\na tax map cached before components existed still reads."
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "display_label": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "is_recoverable": {
                  "type": "boolean"
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "tax_group_ids": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "tax_name": {
                  "type": "string"
                },
                "tax_type": {
                  "type": "string"
                },
                "tax_value": {
                  "type": "string"
                }
              }
            },
            "propertyNames": {
              "type": "string"
            }
          }
        }
      },
      "IncomeStatementReportResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "income_statement"
            ],
            "properties": {
              "date_range": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "income_statement": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BankingAccountTypeModel"
                }
              },
              "net_income": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "prior_comparable_range": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "status": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        },
        "example": {
          "data": {
            "date_range": "2026-09-01,2026-09-30",
            "income_statement": [
              {
                "account_name": "revenue",
                "account_number": null,
                "account_subtype": [],
                "id": "revenue",
                "total": "1250.00"
              },
              {
                "account_name": "expense",
                "account_number": null,
                "account_subtype": [],
                "id": "expense",
                "total": "350.00"
              }
            ],
            "net_income": "900.00",
            "prior_comparable_range": null,
            "status": "profit"
          }
        }
      },
      "ItemDeleteResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "user_id",
              "company_id",
              "sku",
              "item_name",
              "item_quantity",
              "item_cost",
              "is_active",
              "item_type",
              "has_sales_price",
              "sales_price",
              "sales_currency",
              "has_purchase_price",
              "purchase_price",
              "purchase_currency"
            ],
            "properties": {
              "barcode": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "company_id": {
                "type": "string"
              },
              "cost_for_client": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "created_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "deleted_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "dimension_state": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/DimensionState"
                  }
                ]
              },
              "external_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "external_source": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "has_purchase_price": {
                "type": "boolean"
              },
              "has_sales_price": {
                "type": "boolean"
              },
              "id": {
                "type": "string"
              },
              "is_active": {
                "type": "boolean"
              },
              "item_attribute": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/ItemAttModel"
                }
              },
              "item_cost": {
                "type": "string"
              },
              "item_description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "item_name": {
                "type": "string"
              },
              "item_quantity": {
                "type": "string"
              },
              "item_tax": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "item_type": {
                "type": "string"
              },
              "item_unit": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "pricing": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/ItemPriceResult"
                  }
                ]
              },
              "purchase_account_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "purchase_currency": {
                "type": "string"
              },
              "purchase_description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "purchase_price": {
                "type": "string"
              },
              "purchase_tax_ids": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "sales_account_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sales_currency": {
                "type": "string"
              },
              "sales_description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "sales_price": {
                "type": "string"
              },
              "sales_tax_ids": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "type": "string"
                }
              },
              "sku": {
                "type": "string"
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "user_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "JournalDetailResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "anchor_id",
              "version_number",
              "is_current",
              "identifier",
              "date",
              "description",
              "currency",
              "exchange_rate",
              "is_locked",
              "is_posted",
              "is_reversal",
              "is_voided",
              "is_manual",
              "created_at",
              "lines",
              "is_manual_override",
              "version_history"
            ],
            "properties": {
              "anchor_id": {
                "type": "string",
                "description": "Stable identity of the journal across versions. Use this for links and\nfor the anchor_id path parameter on GET, PUT, DELETE and void."
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "currency": {
                "type": "string"
              },
              "date": {
                "type": "string",
                "format": "date"
              },
              "description": {
                "type": "string"
              },
              "dimension_capture": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/JournalDimensionCaptureState"
                  }
                ]
              },
              "entity_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entity_type": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "exchange_rate": {
                "type": "string"
              },
              "id": {
                "type": "string",
                "description": "Id of this version row. Changes on every restatement; do not store it as\nthe journal's identity."
              },
              "identifier": {
                "type": "string"
              },
              "is_current": {
                "type": "boolean",
                "description": "True on the version the books use. Exactly one version is current."
              },
              "is_locked": {
                "type": "boolean"
              },
              "is_manual": {
                "type": "boolean"
              },
              "is_manual_override": {
                "type": "boolean"
              },
              "is_posted": {
                "type": "boolean"
              },
              "is_reversal": {
                "type": "boolean"
              },
              "is_voided": {
                "type": "boolean"
              },
              "lines": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/JournalLineItem"
                }
              },
              "meta_data": {
                "description": "Free-form JSON; keys and values depend on the producing workflow."
              },
              "override_reason": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "prev_hash": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "reference": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "related_entity_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "related_entity_type": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "reversal_of": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source_document_version_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "version_history": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/JournalVersionHistoryItem"
                }
              },
              "version_number": {
                "type": "integer",
                "format": "int32",
                "description": "1 for the original posting, +1 per restatement or void."
              }
            }
          }
        }
      },
      "JournalReportResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "journals"
            ],
            "properties": {
              "date_range": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "journals": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/JournalReportEntry"
                }
              }
            }
          }
        }
      },
      "JournalVoidResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "success",
              "error"
            ],
            "properties": {
              "error": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/JournalVoidError"
                }
              },
              "success": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/JournalVoidSuccess"
                }
              }
            }
          }
        }
      },
      "LateFeeListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "total_records",
              "page_size",
              "page_number",
              "late_fees"
            ],
            "properties": {
              "late_fees": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/LateFeeDbModel"
                }
              },
              "page_number": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "page_size": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              },
              "total_records": {
                "type": "integer",
                "format": "int64",
                "minimum": 0
              }
            }
          }
        }
      },
      "MatchGroupTransactionResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "policy_id",
              "matches"
            ],
            "properties": {
              "matches": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/MatchModel"
                }
              },
              "policy_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "DocumentCommentResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "id",
                  "document_id",
                  "user_id",
                  "company_id",
                  "comment",
                  "created_at",
                  "is_internal"
                ],
                "properties": {
                  "comment": {
                    "type": "string"
                  },
                  "company_id": {
                    "type": "string"
                  },
                  "company_name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "document_id": {
                    "type": "string"
                  },
                  "id": {
                    "type": "string"
                  },
                  "is_internal": {
                    "type": "boolean"
                  },
                  "user_contact": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "user_email": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "user_id": {
                    "type": "string"
                  }
                }
              }
            ]
          }
        }
      },
      "DocumentDetailResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "id",
                  "user_id",
                  "company_id",
                  "currency",
                  "people_id",
                  "document_type_id",
                  "template_id",
                  "document_status",
                  "document_number_sequence",
                  "document_number",
                  "document_issue_date",
                  "document_sub_total",
                  "document_total",
                  "document_net_balance",
                  "document_gross_total",
                  "document_exchange_rate",
                  "created_at",
                  "anchor_id",
                  "document_version_id",
                  "version_number",
                  "is_current",
                  "items",
                  "document_payment_method",
                  "document_attribute",
                  "document_adjustment",
                  "document_contact",
                  "document_payment",
                  "document_attachment",
                  "document_comment",
                  "document_status_history",
                  "version_history"
                ],
                "properties": {
                  "anchor_id": {
                    "type": "string"
                  },
                  "buyer_company_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "calculation": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/CalculatorResponse"
                      }
                    ]
                  },
                  "company_id": {
                    "type": "string"
                  },
                  "created_at": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "credited_document_id": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "description": "Credit notes: the invoice version this credits (that invoice's `id`)."
                  },
                  "currency": {
                    "type": "string"
                  },
                  "dimension_state": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/DimensionState"
                      }
                    ]
                  },
                  "document_address": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_adjustment": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DocumentAdjustmentModel"
                      }
                    },
                    "propertyNames": {
                      "type": "string"
                    }
                  },
                  "document_attachment": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DocumentAttachmentModel"
                    }
                  },
                  "document_attribute": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DocumentAttributeModel"
                    }
                  },
                  "document_comment": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DocumentCommentModel"
                    }
                  },
                  "document_contact": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DocumentContactModel"
                    }
                  },
                  "document_delivery_date": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "document_due_date": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "document_exchange_rate": {
                    "type": "string"
                  },
                  "document_gross_total": {
                    "type": "string"
                  },
                  "document_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_issue_date": {
                    "type": "string",
                    "format": "date"
                  },
                  "document_late_fee_amount": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_net_balance": {
                    "type": "string"
                  },
                  "document_notes": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_number": {
                    "type": "string"
                  },
                  "document_number_prefix": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_number_sequence": {
                    "type": "string"
                  },
                  "document_number_suffix": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_payment": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DocumentPayment"
                    }
                  },
                  "document_payment_method": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DocumentPaymentGatewayModel"
                    }
                  },
                  "document_po_number": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_schedule_date": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date"
                  },
                  "document_shipping_address": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_state": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "format": "int64"
                  },
                  "document_status": {
                    "type": "string"
                  },
                  "document_status_category": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_status_history": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DocumentStatusHistoryModel"
                    }
                  },
                  "document_status_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_sub_total": {
                    "type": "string"
                  },
                  "document_terms": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_title": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "document_total": {
                    "type": "string"
                  },
                  "document_type_id": {
                    "type": "string"
                  },
                  "document_version_id": {
                    "type": "string"
                  },
                  "id": {
                    "type": "string"
                  },
                  "is_current": {
                    "type": "boolean"
                  },
                  "is_partial_payment_allowed": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "is_recurring": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "items": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DocumentItem"
                    }
                  },
                  "late_fee_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "meta_data": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "min_payment_amount": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "payment_gateway_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "people_data": {
                    "description": "Client or vendor snapshot captured for the document; intentionally free-form JSON."
                  },
                  "people_id": {
                    "type": "string"
                  },
                  "people_name": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "recurring": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/DocumentRecurringModel"
                      }
                    ]
                  },
                  "recurring_document_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "seller_company_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "template_id": {
                    "type": "string"
                  },
                  "threshold_crossed_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "updated_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "user_id": {
                    "type": "string"
                  },
                  "version_history": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DocumentVersionModel"
                    }
                  },
                  "version_number": {
                    "type": "integer",
                    "format": "int32"
                  }
                }
              }
            ]
          }
        }
      },
      "DocumentListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "total_records",
                  "page_size",
                  "page_number",
                  "docs"
                ],
                "properties": {
                  "docs": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/DocModel"
                    }
                  },
                  "page_number": {
                    "type": "integer",
                    "format": "int64",
                    "minimum": 0
                  },
                  "page_size": {
                    "type": "integer",
                    "format": "int64",
                    "minimum": 0
                  },
                  "settlement_estimates": {
                    "type": [
                      "object",
                      "null"
                    ],
                    "additionalProperties": {
                      "$ref": "#/components/schemas/DocumentSettlementEstimate"
                    },
                    "propertyNames": {
                      "type": "string"
                    }
                  },
                  "total_records": {
                    "type": "integer",
                    "format": "int64",
                    "minimum": 0
                  }
                }
              }
            ]
          }
        }
      },
      "ItemDetailResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "type": "object",
                "required": [
                  "id",
                  "user_id",
                  "company_id",
                  "sku",
                  "item_name",
                  "item_quantity",
                  "item_cost",
                  "is_active",
                  "item_type",
                  "has_sales_price",
                  "sales_price",
                  "sales_currency",
                  "has_purchase_price",
                  "purchase_price",
                  "purchase_currency"
                ],
                "properties": {
                  "barcode": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "company_id": {
                    "type": "string"
                  },
                  "cost_for_client": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "created_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "deleted_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "dimension_state": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/DimensionState"
                      }
                    ]
                  },
                  "external_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "external_source": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "has_purchase_price": {
                    "type": "boolean"
                  },
                  "has_sales_price": {
                    "type": "boolean"
                  },
                  "id": {
                    "type": "string"
                  },
                  "is_active": {
                    "type": "boolean"
                  },
                  "item_attribute": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "$ref": "#/components/schemas/ItemAttModel"
                    }
                  },
                  "item_cost": {
                    "type": "string"
                  },
                  "item_description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "item_name": {
                    "type": "string"
                  },
                  "item_quantity": {
                    "type": "string"
                  },
                  "item_tax": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "item_type": {
                    "type": "string"
                  },
                  "item_unit": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "pricing": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/ItemPriceResult"
                      }
                    ]
                  },
                  "purchase_account_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "purchase_currency": {
                    "type": "string"
                  },
                  "purchase_description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "purchase_price": {
                    "type": "string"
                  },
                  "purchase_tax_ids": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    }
                  },
                  "sales_account_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "sales_currency": {
                    "type": "string"
                  },
                  "sales_description": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "sales_price": {
                    "type": "string"
                  },
                  "sales_tax_ids": {
                    "type": [
                      "array",
                      "null"
                    ],
                    "items": {
                      "type": "string"
                    }
                  },
                  "sku": {
                    "type": "string"
                  },
                  "updated_at": {
                    "type": [
                      "string",
                      "null"
                    ],
                    "format": "date-time"
                  },
                  "user_id": {
                    "type": "string"
                  }
                }
              }
            ]
          }
        }
      },
      "ReconciliationFormResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "company_id",
              "user_id",
              "banking_account_id",
              "start_date",
              "end_date",
              "closing_balance",
              "status",
              "created_at"
            ],
            "properties": {
              "banking_account_id": {
                "type": "string"
              },
              "calculated_balance": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "closing_balance": {
                "type": "string"
              },
              "company_id": {
                "type": "string"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "diff": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "end_date": {
                "type": "string",
                "format": "date"
              },
              "id": {
                "type": "string"
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "opening_balance": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "reconciled_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "start_date": {
                "type": "string",
                "format": "date"
              },
              "status": {
                "type": "string"
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "user_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "ReportHealthSummaryResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "as_of_date",
              "status",
              "checks_complete"
            ],
            "properties": {
              "as_of_date": {
                "type": "string",
                "format": "date"
              },
              "checks_complete": {
                "type": "boolean",
                "description": "False when the bounded scan has an unscanned tail."
              },
              "status": {
                "$ref": "#/components/schemas/ReportHealthStatus"
              }
            }
          }
        }
      },
      "ResendDeliveryResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "delivery_id",
              "event_id",
              "status",
              "attempt_number"
            ],
            "properties": {
              "attempt_number": {
                "type": "integer",
                "format": "int64"
              },
              "delivery_id": {
                "type": "string"
              },
              "event_id": {
                "type": "string"
              },
              "status": {
                "type": "string"
              }
            }
          }
        }
      },
      "RevealSecretResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "signing_secret"
            ],
            "properties": {
              "signing_secret": {
                "type": "string",
                "description": "Current endpoint signing secret. Never persisted in logs or client storage."
              }
            }
          }
        }
      },
      "SettlementPreviewResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "base_currency",
              "entity_id",
              "document_currency",
              "document_outstanding",
              "document_remaining",
              "rows"
            ],
            "properties": {
              "base_currency": {
                "type": "string"
              },
              "document_currency": {
                "type": "string"
              },
              "document_outstanding": {
                "type": "string"
              },
              "document_remaining": {
                "type": "string"
              },
              "entity_id": {
                "type": "string"
              },
              "rows": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SettlementPreviewRow"
                }
              }
            }
          }
        }
      },
      "SourcePostingAuditPageResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "entries",
              "as_of_date",
              "kind",
              "scanned_count"
            ],
            "properties": {
              "as_of_date": {
                "type": "string",
                "format": "date"
              },
              "entries": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SourcePostingGap"
                }
              },
              "kind": {
                "type": "string"
              },
              "next_before_date": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "next_before_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "scanned_count": {
                "type": "integer",
                "minimum": 0
              }
            }
          }
        }
      },
      "SourcePostingRepairPreviewResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "journals",
              "preview_token",
              "skipped_existing"
            ],
            "properties": {
              "journals": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/SourcePostingRepairJournal"
                }
              },
              "preview_token": {
                "type": "string",
                "description": "Hash of the planned journals; send this unchanged when executing the repair."
              },
              "skipped_existing": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "SourcePostingRepairResultResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "repaired",
              "journal_ids"
            ],
            "properties": {
              "journal_ids": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "repaired": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "StatusCategorizeResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "updated"
            ],
            "properties": {
              "updated": {
                "type": "integer",
                "format": "int64",
                "description": "How many statuses were given the category.",
                "minimum": 0
              }
            }
          }
        }
      },
      "TaxComponentListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "items",
              "has_more",
              "counts"
            ],
            "properties": {
              "counts": {
                "$ref": "#/components/schemas/TaxComponentCounts"
              },
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TaxComponentModel"
                }
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "TaxComponentResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "code",
              "name",
              "kind",
              "rate",
              "rates",
              "is_active",
              "tax_count",
              "created_at"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "country_code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "id": {
                "type": "string"
              },
              "is_active": {
                "type": "boolean"
              },
              "kind": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "rate": {
                "type": "string",
                "description": "The rate in force today (UTC)."
              },
              "rates": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TaxRatePeriodSharedModel"
                },
                "description": "Opening rate first, then by date."
              },
              "region": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tax_count": {
                "type": "integer",
                "format": "int64",
                "description": "Active taxes that use this component. Archiving is refused while\nthis is above zero.",
                "minimum": 0
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              }
            }
          }
        }
      },
      "TaxReportSubmitResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "description": "Submits the selected tax report with its reporting-period details.",
            "required": [
              "date_range",
              "report_key"
            ],
            "properties": {
              "date_range": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "report_key": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "TaxSubmissionResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "company_id",
              "user_id",
              "tax_report_id",
              "report_key",
              "report_label",
              "period_label",
              "period_start",
              "period_end",
              "payload",
              "status",
              "created_at"
            ],
            "properties": {
              "company_id": {
                "type": "string"
              },
              "created_at": {
                "type": "string",
                "format": "date-time"
              },
              "deleted_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "id": {
                "type": "string"
              },
              "is_archived": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "payload": {},
              "period_end": {
                "type": "string"
              },
              "period_label": {
                "type": "string"
              },
              "period_start": {
                "type": "string"
              },
              "report_key": {
                "type": "string"
              },
              "report_label": {
                "type": "string"
              },
              "retry_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "retry_count": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32"
              },
              "status": {
                "type": "string"
              },
              "tax_report_id": {
                "type": "string"
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "user_id": {
                "type": "string"
              }
            }
          }
        }
      },
      "TransactionDetailResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "banking_account_id",
              "date",
              "amount",
              "currency",
              "is_auto_matched",
              "is_ignored",
              "is_reconciled",
              "transaction_hash",
              "exchange_rate",
              "is_posted",
              "available_balance",
              "transaction_type",
              "mapping"
            ],
            "properties": {
              "amount": {
                "type": "string"
              },
              "available_balance": {
                "type": "string"
              },
              "banking_account_id": {
                "type": "string"
              },
              "company_bank_link_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "created_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "credit_account_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "currency": {
                "type": "string"
              },
              "date": {
                "type": "string",
                "format": "date"
              },
              "debit_account_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entity": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "entity_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "exchange_rate": {
                "type": "string"
              },
              "external_account_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "external_transaction_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "ignore_reason": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "is_auto_matched": {
                "type": "boolean"
              },
              "is_ignored": {
                "type": "boolean"
              },
              "is_posted": {
                "type": "boolean"
              },
              "is_reconciled": {
                "type": "boolean"
              },
              "mapping": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/BankingTransactionEntityMappingModel"
                }
              },
              "meta_data": {
                "$ref": "#/components/schemas/Value"
              },
              "transaction_hash": {
                "type": "string"
              },
              "transaction_identifier": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "transaction_type": {
                "type": "string"
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "user_id": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "TrialBalanceReportResponse": {
        "type": "object",
        "properties": {
          "data": {
            "allOf": [
              {
                "type": "object",
                "required": [
                  "trial_balance"
                ],
                "properties": {
                  "as_of_date": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "control_account_exceptions": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ControlAccountException"
                    }
                  },
                  "trial_balance": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/TrialBalanceEntry"
                    }
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "control_account_reconciliation"
                ],
                "properties": {
                  "control_account_reconciliation": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/ControlAccountReconciliation"
                    }
                  }
                }
              }
            ],
            "description": "Trial balance with the subledger reconciliation added by the report composer."
          }
        },
        "example": {
          "data": {
            "as_of_date": "2026-09-30",
            "control_account_exceptions": [],
            "control_account_reconciliation": [
              {
                "account_code": "account_receivable",
                "difference": "0.00",
                "is_reconciled": true,
                "ledger_balance": "0.00",
                "subledger_balance": "0.00",
                "tolerance": "0.00"
              },
              {
                "account_code": "account_payable",
                "difference": "0.00",
                "is_reconciled": true,
                "ledger_balance": "0.00",
                "subledger_balance": "0.00",
                "tolerance": "0.00"
              }
            ],
            "trial_balance": [
              {
                "account_code": "primaryOperatingAccount",
                "account_id": "00000000-0000-4000-8000-000000000001",
                "account_name": "Operating bank account",
                "account_number": "1000",
                "balance": "1250.00",
                "credit": "0.00",
                "debit": "1250.00",
                "is_system_defined": true
              },
              {
                "account_code": "salesRevenue",
                "account_id": "00000000-0000-4000-8000-000000000002",
                "account_name": "Sales revenue",
                "account_number": "4000",
                "balance": "-1250.00",
                "credit": "1250.00",
                "debit": "0.00",
                "is_system_defined": true
              }
            ]
          }
        }
      },
      "BankingAccountListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A chart-of-accounts entry with its UUID, account code, classification, currency, and hierarchy metadata.",
              "required": [
                "id",
                "account_code",
                "is_contra"
              ],
              "properties": {
                "account": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account_code": {
                  "type": "string"
                },
                "account_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account_subtype": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account_subtype_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "completed_reconciliation_count": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64"
                },
                "currency": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "draft_reconciliation_count": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64"
                },
                "excluded_count": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64"
                },
                "id": {
                  "type": "string"
                },
                "is_archived": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "is_contra": {
                  "type": "boolean"
                },
                "is_system_defined": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "kind": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "parent_account": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "parent_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "tag": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "uncategorized_count": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "format": "int64"
                }
              }
            }
          }
        }
      },
      "BankingAccountSubtypeListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "name",
                "account_type_id"
              ],
              "properties": {
                "account_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account_type_id": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "BankingAccountTypeListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "account_name"
              ],
              "properties": {
                "account_name": {
                  "type": "string"
                },
                "account_number": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "account_subtype": {
                  "type": [
                    "array",
                    "null"
                  ],
                  "items": {
                    "$ref": "#/components/schemas/BankingAccountSubtypeModel"
                  }
                },
                "id": {
                  "type": "string"
                },
                "total": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "DocumentCommentDeleteListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "comment_id"
              ],
              "properties": {
                "comment_id": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "DocumentCommentListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "document_id",
                "user_id",
                "company_id",
                "comment",
                "created_at",
                "is_internal"
              ],
              "properties": {
                "comment": {
                  "type": "string"
                },
                "company_id": {
                  "type": "string"
                },
                "company_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "document_id": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "is_internal": {
                  "type": "boolean"
                },
                "user_contact": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "user_email": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "user_id": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "WebhookEndpointListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "A registered webhook destination with its URL, enabled events, and delivery state.",
              "required": [
                "id",
                "url",
                "spec_version",
                "status",
                "enabled_events",
                "header_names",
                "created_at"
              ],
              "properties": {
                "created_at": {
                  "type": "string"
                },
                "description": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "enabled_events": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "header_names": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "Configured names only. Secret header values are never returned."
                },
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "spec_version": {
                  "type": "string"
                },
                "status": {
                  "type": "string"
                },
                "updated_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "url": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "JournalDetailListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "anchor_id",
                "version_number",
                "is_current",
                "identifier",
                "date",
                "description",
                "currency",
                "exchange_rate",
                "is_locked",
                "is_posted",
                "is_reversal",
                "is_voided",
                "is_manual",
                "created_at",
                "lines",
                "is_manual_override",
                "version_history"
              ],
              "properties": {
                "anchor_id": {
                  "type": "string",
                  "description": "Stable identity of the journal across versions. Use this for links and\nfor the anchor_id path parameter on GET, PUT, DELETE and void."
                },
                "created_at": {
                  "type": "string",
                  "format": "date-time"
                },
                "currency": {
                  "type": "string"
                },
                "date": {
                  "type": "string",
                  "format": "date"
                },
                "description": {
                  "type": "string"
                },
                "dimension_capture": {
                  "oneOf": [
                    {
                      "type": "null"
                    },
                    {
                      "$ref": "#/components/schemas/JournalDimensionCaptureState"
                    }
                  ]
                },
                "entity_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "entity_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "exchange_rate": {
                  "type": "string"
                },
                "id": {
                  "type": "string",
                  "description": "Id of this version row. Changes on every restatement; do not store it as\nthe journal's identity."
                },
                "identifier": {
                  "type": "string"
                },
                "is_current": {
                  "type": "boolean",
                  "description": "True on the version the books use. Exactly one version is current."
                },
                "is_locked": {
                  "type": "boolean"
                },
                "is_manual": {
                  "type": "boolean"
                },
                "is_manual_override": {
                  "type": "boolean"
                },
                "is_posted": {
                  "type": "boolean"
                },
                "is_reversal": {
                  "type": "boolean"
                },
                "is_voided": {
                  "type": "boolean"
                },
                "lines": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/JournalLineItem"
                  }
                },
                "meta_data": {
                  "description": "Free-form JSON; keys and values depend on the producing workflow."
                },
                "override_reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "prev_hash": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reference": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "related_entity_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "related_entity_type": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "reversal_of": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source_document_version_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "version_history": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/JournalVersionHistoryItem"
                  }
                },
                "version_number": {
                  "type": "integer",
                  "format": "int32",
                  "description": "1 for the original posting, +1 per restatement or void."
                }
              }
            }
          }
        }
      },
      "LateFeeDbListResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "user_id",
                "company_id",
                "label",
                "rate",
                "calc_type",
                "is_active",
                "term",
                "calc_base"
              ],
              "properties": {
                "calc_base": {
                  "type": "string"
                },
                "calc_type": {
                  "type": "string"
                },
                "company_id": {
                  "type": "string"
                },
                "created_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "deleted_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "id": {
                  "type": "string"
                },
                "is_active": {
                  "type": "boolean"
                },
                "label": {
                  "type": "string"
                },
                "rate": {
                  "type": "string"
                },
                "term": {
                  "type": "integer",
                  "format": "int64"
                },
                "updated_at": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "user_id": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "LedgerEffectOptionListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "description": "One selectable ledger effect for a workflow status. The list covers every\nsupported effect. `label` and `description` are translation keys\n(`ledger_effect.{value}.label`), not display copy: clients translate them.",
              "required": [
                "value",
                "label",
                "description"
              ],
              "properties": {
                "description": {
                  "type": "string",
                  "description": "i18n key, e.g. `ledger_effect.post.description`."
                },
                "label": {
                  "type": "string",
                  "description": "i18n key, e.g. `ledger_effect.post.label`."
                },
                "value": {
                  "$ref": "#/components/schemas/LedgerEffect"
                }
              }
            }
          }
        }
      },
      "PermissionListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "TransitionListResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "document_type_id",
                "from_state",
                "to_state",
                "ledger_effect"
              ],
              "properties": {
                "document_type_id": {
                  "type": "string"
                },
                "from_state": {
                  "type": "string"
                },
                "id": {
                  "type": "string"
                },
                "is_manual_allowed": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "is_user_defined": {
                  "type": [
                    "boolean",
                    "null"
                  ]
                },
                "ledger_effect": {
                  "type": "string"
                },
                "to_state": {
                  "type": "string"
                },
                "transition_name": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "transition_note": {
                  "type": [
                    "string",
                    "null"
                  ]
                }
              }
            }
          }
        }
      },
      "VerifyEndpointResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "verified",
              "status"
            ],
            "properties": {
              "status": {
                "type": "string"
              },
              "verified": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "AffectedCountResponse": {
        "type": "object",
        "description": "Successful response envelope. Read the operation result from `data`; list metadata belongs inside that result.",
        "properties": {
          "data": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "AppConnectTokenModel": {
        "type": "object",
        "description": "An OAuth token response returned directly at the top level. Read `access_token` and `expires_in` without a `data` envelope.",
        "required": [
          "access_token",
          "token_type",
          "expires_in",
          "scope",
          "expires_at",
          "client_id",
          "app_connect_id",
          "company_id",
          "actor_user_id",
          "permissions"
        ],
        "properties": {
          "access_token": {
            "type": "string"
          },
          "actor_user_id": {
            "type": "string"
          },
          "app_connect_id": {
            "type": "string"
          },
          "client_id": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "expires_in": {
            "type": "integer",
            "format": "int64"
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "refresh_token": {
            "type": [
              "string",
              "null"
            ]
          },
          "scope": {
            "type": "string"
          },
          "token_type": {
            "type": "string"
          }
        }
      },
      "AppConnectTokenValidationModel": {
        "type": "object",
        "description": "The identity and access information obtained when validating an App Connect token.",
        "required": [
          "active",
          "client_id",
          "app_connect_id",
          "company_id",
          "actor_user_id",
          "expires_at",
          "permissions"
        ],
        "properties": {
          "active": {
            "type": "boolean"
          },
          "actor_user_id": {
            "type": "string"
          },
          "app_connect_id": {
            "type": "string"
          },
          "client_id": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "execution_context_token": {
            "type": [
              "string",
              "null"
            ],
            "description": "Opaque credential for authorized service callbacks. When absent,\ncallback access is unavailable for the session."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time"
          },
          "partner_domain": {
            "type": [
              "string",
              "null"
            ]
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "AppConnectTokenValidationResponseModel": {
        "type": "object",
        "description": "The result of validating an App Connect token.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/AppConnectTokenValidationModel"
          }
        }
      },
      "ApplyCreditFromModel": {
        "type": "object",
        "description": "Applies an available credit balance to a document. Document and credit IDs must belong to the authenticated company.",
        "required": [
          "credits"
        ],
        "properties": {
          "anchor_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "credits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreditNoteFromModel"
            }
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ApplyCreditFromResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentPaymentModel"
            }
          }
        }
      },
      "AttachmentModel": {
        "type": "object",
        "description": "An attached file's reference and metadata. File upload and attachment association are separate operations.",
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the record."
          }
        }
      },
      "AttributeModel": {
        "type": "object",
        "description": "A custom attribute's key and assigned value.",
        "required": [
          "attribute_label",
          "attribute_value"
        ],
        "properties": {
          "attribute_label": {
            "type": "string",
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": "string",
            "description": "Custom field value."
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the record."
          }
        }
      },
      "AuthenticatedActionChallengeForm": {
        "type": "object",
        "description": "Requests a confirmation challenge for an action in the authenticated session.",
        "required": [
          "confirmation_method",
          "confirmation_code",
          "confirmation_context"
        ],
        "properties": {
          "confirmation_code": {
            "type": "string"
          },
          "confirmation_context": {
            "type": "string"
          },
          "confirmation_entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "confirmation_method": {
            "$ref": "#/components/schemas/ActionConfirmationMethod"
          }
        }
      },
      "AuthenticatedEmailConfirmationCodeRequest": {
        "type": "object",
        "description": "Requests an email confirmation code for the signed-in user.",
        "required": [
          "confirmation_context"
        ],
        "properties": {
          "confirmation_context": {
            "type": "string"
          },
          "confirmation_entity_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "AvailableBalanceResult": {
        "type": "object",
        "required": [
          "account_id",
          "available_balance",
          "currency",
          "as_of_date"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "as_of_date": {
            "type": "string",
            "format": "date"
          },
          "available_balance": {
            "type": "string",
            "description": "Part of the bank transaction not yet allocated, as a decimal string."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          }
        }
      },
      "BankSettlement": {
        "type": "object",
        "description": "Confirmed bank-side amounts. Only the banking participant supplies this data;\nclients confirm through the bank matching contract, never the payment form.",
        "required": [
          "amount",
          "currency",
          "exchange_rate",
          "bank_charge",
          "conversion_rate"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          },
          "bank_charge": {
            "type": "string",
            "description": "Bank fee withheld from the payment, as a decimal string. The payment amount plus this charge is applied to the document."
          },
          "conversion_rate": {
            "type": "string",
            "description": "Bank currency per unit of document currency."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "exchange_rate": {
            "type": "string",
            "description": "Bank currency to company base currency."
          }
        }
      },
      "BankingAccountFormModel": {
        "type": "object",
        "description": "Creates or updates a chart-of-accounts entry. Use a subtype UUID; supply a parent account when creating a sub-account.",
        "required": [
          "account_subtype",
          "account",
          "currency",
          "is_sub_account"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank account number, when the account is a bank account."
          },
          "account_subtype": {
            "type": "string",
            "description": "ID of the account subtype (from the account subtype list), not its name."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_archived": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the record is archived."
          },
          "is_contra": {
            "type": "boolean"
          },
          "is_sub_account": {
            "type": "boolean"
          },
          "kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "parent_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "tag": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          }
        },
        "example": {
          "account": "Payments Clearing",
          "account_subtype": "00000000-0000-4000-8000-000000000003",
          "currency": "USD",
          "is_sub_account": false
        }
      },
      "BankingAccountModel": {
        "type": "object",
        "description": "A chart-of-accounts entry with its UUID, account code, classification, currency, and hierarchy metadata.",
        "required": [
          "id",
          "account_code",
          "is_contra"
        ],
        "properties": {
          "account": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_code": {
            "type": "string",
            "description": "Account code in the chart of accounts."
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank account number, when the account is a bank account."
          },
          "account_subtype": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account subtype within its classification."
          },
          "account_subtype_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account classification: `asset`, `liability`, `equity`, `revenue` or `expense`."
          },
          "completed_reconciliation_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "draft_reconciliation_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "excluded_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_archived": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the record is archived."
          },
          "is_contra": {
            "type": "boolean"
          },
          "is_system_defined": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Set by the system or a connected integration; read-only."
          },
          "kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "parent_account": {
            "type": [
              "string",
              "null"
            ]
          },
          "parent_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "tag": {
            "type": [
              "string",
              "null"
            ]
          },
          "uncategorized_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "BankingAccountNewModel": {
        "type": "object",
        "description": "A chart-of-accounts entry used in the account hierarchy response.",
        "required": [
          "id",
          "account_code",
          "account_name",
          "is_archived",
          "is_system_defined",
          "is_contra"
        ],
        "properties": {
          "account_code": {
            "type": "string",
            "description": "Account code in the chart of accounts."
          },
          "account_kind": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_name": {
            "type": "string",
            "description": "Account name in the chart of accounts."
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank account number, when the account is a bank account."
          },
          "account_subtype_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "balance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string in the record's currency."
          },
          "child_account": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/BankingAccountNewModel"
            }
          },
          "credit": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "debit": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_archived": {
            "type": "boolean",
            "description": "Whether the record is archived."
          },
          "is_contra": {
            "type": "boolean"
          },
          "is_system_defined": {
            "type": "boolean",
            "description": "Set by the system or a connected integration; read-only."
          },
          "parent_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_count": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          }
        }
      },
      "BankingAccountSubtypeFormModel": {
        "type": "object",
        "description": "Creates or updates an account subtype within the chart of accounts.",
        "required": [
          "name",
          "type_id"
        ],
        "properties": {
          "account_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank account number, when the account is a bank account."
          },
          "is_archived": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the record is archived."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "type_id": {
            "type": "string"
          }
        }
      },
      "BankingAccountSubtypeModel": {
        "type": "object",
        "description": "An account classification subtype and the accounts grouped beneath it.",
        "required": [
          "id",
          "account_name"
        ],
        "properties": {
          "account": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/BankingAccountNewModel"
            }
          },
          "account_name": {
            "type": "string",
            "description": "Account name in the chart of accounts."
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank account number, when the account is a bank account."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "total": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string in the record's currency."
          }
        }
      },
      "BankingAccountTypeModel": {
        "type": "object",
        "required": [
          "id",
          "account_name"
        ],
        "properties": {
          "account_name": {
            "type": "string",
            "description": "Account name in the chart of accounts."
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank account number, when the account is a bank account."
          },
          "account_subtype": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/BankingAccountSubtypeModel"
            }
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "total": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string in the record's currency."
          }
        }
      },
      "BankingJournalDeleteModel": {
        "type": "object",
        "required": [
          "journal_id",
          "identifier"
        ],
        "properties": {
          "identifier": {
            "type": "string"
          },
          "journal_id": {
            "type": "string"
          }
        }
      },
      "BankingJournalFormModel": {
        "type": "object",
        "description": "A balanced journal in the company ledger. Supply at least two lines using account IDs from\nthe chart of accounts. Tenant and actor identity come from authentication.",
        "required": [
          "description",
          "date",
          "currency",
          "lines"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "date": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Units of base currency per unit of `currency`. Optional when `currency` is the company's\nbase currency (defaults to 1); required for any other currency."
          },
          "is_manual": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JournalLineModel"
            },
            "description": "At least two lines whose total debits equal total credits.",
            "minItems": 2
          },
          "meta_data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/JournalEntryMetadata"
              }
            ]
          },
          "override": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "override_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "posted": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "reversal_of": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_version_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "version_number": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Version of the record, increased by every saved edit."
          }
        },
        "example": {
          "currency": "USD",
          "date": "2026-10-15",
          "description": "Revenue received",
          "lines": [
            {
              "account_id": "00000000-0000-4000-8000-000000000001",
              "debit": "100.00",
              "description": "Cash received"
            },
            {
              "account_id": "00000000-0000-4000-8000-000000000002",
              "credit": "100.00",
              "description": "Revenue earned"
            }
          ],
          "posted": true
        }
      },
      "BankingJournalHeaderModel": {
        "type": "object",
        "description": "The stored header for one journal version. Use `anchor_id` as the journal's stable external identity.",
        "required": [
          "id",
          "anchor_id",
          "version_number",
          "is_current",
          "user_id",
          "company_id",
          "date",
          "currency",
          "transaction_hash",
          "exchange_rate",
          "is_locked",
          "created_at",
          "is_voided",
          "is_reversal",
          "is_manual",
          "identifier",
          "is_manual_override",
          "is_posted"
        ],
        "properties": {
          "anchor_id": {
            "type": "string",
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "dimension_capture": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/JournalDimensionCaptureState"
              }
            ]
          },
          "exchange_rate": {
            "type": "string",
            "description": "Decimal string: one unit of this record's currency equals `exchange_rate` units of the company base currency. `1` when the record is in the base currency."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "identifier": {
            "type": "string"
          },
          "is_current": {
            "type": "boolean"
          },
          "is_deleted": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "is_locked": {
            "type": "boolean"
          },
          "is_manual": {
            "type": "boolean"
          },
          "is_manual_override": {
            "type": "boolean"
          },
          "is_posted": {
            "type": "boolean"
          },
          "is_reversal": {
            "type": "boolean"
          },
          "is_voided": {
            "type": "boolean"
          },
          "meta_data": {
            "$ref": "#/components/schemas/Value"
          },
          "override_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "prev_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "related_entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "related_entity_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "reversal_of": {
            "type": [
              "string",
              "null"
            ]
          },
          "root_entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "root_entity_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_version_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_hash": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          },
          "version_number": {
            "type": "integer",
            "format": "int32",
            "description": "Version of the record, increased by every saved edit."
          }
        }
      },
      "BankingJournalModel": {
        "type": "object",
        "description": "A journal version with posting status, monetary context, and audit metadata.",
        "required": [
          "id",
          "anchor_id",
          "date",
          "currency",
          "created_at",
          "is_locked",
          "is_posted",
          "is_voided",
          "is_reversal",
          "is_manual",
          "is_repaired",
          "identifier"
        ],
        "properties": {
          "account": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "account_subtype": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account subtype within its classification."
          },
          "account_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account classification: `asset`, `liability`, `equity`, `revenue` or `expense`."
          },
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string in the record's currency."
          },
          "anchor_id": {
            "type": "string",
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "banking_account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "base_currency_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Amount converted to the company base currency, as a decimal string."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string: one unit of this record's currency equals `exchange_rate` units of the company base currency. `1` when the record is in the base currency."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "identifier": {
            "type": "string"
          },
          "is_deleted": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "is_locked": {
            "type": "boolean"
          },
          "is_manual": {
            "type": "boolean"
          },
          "is_manual_override": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "is_posted": {
            "type": "boolean"
          },
          "is_repaired": {
            "type": "boolean",
            "description": "True when this journal was created by the posting-repair tool."
          },
          "is_reversal": {
            "type": "boolean"
          },
          "is_voided": {
            "type": "boolean"
          },
          "lines": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/JournalLineItem"
            }
          },
          "override_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "root_entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "root_entity_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_credit_bcy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Total credits in the company base currency, as a decimal string."
          },
          "total_credit_fcy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Total credits in the transaction currency, as a decimal string."
          },
          "total_debit_bcy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Total debits in the company base currency, as a decimal string."
          },
          "total_debit_fcy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Total debits in the transaction currency, as a decimal string."
          },
          "type": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "BankingMatchEngineBoostConfig": {
        "type": "object",
        "properties": {
          "amount_aligned": {
            "type": "integer",
            "format": "int32",
            "default": 8
          },
          "counterparty_linked": {
            "type": "integer",
            "format": "int32",
            "default": 3
          },
          "currency_aligned": {
            "type": "integer",
            "format": "int32",
            "default": 4
          },
          "date_aligned": {
            "type": "integer",
            "format": "int32",
            "default": 5
          },
          "description_aligned": {
            "type": "integer",
            "format": "int32",
            "default": 6
          },
          "grouped_selection": {
            "type": "integer",
            "format": "int32",
            "default": 2
          },
          "reference_aligned": {
            "type": "integer",
            "format": "int32",
            "default": 8
          },
          "reference_present": {
            "type": "integer",
            "format": "int32",
            "default": 4
          }
        }
      },
      "BankingMatchEngineConfig": {
        "type": "object",
        "properties": {
          "ai_ready": {
            "type": "boolean",
            "default": true
          },
          "boosts": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BankingMatchEngineBoostConfig"
              }
            ],
            "default": {
              "amount_aligned": 8,
              "counterparty_linked": 3,
              "currency_aligned": 4,
              "date_aligned": 5,
              "description_aligned": 6,
              "grouped_selection": 2,
              "reference_aligned": 8,
              "reference_present": 4
            }
          },
          "profile": {
            "type": "string",
            "default": "balanced"
          },
          "signals": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BankingMatchEngineSignalConfig"
              }
            ],
            "default": {
              "amount_aligned": true,
              "counterparty_linked": true,
              "currency_aligned": true,
              "date_aligned": true,
              "description_aligned": true,
              "grouped_selection": true,
              "reference_aligned": true,
              "reference_present": true
            }
          },
          "thresholds": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/BankingMatchEngineThresholdConfig"
              }
            ],
            "default": {
              "amount_tolerance_bps": 250,
              "amount_tolerance_cap_cents": 50,
              "amount_tolerance_floor_cents": 10,
              "base_score_high_confidence_min": 80,
              "date_window_days": 3,
              "description_overlap_pct": 20,
              "refined_score_high_confidence_min": 85,
              "refined_score_medium_confidence_min": 60
            }
          }
        }
      },
      "BankingMatchEngineSignalConfig": {
        "type": "object",
        "properties": {
          "amount_aligned": {
            "type": "boolean",
            "default": true
          },
          "counterparty_linked": {
            "type": "boolean",
            "default": true
          },
          "currency_aligned": {
            "type": "boolean",
            "default": true
          },
          "date_aligned": {
            "type": "boolean",
            "default": true
          },
          "description_aligned": {
            "type": "boolean",
            "default": true
          },
          "grouped_selection": {
            "type": "boolean",
            "default": true
          },
          "reference_aligned": {
            "type": "boolean",
            "default": true
          },
          "reference_present": {
            "type": "boolean",
            "default": true
          }
        }
      },
      "BankingMatchEngineThresholdConfig": {
        "type": "object",
        "properties": {
          "amount_tolerance_bps": {
            "type": "integer",
            "format": "int32",
            "default": 250,
            "minimum": 0
          },
          "amount_tolerance_cap_cents": {
            "type": "integer",
            "format": "int64",
            "default": 50
          },
          "amount_tolerance_floor_cents": {
            "type": "integer",
            "format": "int64",
            "default": 10
          },
          "base_score_high_confidence_min": {
            "type": "integer",
            "format": "int32",
            "default": 80,
            "minimum": 0
          },
          "date_window_days": {
            "type": "integer",
            "format": "int64",
            "default": 3
          },
          "description_overlap_pct": {
            "type": "integer",
            "format": "int32",
            "default": 20,
            "minimum": 0
          },
          "refined_score_high_confidence_min": {
            "type": "integer",
            "format": "int32",
            "default": 85,
            "minimum": 0
          },
          "refined_score_medium_confidence_min": {
            "type": "integer",
            "format": "int32",
            "default": 60,
            "minimum": 0
          }
        }
      },
      "BankingMatchPolicyModel": {
        "type": "object",
        "required": [
          "id",
          "policy_name",
          "is_default",
          "is_active",
          "is_system",
          "ai_ready",
          "config"
        ],
        "properties": {
          "ai_ready": {
            "type": "boolean"
          },
          "config": {
            "$ref": "#/components/schemas/BankingMatchEngineConfig"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "is_default": {
            "type": "boolean"
          },
          "is_system": {
            "type": "boolean"
          },
          "label_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "policy_name": {
            "type": "string"
          }
        }
      },
      "BankingMatchPolicySettingFormModel": {
        "type": "object",
        "description": "Updates the company's bank-matching policy settings and matching configuration.",
        "required": [
          "default_policy_id"
        ],
        "properties": {
          "default_policy_id": {
            "type": "string"
          }
        }
      },
      "BankingReconciliationAttachmentModel": {
        "type": "object",
        "required": [
          "id",
          "attachment_name",
          "attachment_type",
          "attachment_size",
          "attachment_url",
          "created_at"
        ],
        "properties": {
          "attachment_name": {
            "type": "string"
          },
          "attachment_size": {
            "type": "integer",
            "format": "int32"
          },
          "attachment_type": {
            "type": "string"
          },
          "attachment_url": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          }
        }
      },
      "BankingReconciliationLineModel": {
        "type": "object",
        "required": [
          "id",
          "reconciliation_id",
          "journal_id",
          "journal_line_id",
          "is_reconciled"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_reconciled": {
            "type": "boolean"
          },
          "journal_id": {
            "type": "string"
          },
          "journal_line_id": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text note."
          },
          "reconciliation_id": {
            "type": "string"
          }
        }
      },
      "BankingReconciliationModel": {
        "type": "object",
        "required": [
          "id",
          "user_id",
          "banking_account_id",
          "start_date",
          "end_date",
          "closing_balance",
          "status",
          "created_at",
          "lines",
          "attachments"
        ],
        "properties": {
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BankingReconciliationAttachmentModel"
            }
          },
          "banking_account_id": {
            "type": "string",
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "calculated_balance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Book balance calculated for the period, as a decimal string."
          },
          "closing_balance": {
            "type": "string",
            "description": "Balance at the end of the period, as a decimal string."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "diff": {
            "type": [
              "string",
              "null"
            ]
          },
          "end_date": {
            "type": "string",
            "format": "date",
            "description": "End date (`YYYY-MM-DD`), inclusive; null when open-ended."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BankingReconciliationLineModel"
            }
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text note."
          },
          "opening_balance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Balance at the start of the period, as a decimal string."
          },
          "reconciled_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "description": "Start date (`YYYY-MM-DD`), inclusive."
          },
          "status": {
            "type": "string",
            "description": "`draft`, `completed` or `voided`."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "BankingTransactionEntityMappingModel": {
        "type": "object",
        "required": [
          "id",
          "banking_transaction_id",
          "entity_type",
          "allocated_amount",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "allocated_amount": {
            "type": "string",
            "description": "Amount allocated to the linked record, as a decimal string."
          },
          "allocated_amount_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "banking_transaction_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "entity_type": {
            "type": "string"
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string: one unit of this record's currency equals `exchange_rate` units of the company base currency. `1` when the record is in the base currency."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          }
        }
      },
      "BankingTransactionModel": {
        "type": "object",
        "required": [
          "id",
          "exchange_rate",
          "banking_account_id",
          "description",
          "amount",
          "transaction_type",
          "available_balance",
          "date"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          },
          "available_balance": {
            "type": "string",
            "description": "Part of the bank transaction not yet allocated, as a decimal string."
          },
          "banking_account_id": {
            "type": "string",
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "company_bank_link_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "debit_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": "string"
          },
          "exchange_rate": {
            "type": "string",
            "description": "Decimal string: one unit of this record's currency equals `exchange_rate` units of the company base currency. `1` when the record is in the base currency."
          },
          "external_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_transaction_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_auto_matched": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "is_ignored": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "is_reconciled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "matches": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/MatchModel"
            }
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_identifier": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_type": {
            "type": "string"
          }
        }
      },
      "BulkFullPaymentFromModel": {
        "type": "object",
        "description": "Records full payments for selected documents sharing a payment mode, date, and deposit account.",
        "required": [
          "document_ids",
          "payment_mode",
          "payment_date",
          "deposit_account",
          "reference_note"
        ],
        "properties": {
          "deposit_account": {
            "type": "string"
          },
          "document_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "payment_date": {
            "type": "string",
            "description": "Date the payment was made (`YYYY-MM-DD`)."
          },
          "payment_mode": {
            "type": "string"
          },
          "reference_context": {
            "type": [
              "string",
              "null"
            ],
            "description": "Controls generated references:\n- \"bulk\" => {document_number}-BULK-PAY-001\n- \"import\" => {document_number}-IMP-PAY-001"
          },
          "reference_note": {
            "type": "string"
          }
        }
      },
      "BulkFullPaymentResponseModel": {
        "type": "object",
        "required": [
          "success",
          "message",
          "paid_count",
          "skipped_count",
          "failed_count",
          "paid",
          "skipped",
          "failed"
        ],
        "properties": {
          "failed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BulkFullPaymentRowError"
            }
          },
          "failed_count": {
            "type": "integer",
            "format": "int64"
          },
          "message": {
            "type": "string"
          },
          "paid": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BulkFullPaymentRowResult"
            }
          },
          "paid_count": {
            "type": "integer",
            "format": "int64"
          },
          "skipped": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BulkFullPaymentRowResult"
            }
          },
          "skipped_count": {
            "type": "integer",
            "format": "int64"
          },
          "success": {
            "type": "boolean"
          }
        }
      },
      "BulkFullPaymentRowError": {
        "type": "object",
        "required": [
          "document_id",
          "error"
        ],
        "properties": {
          "document_id": {
            "type": "string"
          },
          "error": {
            "type": "string"
          }
        }
      },
      "BulkFullPaymentRowResult": {
        "type": "object",
        "required": [
          "document_id",
          "document_number",
          "reference_number"
        ],
        "properties": {
          "document_id": {
            "type": "string"
          },
          "document_number": {
            "type": "string"
          },
          "reference_number": {
            "type": "string",
            "description": "Your reference for the record, for example a PO or receipt number."
          }
        }
      },
      "BulkTransitionFromModel": {
        "type": "object",
        "description": "Requests the same workflow transition for multiple selected documents.",
        "required": [
          "document_ids",
          "to_state",
          "reason"
        ],
        "properties": {
          "document_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "reason": {
            "type": "string"
          },
          "to_state": {
            "type": "string",
            "description": "Key of the status to move every listed document to, from this module's status settings."
          }
        }
      },
      "BulkTransitionResponseModel": {
        "type": "object",
        "required": [
          "success",
          "message",
          "transitioned_count",
          "failed_count",
          "transitioned",
          "failed"
        ],
        "properties": {
          "failed": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BulkTransitionRowError"
            }
          },
          "failed_count": {
            "type": "integer",
            "format": "int64"
          },
          "message": {
            "type": "string"
          },
          "success": {
            "type": "boolean"
          },
          "transitioned": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BulkTransitionRowResult"
            }
          },
          "transitioned_count": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "BulkTransitionRowError": {
        "type": "object",
        "required": [
          "document_id",
          "error"
        ],
        "properties": {
          "document_id": {
            "type": "string"
          },
          "error": {
            "type": "string"
          }
        }
      },
      "BulkTransitionRowResult": {
        "type": "object",
        "required": [
          "document_id",
          "to_state"
        ],
        "properties": {
          "document_id": {
            "type": "string"
          },
          "to_state": {
            "type": "string",
            "description": "Status key the document was moved to."
          }
        }
      },
      "CalcDocAdjustmentData": {
        "type": "object",
        "required": [
          "adjustment_description"
        ],
        "properties": {
          "adjustable_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjusted_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjustment_calc_base": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjustment_calc_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjustment_description": {
            "type": "string"
          },
          "adjustment_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjustment_type": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CalcItemAdjustmentData": {
        "type": "object",
        "properties": {
          "adjustable_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjusted_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "attribute_calc_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "attribute_cost": {
            "type": [
              "string",
              "null"
            ]
          },
          "attribute_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "attribute_label": {
            "type": [
              "string",
              "null"
            ],
            "description": "Custom field name."
          },
          "attribute_type": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CalcTaxData": {
        "type": "object",
        "required": [
          "tax_id",
          "item_tax_name",
          "item_tax_display_label",
          "item_tax_rate",
          "item_tax_type",
          "item_taxable_amount",
          "item_tax_amount"
        ],
        "properties": {
          "is_recoverable": {
            "type": "boolean",
            "description": "The tax's recoverability when the document was calculated, saved on\nthe item tax row so posting never reads current tax settings."
          },
          "item_tax_amount": {
            "type": "string",
            "description": "Tax on the line for this tax, as a decimal string."
          },
          "item_tax_display_label": {
            "type": "string"
          },
          "item_tax_name": {
            "type": "string"
          },
          "item_tax_rate": {
            "type": "string",
            "description": "Tax rate in percent, as a decimal string."
          },
          "item_tax_type": {
            "type": "string"
          },
          "item_taxable_amount": {
            "type": "string",
            "description": "Amount the tax is calculated on, as a decimal string."
          },
          "tax_id": {
            "type": "string"
          }
        }
      },
      "CalculatorResponse": {
        "type": "object",
        "required": [
          "currency",
          "item_row_total",
          "sub_total",
          "calc_tax_data",
          "total_tax",
          "tax_summary",
          "total",
          "doc_adjustment_data",
          "total_adjustment",
          "grand_total",
          "outstanding_amount",
          "calc_item_attributes"
        ],
        "properties": {
          "amount_received": {
            "type": [
              "string",
              "null"
            ]
          },
          "amount_received_withheld": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_charge": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank fee withheld from the payment, as a decimal string. The payment amount plus this charge is applied to the document."
          },
          "calc_item_attributes": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/CalcItemAdjustmentData"
              }
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "calc_tax_data": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "additionalProperties": {
                "$ref": "#/components/schemas/CalcTaxData"
              },
              "propertyNames": {
                "type": "string"
              }
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "doc_adjustment_data": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/CalcDocAdjustmentData"
              }
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "grand_total": {
            "type": "string",
            "description": "Amount due: sub-total plus tax plus document-level adjustments. Decimal string."
          },
          "item_row_total": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "late_fee_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "outstanding_amount": {
            "type": "string",
            "description": "Amount still due after amounts received. Decimal string."
          },
          "sub_total": {
            "type": "string",
            "description": "Sum of line totals before tax and document-level adjustments. Decimal string."
          },
          "tax_summary": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/TaxSummary"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "total": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          },
          "total_adjustment": {
            "type": "string",
            "description": "Net of the document-level adjustments. Decimal string."
          },
          "total_amount_received": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_tax": {
            "type": "string",
            "description": "Tax across all lines. Decimal string."
          }
        }
      },
      "CardData": {
        "type": "object",
        "required": [
          "key",
          "count",
          "sum_by_currency",
          "sum_in_base_currency"
        ],
        "properties": {
          "count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "key": {
            "type": "string"
          },
          "sum_by_currency": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "sum_in_base_currency": {
            "type": "string"
          },
          "user_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CashFlowSummary": {
        "type": "object",
        "required": [
          "opening_cash",
          "cash_inflow",
          "cash_outflow",
          "net_cash_flow",
          "closing_cash",
          "transaction_count"
        ],
        "properties": {
          "cash_inflow": {
            "type": "string"
          },
          "cash_outflow": {
            "type": "string"
          },
          "closing_cash": {
            "type": "string"
          },
          "net_cash_flow": {
            "type": "string"
          },
          "opening_cash": {
            "type": "string"
          },
          "transaction_count": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "CompanyAttr": {
        "type": "object",
        "description": "A company-specific custom attribute value.",
        "required": [
          "attribute_label",
          "attribute_value"
        ],
        "properties": {
          "attribute_label": {
            "type": "string",
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": "string",
            "description": "Custom field value."
          }
        }
      },
      "CompanyAttributeDbModel": {
        "type": "object",
        "description": "A stored company attribute definition and its metadata.",
        "required": [
          "id",
          "company_id",
          "attribute_label",
          "attribute_value",
          "created_at",
          "is_system_defined"
        ],
        "properties": {
          "attribute_label": {
            "type": "string",
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": "string",
            "description": "Custom field value."
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_system_defined": {
            "type": "boolean",
            "description": "Set by the system or a connected integration; read-only."
          }
        }
      },
      "CompanyBankAccountDbModel": {
        "type": "object",
        "description": "Stored bank details associated with a company.",
        "required": [
          "id",
          "company_id",
          "currency_id",
          "bank_account_detail",
          "bank_account_label",
          "is_active",
          "created_at",
          "updated_by"
        ],
        "properties": {
          "bank_account_detail": {
            "type": "string"
          },
          "bank_account_label": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency_id": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "updated_by": {
            "type": "string",
            "description": "User who last changed the record."
          }
        }
      },
      "CompanyBankDetailResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CompanyBankAccountDbModel"
              }
            ]
          }
        }
      },
      "CompanyBankFormModel": {
        "type": "object",
        "description": "Creates or updates bank details associated with the company.",
        "required": [
          "currency_id",
          "bank_account_detail",
          "bank_account_label"
        ],
        "properties": {
          "bank_account_detail": {
            "type": "string"
          },
          "bank_account_label": {
            "type": "string"
          },
          "currency_id": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "is_active": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the record is active."
          }
        }
      },
      "CompanyBankListModel": {
        "type": "object",
        "required": [
          "total_records",
          "page_size",
          "page_number",
          "bank_accounts"
        ],
        "properties": {
          "bank_accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyBankAccountDbModel"
            }
          },
          "page_number": {
            "type": "integer",
            "format": "int64",
            "description": "Page returned, 1-based.",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "description": "Records per page in this response.",
            "minimum": 0
          },
          "total_records": {
            "type": "integer",
            "format": "int64",
            "description": "Records matching the filters, across all pages.",
            "minimum": 0
          }
        }
      },
      "CompanyBankListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CompanyBankListModel"
              }
            ]
          }
        }
      },
      "CompanyCompanyStatusUpdateFormModel": {
        "type": "object",
        "description": "Changes the company's configured status.",
        "required": [
          "status"
        ],
        "properties": {
          "status": {
            "type": "string"
          }
        }
      },
      "CompanyConnection": {
        "type": "object",
        "description": "The current relationship between a sending and receiving company.",
        "required": [
          "id",
          "sender_company_id",
          "receiver_company_id",
          "status"
        ],
        "properties": {
          "accepted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "receiver_company_id": {
            "type": "string"
          },
          "rejected_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "sender_company_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "`pending`, `accepted` or `rejected`."
          }
        }
      },
      "CompanyCurrencyAddForm": {
        "type": "object",
        "description": "Additive currency save: appends the given currencies, leaving existing ones (and their\nids) untouched. Unlike `CompanyCurrencyFormModel` this is not a replace-all payload and\ncarries no `company_id` — the tenant is taken from the authenticated context. Each entry\nis validated independently; problems are reported per index (`currency_<i>_code`): an\nunknown ISO code is `INVALID_VALUE`, an already-configured one `CURRENCY_ALREADY_ADDED`,\nand a code repeated within the request `DUPLICATE_VALUE`.",
        "required": [
          "currency"
        ],
        "properties": {
          "currency": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CurrencyCode"
            }
          }
        }
      },
      "CompanyCurrencyDeleteResponseModel": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          }
        }
      },
      "CompanyCurrencyFormModel": {
        "type": "object",
        "description": "Configures a currency available to the company.",
        "required": [
          "currency"
        ],
        "properties": {
          "currency": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CurrencyCode"
            }
          }
        }
      },
      "CompanyCurrencyListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/CompanyCurrencyModel"
            }
          }
        }
      },
      "CompanyCurrencyModel": {
        "type": "object",
        "description": "A currency configured for the company, with its stored identifiers.",
        "required": [
          "id",
          "code",
          "name",
          "is_company_default"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_company_default": {
            "type": "boolean"
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "rate_strategy": {
            "$ref": "#/components/schemas/CompanyCurrencyRateStrategy",
            "description": "How this currency's exchange rate is chosen. Defaults to `auto`."
          },
          "symbol": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CompanyCurrencyRateStrategy": {
        "type": "string",
        "description": "How a currency's exchange rate is currently sourced, based on its custom FX windows.",
        "enum": [
          "custom",
          "scheduled",
          "auto"
        ]
      },
      "CompanyDbModel": {
        "type": "object",
        "required": [
          "id",
          "user_id",
          "currency_id",
          "locale",
          "company_name",
          "subdomain",
          "timezone",
          "fiscal_year_end_month",
          "fiscal_year_end_day",
          "contact_first_name",
          "contact_last_name",
          "contact_email",
          "contact_phone_number",
          "company_signature",
          "address_street1",
          "address_street2",
          "address_city",
          "address_state",
          "address_zip_code",
          "address_country",
          "is_active",
          "created_at",
          "registration_number",
          "can_extend_trial",
          "partner_id",
          "company_type"
        ],
        "properties": {
          "address": {
            "type": [
              "string",
              "null"
            ]
          },
          "address_city": {
            "type": "string"
          },
          "address_country": {
            "type": "string"
          },
          "address_state": {
            "type": "string",
            "description": "State, province or region of the address."
          },
          "address_street1": {
            "type": "string"
          },
          "address_street2": {
            "type": "string"
          },
          "address_zip_code": {
            "type": "string"
          },
          "can_extend_trial": {
            "type": "boolean"
          },
          "company_name": {
            "type": "string",
            "description": "Company or business name."
          },
          "company_signature": {
            "type": "string"
          },
          "company_type": {
            "type": "string"
          },
          "contact_email": {
            "type": "string"
          },
          "contact_first_name": {
            "type": "string",
            "description": "First name of the contact person."
          },
          "contact_last_name": {
            "type": "string",
            "description": "Last name of the contact person."
          },
          "contact_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact_phone_number": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency_id": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "fiscal_year_end_day": {
            "type": "integer",
            "format": "int32"
          },
          "fiscal_year_end_month": {
            "type": "integer",
            "format": "int32"
          },
          "has_completed_onboarding": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "locale": {
            "type": "string",
            "description": "Locale used for language and number formats, for example `en_US`."
          },
          "logo_data_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "logo_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta_data": {
            "description": "Free-form JSON; keys and values depend on the producing workflow."
          },
          "parent_company_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "partner_id": {
            "type": "string"
          },
          "registration_number": {
            "type": "string"
          },
          "subdomain": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "CompanyDeleteResponseModel": {
        "type": "object",
        "required": [
          "delete_company_id"
        ],
        "properties": {
          "delete_company_id": {
            "type": "string"
          }
        }
      },
      "CompanyDetailResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CompanyModelWithAttr"
              }
            ]
          }
        }
      },
      "CompanyEmailTemplateDbModel": {
        "type": "object",
        "description": "A stored email template and its company-specific content.",
        "required": [
          "id",
          "document_type_id",
          "email_template_type",
          "email_subject",
          "email_body"
        ],
        "properties": {
          "document_type_id": {
            "type": "string"
          },
          "email_body": {
            "type": "string"
          },
          "email_subject": {
            "type": "string"
          },
          "email_template_type": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "updated_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "User who last changed the record."
          }
        }
      },
      "CompanyEmailTemplateDetailResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CompanyEmailTemplateDbModel"
              }
            ]
          }
        }
      },
      "CompanyEmailTemplateFormModel": {
        "type": "object",
        "description": "Creates or updates a company email template and its editable content.",
        "required": [
          "subject",
          "body"
        ],
        "properties": {
          "body": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          }
        }
      },
      "CompanyEmailTemplateListModel": {
        "type": "object",
        "required": [
          "email_templates"
        ],
        "properties": {
          "email_templates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyEmailTemplateDbModel"
            }
          }
        }
      },
      "CompanyEmailTemplateListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CompanyEmailTemplateListModel"
              }
            ]
          }
        }
      },
      "CompanyFormModel": {
        "type": "object",
        "description": "Company profile, base currency, locale, timezone, contact, and address inputs.",
        "required": [
          "currency_id",
          "locale",
          "company_name",
          "timezone",
          "contact_first_name",
          "contact_last_name",
          "contact_email",
          "contact_phone_number",
          "company_signature",
          "address_street1",
          "address_city",
          "address_state",
          "address_zip_code",
          "address_country"
        ],
        "properties": {
          "address_city": {
            "type": "string"
          },
          "address_country": {
            "type": "string"
          },
          "address_state": {
            "type": "string",
            "description": "State, province or region of the address."
          },
          "address_street1": {
            "type": "string"
          },
          "address_street2": {
            "type": [
              "string",
              "null"
            ]
          },
          "address_zip_code": {
            "type": "string"
          },
          "company_attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/CompanyAttr"
            }
          },
          "company_name": {
            "type": "string",
            "description": "Company or business name."
          },
          "company_signature": {
            "type": "string"
          },
          "company_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact_email": {
            "type": "string"
          },
          "contact_first_name": {
            "type": "string",
            "description": "First name of the contact person."
          },
          "contact_last_name": {
            "type": "string",
            "description": "Last name of the contact person."
          },
          "contact_phone_number": {
            "type": "string"
          },
          "currency_id": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "fiscal_year_end_day": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32"
          },
          "fiscal_year_end_month": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32"
          },
          "locale": {
            "type": "string",
            "description": "Locale used for language and number formats, for example `en_US`."
          },
          "partner_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "timezone": {
            "type": "string"
          }
        }
      },
      "CompanyFormResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/CompanyDbModel"
          },
          "user_acl_company_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CompanyFxRateCreateForm": {
        "type": "object",
        "description": "Create a custom FX window. `company_id`/`base_currency`/`created_by` are derived\nserver-side from the auth context and company profile — never client-supplied.",
        "required": [
          "target_currency",
          "exchange_rate"
        ],
        "properties": {
          "effective_from": {
            "type": [
              "string",
              "null"
            ],
            "description": "`YYYY-MM-DD` in the company timezone; defaults to the company's today."
          },
          "effective_to": {
            "type": [
              "string",
              "null"
            ],
            "description": "`YYYY-MM-DD` in the company timezone (inclusive); `null` = open-ended."
          },
          "exchange_rate": {
            "type": "string",
            "description": "`1 target_currency = exchange_rate company-base`; positive, up to 6 decimal places.",
            "example": "0.716020"
          },
          "replace_open_ended": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "When the new window starts inside an existing *open-ended* window for the same\ncurrency, end that window the day before the new start (or retire it if it starts\nthe same day) instead of rejecting with `OVERLAPPING_FX_WINDOW`. Any other overlap\nis still rejected. Defaults to `false` so replacement is always an explicit choice."
          },
          "target_currency": {
            "type": "string",
            "description": "ISO 4217 code of a currency already added to the company.",
            "example": "AUD"
          }
        }
      },
      "CompanyFxRateHistoryEntry": {
        "type": "object",
        "description": "One entry of the custom FX change history (from the activity log). Dates are\ncompany-local `YYYY-MM-DD`; `*_before` are `null` on creation.",
        "required": [
          "id",
          "action",
          "user_id",
          "created_at"
        ],
        "properties": {
          "action": {
            "type": "string",
            "description": "`created` | `updated` | `ended` | `deleted`."
          },
          "base_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "description": "When the change was made (RFC 3339)."
          },
          "effective_from_after": {
            "type": [
              "string",
              "null"
            ]
          },
          "effective_from_before": {
            "type": [
              "string",
              "null"
            ]
          },
          "effective_to_after": {
            "type": [
              "string",
              "null"
            ]
          },
          "effective_to_before": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate_after": {
            "type": [
              "string",
              "null"
            ],
            "description": "Rate after the change, as a decimal string."
          },
          "exchange_rate_before": {
            "type": [
              "string",
              "null"
            ],
            "description": "Rate before the change, as a decimal string."
          },
          "id": {
            "type": "string",
            "description": "Activity row id."
          },
          "rate_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Custom FX window the change applies to."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why a secondary window changed: `replaced` | `switch_automatic`; `null` otherwise."
          },
          "target_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "user_id": {
            "type": "string",
            "description": "Actor user id."
          }
        }
      },
      "CompanyFxRateModel": {
        "type": "object",
        "description": "One custom FX window row. Scalars are stringified for stable wire/UI parsing\n(decimals keep full precision; timestamps are UTC ISO-8601).\n\nRate direction: `1 target_currency = exchange_rate base_currency`, where\n`base_currency` is the company's base currency. This is the same convention as a\ndocument's `document_exchange_rate` (\"1 document currency = X company currency\").",
        "required": [
          "id",
          "base_currency",
          "target_currency",
          "exchange_rate",
          "status",
          "effective_from",
          "effective_from_date",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "base_currency": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "created_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "effective_from": {
            "type": "string",
            "description": "First instant the window applies (UTC). Start of `effective_from_date` in the\ncompany timezone."
          },
          "effective_from_date": {
            "type": "string",
            "description": "Company-local calendar date the window starts (`YYYY-MM-DD`). UIs should display\nand edit this, not a slice of the UTC timestamp (which can be the previous day)."
          },
          "effective_to": {
            "type": [
              "string",
              "null"
            ],
            "description": "Last instant the window applies (UTC, inclusive). `null` = open-ended."
          },
          "effective_to_date": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company-local calendar date the window ends, inclusive (`YYYY-MM-DD`)."
          },
          "exchange_rate": {
            "type": "string",
            "description": "Decimal string: one unit of this record's currency equals `exchange_rate` units of the company base currency. `1` when the record is in the base currency."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "status": {
            "$ref": "#/components/schemas/CompanyFxRateStatus"
          },
          "target_currency": {
            "type": "string"
          },
          "updated_at": {
            "type": "string",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "updated_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "User who last changed the record."
          }
        }
      },
      "CompanyFxRateRemovalOutcome": {
        "type": "string",
        "description": "What a removal did to a window.",
        "enum": [
          "deleted",
          "ended",
          "already_deleted"
        ]
      },
      "CompanyFxRateStatus": {
        "type": "string",
        "description": "Derived lifecycle state of a custom FX window. Never stored — computed from\n`effective_from` / `effective_to` against the server clock (UTC).",
        "enum": [
          "current",
          "upcoming",
          "expired"
        ]
      },
      "CompanyFxRateUpdateForm": {
        "type": "object",
        "description": "Edit a custom FX window. Only the rate/window is editable; identity + base are fixed.",
        "required": [
          "exchange_rate"
        ],
        "properties": {
          "effective_from": {
            "type": [
              "string",
              "null"
            ],
            "description": "`YYYY-MM-DD` (company timezone); omit to keep the existing start. The start of a\nwindow that is already in effect cannot move (it may have priced documents)."
          },
          "effective_to": {
            "type": [
              "string",
              "null"
            ],
            "description": "`YYYY-MM-DD` (company timezone, inclusive); empty string clears (open-ended),\nomit to keep existing."
          },
          "exchange_rate": {
            "type": "string",
            "description": "Positive, up to 6 decimal places."
          }
        }
      },
      "CompanyListModel": {
        "type": "object",
        "required": [
          "id",
          "company_name",
          "contact_email",
          "currency_id",
          "locale",
          "created_at",
          "is_active"
        ],
        "properties": {
          "company_name": {
            "type": "string",
            "description": "Company or business name."
          },
          "contact_email": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency_id": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "False while the company is suspended (PL-227)."
          },
          "locale": {
            "type": "string",
            "description": "Locale used for language and number formats, for example `en_US`."
          },
          "logo_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "organization_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "PL-222. The Standard organization the company belongs to: its own id\nfor the organization itself, another company's for a member, `null`\noutside one. Lets a company list show the organization tree without\nreading the organization's whole company list."
          },
          "role": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CompanyListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/CompanyListModel"
            }
          }
        }
      },
      "CompanyLogoDataUrlForm": {
        "type": "object",
        "description": "Uploads the company's logo as a supported image data URL.",
        "required": [
          "data_url"
        ],
        "properties": {
          "data_url": {
            "type": "string"
          }
        }
      },
      "CompanyLogoDataUrlResponseModel": {
        "type": "object",
        "required": [
          "logo_url"
        ],
        "properties": {
          "logo_url": {
            "type": "string"
          }
        }
      },
      "CompanyMappingDetailResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CompanyConnection"
              }
            ]
          }
        }
      },
      "CompanyMappingListModel": {
        "type": "object",
        "required": [
          "id",
          "sender_company_id",
          "company_name"
        ],
        "properties": {
          "accepted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "company_name": {
            "type": "string",
            "description": "Company or business name."
          },
          "connected_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "connection_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "`pending`, `accepted` or `rejected`."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "logo_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "rejected_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "sender_company_id": {
            "type": "string"
          }
        }
      },
      "CompanyMappingListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/CompanyMappingListModel"
            }
          }
        }
      },
      "CompanyModelWithAttr": {
        "type": "object",
        "required": [
          "id",
          "user_id",
          "currency_id",
          "locale",
          "company_name",
          "timezone",
          "fiscal_year_end_month",
          "fiscal_year_end_day",
          "contact_first_name",
          "contact_last_name",
          "contact_email",
          "contact_phone_number",
          "company_signature",
          "address_street1",
          "address_street2",
          "address_city",
          "address_state",
          "address_zip_code",
          "address_country",
          "created_at",
          "can_extend_trial",
          "company_type"
        ],
        "properties": {
          "address_city": {
            "type": "string"
          },
          "address_country": {
            "type": "string"
          },
          "address_state": {
            "type": "string",
            "description": "State, province or region of the address."
          },
          "address_street1": {
            "type": "string"
          },
          "address_street2": {
            "type": "string"
          },
          "address_zip_code": {
            "type": "string"
          },
          "can_extend_trial": {
            "type": "boolean"
          },
          "company_attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/CompanyAttributeDbModel"
            }
          },
          "company_name": {
            "type": "string",
            "description": "Company or business name."
          },
          "company_signature": {
            "type": "string"
          },
          "company_type": {
            "type": "string"
          },
          "contact_email": {
            "type": "string"
          },
          "contact_first_name": {
            "type": "string",
            "description": "First name of the contact person."
          },
          "contact_last_name": {
            "type": "string",
            "description": "Last name of the contact person."
          },
          "contact_phone_number": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency_id": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "fiscal_year_end_day": {
            "type": "integer",
            "format": "int32"
          },
          "fiscal_year_end_month": {
            "type": "integer",
            "format": "int32"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "locale": {
            "type": "string",
            "description": "Locale used for language and number formats, for example `en_US`."
          },
          "logo_data_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "logo_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta_data": {
            "description": "Free-form JSON; keys and values depend on the producing workflow."
          },
          "parent_company_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "subscription": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SubscriptionCompanyModel"
              }
            ]
          },
          "timezone": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "CompanyPaymentModeDbModel": {
        "type": "object",
        "description": "A stored company payment mode available to document payment forms.",
        "required": [
          "id",
          "label"
        ],
        "properties": {
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "label": {
            "type": "string"
          }
        }
      },
      "CompanyPaymentModeDetailResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CompanyPaymentModeDbModel"
              }
            ]
          }
        }
      },
      "CompanyPaymentModeFormModel": {
        "type": "object",
        "description": "Creates or updates a payment method shown when recording document payments.",
        "required": [
          "label"
        ],
        "properties": {
          "label": {
            "type": "string"
          }
        }
      },
      "CompanyPaymentModeListModel": {
        "type": "object",
        "required": [
          "total_records",
          "page_size",
          "page_number",
          "payment_mode"
        ],
        "properties": {
          "page_number": {
            "type": "integer",
            "format": "int64",
            "description": "Page returned, 1-based.",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "description": "Records per page in this response.",
            "minimum": 0
          },
          "payment_mode": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyPaymentModeDbModel"
            }
          },
          "total_records": {
            "type": "integer",
            "format": "int64",
            "description": "Records matching the filters, across all pages.",
            "minimum": 0
          }
        }
      },
      "CompanyPaymentModeListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CompanyPaymentModeListModel"
              }
            ]
          }
        }
      },
      "CompanyPaymentTermDetailResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CompanyPaymentTermModel"
              }
            ]
          }
        }
      },
      "CompanyPaymentTermFormModel": {
        "type": "object",
        "description": "Creates or updates a payment term used to determine document due dates.",
        "required": [
          "label",
          "value"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "value": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "CompanyPaymentTermListModel": {
        "type": "object",
        "required": [
          "total_records",
          "page_size",
          "page_number",
          "payment_term"
        ],
        "properties": {
          "page_number": {
            "type": "integer",
            "format": "int64",
            "description": "Page returned, 1-based.",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "description": "Records per page in this response.",
            "minimum": 0
          },
          "payment_term": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompanyPaymentTermModel"
            }
          },
          "total_records": {
            "type": "integer",
            "format": "int64",
            "description": "Records matching the filters, across all pages.",
            "minimum": 0
          }
        }
      },
      "CompanyPaymentTermListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CompanyPaymentTermListModel"
              }
            ]
          }
        }
      },
      "CompanyPaymentTermModel": {
        "type": "object",
        "description": "A payment term defining when a document's payment becomes due.",
        "required": [
          "id",
          "label",
          "value",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "label": {
            "type": "string"
          },
          "value": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "CompanyStripConnectFormModel": {
        "type": "object",
        "description": "Supplies the company's Stripe Connect setup details."
      },
      "CompanyUpdateResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/CompanyDbModel"
              }
            ]
          }
        }
      },
      "ControlAccountException": {
        "type": "object",
        "required": [
          "account_id",
          "account_name",
          "account_code",
          "journal_count",
          "net_debit"
        ],
        "properties": {
          "account_code": {
            "type": "string",
            "description": "Account code in the chart of accounts."
          },
          "account_id": {
            "type": "string",
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "account_name": {
            "type": "string",
            "description": "Account name in the chart of accounts."
          },
          "journal_count": {
            "type": "integer",
            "format": "int64"
          },
          "net_debit": {
            "type": "string",
            "description": "Debit-positive base-currency effect of exceptional control-account lines."
          }
        }
      },
      "ControlAccountExceptionEntry": {
        "type": "object",
        "required": [
          "journal_id",
          "identifier",
          "date",
          "is_manual",
          "ar_net_debit",
          "ap_net_debit"
        ],
        "properties": {
          "ap_net_debit": {
            "type": "string"
          },
          "ar_net_debit": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "identifier": {
            "type": "string"
          },
          "is_manual": {
            "type": "boolean"
          },
          "journal_id": {
            "type": "string"
          },
          "review_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "reviewed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "reviewer_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "root_entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "root_entity_type": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ControlAccountReconciliation": {
        "type": "object",
        "required": [
          "account_code",
          "ledger_balance",
          "subledger_balance",
          "difference",
          "tolerance",
          "is_reconciled"
        ],
        "properties": {
          "account_code": {
            "type": "string",
            "description": "Account code in the chart of accounts."
          },
          "difference": {
            "type": "string"
          },
          "is_reconciled": {
            "type": "boolean"
          },
          "ledger_balance": {
            "type": "string",
            "description": "Debit-positive ledger balance in base currency, encoded as a decimal string."
          },
          "subledger_balance": {
            "type": "string"
          },
          "tolerance": {
            "type": "string"
          }
        }
      },
      "CountryListModel": {
        "type": "object",
        "description": "The supported countries available to company and counterparty forms.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CountryWithLocaleTimezone"
            }
          }
        }
      },
      "CountryWithLocaleTimezone": {
        "type": "object",
        "description": "A country and the locales and timezones associated with it.",
        "required": [
          "code",
          "name",
          "currency_code",
          "currency_name"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "currency_code": {
            "type": "string"
          },
          "currency_name": {
            "type": "string"
          },
          "locales": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/LocaleModel"
            }
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "timezones": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/TimezoneModel"
            }
          }
        }
      },
      "CreateDimensionRequest": {
        "type": "object",
        "description": "Creates a tenant-owned accounting dimension definition with its scope and label.",
        "required": [
          "code",
          "name",
          "scopes"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "scopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DimensionScope"
            }
          }
        },
        "additionalProperties": false
      },
      "CreateDimensionValueRequest": {
        "type": "object",
        "description": "Creates a value within an accounting dimension, optionally beneath a parent value.",
        "required": [
          "code",
          "name"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_group": {
            "type": "boolean"
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "parent_value_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "CreateEndpointRequest": {
        "type": "object",
        "description": "Registers an HTTPS webhook destination and the event types it should receive. Custom headers belong in `headers`.",
        "required": [
          "name",
          "url",
          "enabled_events"
        ],
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "enabled_events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "headers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomHeaderInput"
            }
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "spec_version": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "example": {
          "enabled_events": [
            "invoice.created"
          ],
          "name": "Accounting events",
          "url": "https://example.com/webhooks/accounting"
        }
      },
      "CreditNoteFromModel": {
        "type": "object",
        "required": [
          "anchor_id"
        ],
        "properties": {
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string in the record's currency."
          },
          "anchor_id": {
            "type": "string",
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          }
        }
      },
      "Currency": {
        "type": "object",
        "description": "A supported currency and its display metadata.",
        "required": [
          "code",
          "name"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "Display name."
          }
        }
      },
      "CurrencyCode": {
        "type": "object",
        "description": "An ISO 4217 currency code.",
        "required": [
          "code"
        ],
        "properties": {
          "code": {
            "type": "string"
          }
        }
      },
      "CurrencyListModel": {
        "type": "object",
        "description": "The supported currencies available to company configuration.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Currency"
            }
          }
        }
      },
      "CurrencyStatement": {
        "type": "object",
        "required": [
          "currency",
          "opening_balance",
          "total_debits",
          "total_credits",
          "closing_balance",
          "entries"
        ],
        "properties": {
          "closing_balance": {
            "type": "string",
            "description": "Balance at the end of the period, as a decimal string."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatementEntry"
            }
          },
          "opening_balance": {
            "type": "string",
            "description": "Balance at the start of the period, as a decimal string."
          },
          "total_credits": {
            "type": "string"
          },
          "total_debits": {
            "type": "string"
          }
        }
      },
      "CursorActivityModel": {
        "type": "object",
        "description": "An activity entry included in a cursor-based activity feed.",
        "required": [
          "id",
          "acl_module_id",
          "user_id",
          "activity",
          "created_at"
        ],
        "properties": {
          "acl_module_id": {
            "type": "string"
          },
          "activity": {
            "type": "string"
          },
          "activity_color": {
            "type": [
              "string",
              "null"
            ]
          },
          "actor_source": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ActivityActorSourceModel"
              }
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "message_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "message_params": {
            "description": "Free-form JSON; keys and values depend on the producing workflow."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "CursorPagination": {
        "type": "object",
        "description": "Continuation metadata for a bounded list. Use `next_cursor` unchanged when requesting the next page.",
        "required": [
          "has_more"
        ],
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "CustomHeaderInput": {
        "type": "object",
        "description": "A custom HTTP header included with webhook delivery requests.",
        "properties": {
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Display name."
          },
          "value": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DataResponse_DefaultsLookupResponse": {
        "type": "object",
        "description": "Successful response envelope containing the operation result under `data`.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "items"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DefaultsLookupItem"
                },
                "description": "One entry per requested id, in request order. Empty while Dimensions is not activated."
              }
            }
          }
        }
      },
      "DataResponse_Dimension": {
        "type": "object",
        "description": "Successful response envelope containing the operation result under `data`.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "code",
              "name",
              "scopes",
              "is_archived",
              "can_restore_default_label",
              "value_counts"
            ],
            "properties": {
              "can_restore_default_label": {
                "type": "boolean"
              },
              "code": {
                "type": "string"
              },
              "default_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "is_archived": {
                "type": "boolean"
              },
              "name": {
                "type": "string"
              },
              "scopes": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DimensionScope"
                }
              },
              "template_key": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "value_counts": {
                "$ref": "#/components/schemas/ValueCounts"
              },
              "values": {
                "type": [
                  "array",
                  "null"
                ],
                "items": {
                  "$ref": "#/components/schemas/DimensionValue"
                },
                "description": "Present only when the list was asked for `include=values`: every value of this dimension that\nmatches the requested status, in the same order and with the same shape as the values list."
              }
            }
          }
        }
      },
      "DataResponse_DimensionCorrectionResponse": {
        "type": "object",
        "description": "Successful response envelope containing the operation result under `data`.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "record_id",
              "lines_changed",
              "items"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DimensionCorrectionItem"
                },
                "description": "Every line of the record with its resulting values."
              },
              "lines_changed": {
                "type": "integer",
                "format": "int32",
                "description": "Lines whose set of values changed; 0 means nothing was written.",
                "minimum": 0
              },
              "record_id": {
                "type": "string"
              },
              "updated_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "version_number": {
                "type": [
                  "integer",
                  "null"
                ],
                "format": "int32"
              }
            }
          }
        }
      },
      "DataResponse_DimensionIncomeStatement": {
        "type": "object",
        "description": "Successful response envelope containing the operation result under `data`.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "dimension_id",
              "dimension_name",
              "date_from",
              "date_to",
              "buckets",
              "accounts"
            ],
            "properties": {
              "accounts": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DimensionIncomeAccount"
                }
              },
              "buckets": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DimensionIncomeBucket"
                },
                "description": "Grouped mode: values with activity, ordered by code. Empty in drill-down mode."
              },
              "date_from": {
                "type": "string"
              },
              "date_to": {
                "type": "string"
              },
              "dimension_id": {
                "type": "string"
              },
              "dimension_name": {
                "type": "string"
              },
              "selection": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/DimensionAmounts",
                    "description": "Drill-down mode: the selection's amounts and its accounts, ordered by account name."
                  }
                ]
              },
              "totals": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/DimensionAmounts",
                    "description": "Grouped mode: direct buckets plus Unassigned. Equals the unfiltered income statement."
                  }
                ]
              },
              "unassigned": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/DimensionAmounts",
                    "description": "Grouped mode: lines with no value for the dimension."
                  }
                ]
              }
            }
          }
        }
      },
      "DataResponse_DimensionValue": {
        "type": "object",
        "description": "Successful response envelope containing the operation result under `data`.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "id",
              "dimension_id",
              "code",
              "name",
              "path",
              "is_group",
              "is_archived",
              "can_restore_default_label"
            ],
            "properties": {
              "can_restore_default_label": {
                "type": "boolean"
              },
              "code": {
                "type": "string"
              },
              "default_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "dimension_id": {
                "type": "string"
              },
              "id": {
                "type": "string"
              },
              "is_archived": {
                "type": "boolean"
              },
              "is_group": {
                "type": "boolean"
              },
              "name": {
                "type": "string"
              },
              "parent": {
                "oneOf": [
                  {
                    "type": "null"
                  },
                  {
                    "$ref": "#/components/schemas/ValuePathEntry"
                  }
                ]
              },
              "parent_value_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "path": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ValuePathEntry"
                }
              },
              "template_key": {
                "type": [
                  "string",
                  "null"
                ]
              }
            }
          }
        }
      },
      "DataResponse_DimensionWorklistSummary": {
        "type": "object",
        "description": "Successful response envelope containing the operation result under `data`.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "records",
              "by_type",
              "by_dimension"
            ],
            "properties": {
              "by_dimension": {
                "type": "object",
                "description": "Records with at least one line missing a value, per dimension id.",
                "additionalProperties": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "propertyNames": {
                  "type": "string"
                }
              },
              "by_type": {
                "type": "object",
                "description": "Records needing a value per record type (`invoice`, `bill`, `credit-note`, `expense`, `journal`).",
                "additionalProperties": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "propertyNames": {
                  "type": "string"
                }
              },
              "records": {
                "type": "integer",
                "format": "int64",
                "description": "Records needing a value, across every record type.",
                "minimum": 0
              }
            }
          }
        }
      },
      "DataResponse_InitializeDimensionsResponse": {
        "type": "object",
        "description": "Successful response envelope containing the operation result under `data`.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "required": [
              "initialized",
              "created"
            ],
            "properties": {
              "created": {
                "type": "boolean"
              },
              "initialized": {
                "type": "boolean"
              }
            }
          }
        }
      },
      "DataResponse_Page_Dimension": {
        "type": "object",
        "description": "Successful response envelope containing the operation result under `data`.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "description": "A bounded collection of items and cursor pagination metadata. Pass the next cursor unchanged to continue.",
            "required": [
              "items",
              "pagination"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "code",
                    "name",
                    "scopes",
                    "is_archived",
                    "can_restore_default_label",
                    "value_counts"
                  ],
                  "properties": {
                    "can_restore_default_label": {
                      "type": "boolean"
                    },
                    "code": {
                      "type": "string"
                    },
                    "default_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "is_archived": {
                      "type": "boolean"
                    },
                    "name": {
                      "type": "string"
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/DimensionScope"
                      }
                    },
                    "template_key": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "value_counts": {
                      "$ref": "#/components/schemas/ValueCounts"
                    },
                    "values": {
                      "type": [
                        "array",
                        "null"
                      ],
                      "items": {
                        "$ref": "#/components/schemas/DimensionValue"
                      },
                      "description": "Present only when the list was asked for `include=values`: every value of this dimension that\nmatches the requested status, in the same order and with the same shape as the values list."
                    }
                  }
                }
              },
              "pagination": {
                "$ref": "#/components/schemas/CursorPagination"
              }
            }
          }
        }
      },
      "DataResponse_Page_DimensionAccountLine": {
        "type": "object",
        "description": "Successful response envelope containing the operation result under `data`.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "description": "A bounded collection of items and cursor pagination metadata. Pass the next cursor unchanged to continue.",
            "required": [
              "items",
              "pagination"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "line_id",
                    "journal_id",
                    "journal_anchor_id",
                    "journal_version_number",
                    "identifier",
                    "date",
                    "entry_type",
                    "amount"
                  ],
                  "properties": {
                    "amount": {
                      "type": "string",
                      "description": "Company base currency, always positive; see `entry_type`."
                    },
                    "date": {
                      "type": "string"
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "entry_type": {
                      "type": "string",
                      "description": "`debit` or `credit`."
                    },
                    "identifier": {
                      "type": "string"
                    },
                    "journal_anchor_id": {
                      "type": "string"
                    },
                    "journal_id": {
                      "type": "string"
                    },
                    "journal_version_number": {
                      "type": "integer",
                      "format": "int32"
                    },
                    "line_id": {
                      "type": "string"
                    },
                    "source_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source_type": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Owning source (`invoice`, `bill`, `expense`, ...) when the journal is system posted."
                    },
                    "value": {
                      "oneOf": [
                        {
                          "type": "null"
                        },
                        {
                          "$ref": "#/components/schemas/DimensionLineValue",
                          "description": "Absent when the line has no value for the dimension."
                        }
                      ]
                    }
                  }
                }
              },
              "pagination": {
                "$ref": "#/components/schemas/CursorPagination"
              }
            }
          }
        }
      },
      "DataResponse_Page_DimensionValue": {
        "type": "object",
        "description": "Successful response envelope containing the operation result under `data`.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "description": "A bounded collection of items and cursor pagination metadata. Pass the next cursor unchanged to continue.",
            "required": [
              "items",
              "pagination"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "id",
                    "dimension_id",
                    "code",
                    "name",
                    "path",
                    "is_group",
                    "is_archived",
                    "can_restore_default_label"
                  ],
                  "properties": {
                    "can_restore_default_label": {
                      "type": "boolean"
                    },
                    "code": {
                      "type": "string"
                    },
                    "default_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "dimension_id": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "is_archived": {
                      "type": "boolean"
                    },
                    "is_group": {
                      "type": "boolean"
                    },
                    "name": {
                      "type": "string"
                    },
                    "parent": {
                      "oneOf": [
                        {
                          "type": "null"
                        },
                        {
                          "$ref": "#/components/schemas/ValuePathEntry"
                        }
                      ]
                    },
                    "parent_value_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "path": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ValuePathEntry"
                      }
                    },
                    "template_key": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  }
                }
              },
              "pagination": {
                "$ref": "#/components/schemas/CursorPagination"
              }
            }
          }
        }
      },
      "DataResponse_Page_DimensionWorklistItem": {
        "type": "object",
        "description": "Successful response envelope containing the operation result under `data`.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "object",
            "description": "A bounded collection of items and cursor pagination metadata. Pass the next cursor unchanged to continue.",
            "required": [
              "items",
              "pagination"
            ],
            "properties": {
              "items": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "record_id",
                    "module",
                    "record_type",
                    "number",
                    "date",
                    "status",
                    "lines_missing",
                    "lines_total",
                    "missing_by_dimension",
                    "editable"
                  ],
                  "properties": {
                    "amount": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "blocked_reason": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Why `editable` is false (for example `reconciled`)."
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "date": {
                      "type": "string"
                    },
                    "editable": {
                      "type": "boolean"
                    },
                    "lines_missing": {
                      "type": "integer",
                      "format": "int32",
                      "description": "Taggable revenue/expense lines still missing a value for at least one requested dimension.",
                      "minimum": 0
                    },
                    "lines_total": {
                      "type": "integer",
                      "format": "int32",
                      "description": "All taggable revenue/expense lines of the record.",
                      "minimum": 0
                    },
                    "lock": {
                      "oneOf": [
                        {
                          "type": "null"
                        },
                        {
                          "$ref": "#/components/schemas/DimensionWorklistLock"
                        }
                      ]
                    },
                    "missing_by_dimension": {
                      "type": "object",
                      "description": "Lines missing a value, per requested dimension id.",
                      "additionalProperties": {
                        "type": "integer",
                        "format": "int32",
                        "minimum": 0
                      },
                      "propertyNames": {
                        "type": "string"
                      }
                    },
                    "module": {
                      "type": "string"
                    },
                    "number": {
                      "type": "string"
                    },
                    "party_name": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The contact, or the expense note / journal description where there is none."
                    },
                    "record_id": {
                      "type": "string",
                      "description": "Document `anchor_id`, expense id, or manual journal `anchor_id`."
                    },
                    "record_type": {
                      "type": "string",
                      "description": "`invoice`, `bill`, `credit-note`, `expense` or `journal`."
                    },
                    "status": {
                      "type": "string"
                    },
                    "updated_at": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Concurrency token for expenses (an expense has no version number)."
                    },
                    "version_number": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "format": "int32",
                      "description": "Concurrency token for documents and journals, sent back as `expected_version`."
                    }
                  }
                }
              },
              "pagination": {
                "$ref": "#/components/schemas/CursorPagination"
              }
            }
          }
        }
      },
      "DefaultsLookupItem": {
        "type": "object",
        "required": [
          "id",
          "dimension_state"
        ],
        "properties": {
          "dimension_state": {
            "$ref": "#/components/schemas/DimensionState",
            "description": "Empty `resolved` when the record has no defaults, or is not one of this tenant's records of\nthe asked type: the answer does not tell the two apart."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          }
        }
      },
      "DefaultsLookupRequest": {
        "type": "object",
        "description": "Only `ids` is read. Duplicates are answered once.",
        "required": [
          "ids"
        ],
        "properties": {
          "ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "DeleteStripeConnectAccountResponse": {
        "type": "object",
        "required": [
          "deleted"
        ],
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        }
      },
      "DeliveryRequestHeader": {
        "type": "object",
        "description": "A header captured from an attempted webhook request.",
        "required": [
          "name",
          "value",
          "redacted"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "redacted": {
            "type": "boolean"
          },
          "value": {
            "type": "string"
          }
        }
      },
      "DeliveryRequestSnapshot": {
        "type": "object",
        "description": "The recorded request metadata for a webhook delivery attempt.",
        "required": [
          "method",
          "url",
          "headers"
        ],
        "properties": {
          "headers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DeliveryRequestHeader"
            }
          },
          "method": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        }
      },
      "DeliveryResponse": {
        "type": "object",
        "description": "One webhook delivery attempt and its recorded result.",
        "required": [
          "id",
          "event_id",
          "event_type",
          "status",
          "attempt_number",
          "created_at"
        ],
        "properties": {
          "attempt_number": {
            "type": "integer",
            "format": "int64"
          },
          "attempted_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "error_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "error_message": {
            "type": [
              "string",
              "null"
            ]
          },
          "event_id": {
            "type": "string"
          },
          "event_type": {
            "type": "string"
          },
          "http_status": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "HTTP status of the latest attempt; null before the first attempt or when no response was received."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "next_attempt_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Scheduled retry time when this attempt failed retryably."
          },
          "payload": {
            "type": [
              "string",
              "null"
            ],
            "description": "Exact serialized request body signed and sent for this event."
          },
          "request": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DeliveryRequestSnapshot",
                "description": "Request metadata captured at send time. Secret-bearing values are redacted."
              }
            ]
          },
          "response_excerpt": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "description": "`pending`, `succeeded` or `failed`. A failed delivery may still be retried."
          },
          "succeeded_at": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DimensionAmounts": {
        "type": "object",
        "description": "Revenue is credit minus debit, expense is debit minus credit, both in company base currency.",
        "required": [
          "revenue",
          "expense",
          "net_income"
        ],
        "properties": {
          "expense": {
            "type": "string"
          },
          "net_income": {
            "type": "string"
          },
          "revenue": {
            "type": "string"
          }
        }
      },
      "DimensionCorrectionItem": {
        "type": "object",
        "required": [
          "line_id",
          "dimension_state"
        ],
        "properties": {
          "dimension_state": {
            "$ref": "#/components/schemas/DimensionState"
          },
          "line_id": {
            "type": "string"
          }
        }
      },
      "DimensionCorrectionLine": {
        "type": "object",
        "description": "One line of a dimension-only correction: the line's complete set of values (`[]` clears it).",
        "required": [
          "id",
          "dimension_values"
        ],
        "properties": {
          "dimension_values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DimensionValueRef"
            }
          },
          "id": {
            "type": "string",
            "description": "The line's current id (document item id, expense item id, journal line id)."
          }
        },
        "additionalProperties": false
      },
      "DimensionCorrectionRequest": {
        "type": "object",
        "description": "Changes line values and nothing else. Only the fields below are read; anything else in the body is\nignored, so amounts, accounts, taxes and dates cannot move through it.",
        "required": [
          "lines"
        ],
        "properties": {
          "expected_updated_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Concurrency token for expenses: the expense's `updated_at` as listed (null when never updated)."
          },
          "expected_version": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Concurrency token for documents and journals: the record's current `version_number`."
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DimensionCorrectionLine"
            },
            "description": "At most 100 lines. A line not listed keeps its values."
          }
        }
      },
      "DimensionInclude": {
        "type": "string",
        "enum": [
          "values"
        ]
      },
      "DimensionIncomeAccount": {
        "type": "object",
        "required": [
          "account_id",
          "account_name",
          "account_code",
          "account_type",
          "amount"
        ],
        "properties": {
          "account_code": {
            "type": "string",
            "description": "Account code in the chart of accounts."
          },
          "account_id": {
            "type": "string",
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "account_name": {
            "type": "string",
            "description": "Account name in the chart of accounts."
          },
          "account_type": {
            "type": "string",
            "description": "`revenue` or `expense`."
          },
          "amount": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          }
        }
      },
      "DimensionIncomeBucket": {
        "type": "object",
        "required": [
          "value_id",
          "code",
          "name",
          "is_archived",
          "direct",
          "inclusive"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "direct": {
            "$ref": "#/components/schemas/DimensionAmounts",
            "description": "Lines tagged with exactly this value."
          },
          "inclusive": {
            "$ref": "#/components/schemas/DimensionAmounts",
            "description": "This value plus every descendant. Never add inclusive amounts across buckets."
          },
          "is_archived": {
            "type": "boolean",
            "description": "Whether the record is archived."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "parent_value_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "value_id": {
            "type": "string"
          }
        }
      },
      "DimensionLineKey": {
        "type": "object",
        "required": [
          "source_line_id"
        ],
        "properties": {
          "client_line_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_line_id": {
            "type": "string"
          }
        }
      },
      "DimensionLineValue": {
        "type": "object",
        "required": [
          "value_id",
          "code",
          "name"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "value_id": {
            "type": "string"
          }
        }
      },
      "DimensionScope": {
        "type": "string",
        "enum": [
          "contacts",
          "items",
          "transactions"
        ]
      },
      "DimensionState": {
        "type": "object",
        "required": [
          "resolved"
        ],
        "properties": {
          "resolved": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResolvedDimension"
            },
            "description": "One entry per dimension that has a value; dimensions without a value are absent."
          }
        }
      },
      "DimensionStatus": {
        "type": "string",
        "enum": [
          "active",
          "archived",
          "all"
        ]
      },
      "DimensionValue": {
        "type": "object",
        "required": [
          "id",
          "dimension_id",
          "code",
          "name",
          "path",
          "is_group",
          "is_archived",
          "can_restore_default_label"
        ],
        "properties": {
          "can_restore_default_label": {
            "type": "boolean"
          },
          "code": {
            "type": "string"
          },
          "default_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "dimension_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_archived": {
            "type": "boolean",
            "description": "Whether the record is archived."
          },
          "is_group": {
            "type": "boolean"
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "parent": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ValuePathEntry"
              }
            ]
          },
          "parent_value_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "path": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValuePathEntry"
            }
          },
          "template_key": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DimensionValueRef": {
        "type": "object",
        "description": "One dimension value on a line or on a contact/item default. A line (or default) carries a\nlist of these under `dimension_values`: when the field is present the list is the line's\ncomplete set, so any saved value that is not in it is removed, and an empty list clears the\nline. When the field is absent the saved values are untouched (the same rule custom fields\nfollow). A dimension with no value has no entry; there is no placeholder for \"unassigned\".",
        "required": [
          "dimension_id",
          "value_id"
        ],
        "properties": {
          "dimension_id": {
            "type": "string",
            "description": "A blank id is reported on this field (`..._dimension_values_0_dimension_id`)."
          },
          "value_id": {
            "type": "string",
            "description": "A dimension added without choosing a value is reported on this field\n(`..._dimension_values_0_value_id`), next to the form's other errors."
          }
        },
        "additionalProperties": false
      },
      "DimensionWorklistLock": {
        "type": "object",
        "description": "The Transaction Lock that covers a record's date, judged for the calling user by the same rule\nthe save uses. Absent when no lock covers it.",
        "required": [
          "level",
          "label",
          "from_date"
        ],
        "properties": {
          "from_date": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "level": {
            "type": "string",
            "description": "`hard` (nobody can save), `blocked` (a soft lock this user cannot bypass) or `soft` (the\nuser may bypass it: the save goes through and governance logs the bypass)."
          },
          "to_date": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DocModel": {
        "type": "object",
        "required": [
          "id",
          "anchor_id",
          "version_number",
          "people_id",
          "company_id",
          "currency",
          "document_number",
          "document_type_id",
          "document_issue_date",
          "document_gross_total",
          "document_net_balance",
          "created_at",
          "is_recurring"
        ],
        "properties": {
          "anchor_id": {
            "type": "string",
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "document_due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Due date (`YYYY-MM-DD`); null when the document has none."
          },
          "document_gross_total": {
            "type": "string",
            "description": "Amount due: the total plus document-level adjustments, as a decimal string."
          },
          "document_issue_date": {
            "type": "string",
            "format": "date",
            "description": "Issue date (`YYYY-MM-DD`)."
          },
          "document_net_balance": {
            "type": "string",
            "description": "Amount still outstanding after payments and credits, as a decimal string."
          },
          "document_number": {
            "type": "string"
          },
          "document_state": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Record state: `0` active, `1` archived, `2` deleted."
          },
          "document_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Workflow status key from the module's status settings."
          },
          "document_status_category": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_type_id": {
            "type": "string"
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Caller-supplied id from the system that created this record (see `external_source`)."
          },
          "external_source": {
            "type": [
              "string",
              "null"
            ],
            "description": "System `external_id` comes from, for example `shopify`."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_recurring": {
            "type": "boolean",
            "description": "Whether this is a recurring template."
          },
          "people_id": {
            "type": "string",
            "description": "Client or vendor identifier."
          },
          "recurring_document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "sender_company": {
            "type": [
              "string",
              "null"
            ]
          },
          "version_number": {
            "type": "integer",
            "format": "int32",
            "description": "Version of the record, increased by every saved edit."
          }
        }
      },
      "DocumentAdjustment": {
        "type": "object",
        "description": "A document-level monetary adjustment included in document totals.",
        "required": [
          "adjustment_description",
          "adjustment_rate"
        ],
        "properties": {
          "adjustment_calc_base": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjustment_calc_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjustment_description": {
            "type": "string"
          },
          "adjustment_rate": {
            "type": "string"
          },
          "adjustment_type": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DocumentAdjustmentModel": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "adjustment_description",
          "created_at",
          "company_id"
        ],
        "properties": {
          "adjustable_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjusted_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjustment_calc_base": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjustment_calc_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjustment_description": {
            "type": "string"
          },
          "adjustment_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjustment_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "document_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          }
        }
      },
      "DocumentAdjustmentWrapper": {
        "type": "object",
        "description": "Groups the adjustments applied when calculating a document's totals.",
        "properties": {
          "subtotal": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DocumentAdjustment"
            }
          },
          "total": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DocumentAdjustment"
            }
          }
        }
      },
      "DocumentAttachmentModel": {
        "type": "object",
        "required": [
          "id",
          "user_id",
          "company_id",
          "attachment_name",
          "attachment_type",
          "attachment_size",
          "attachment_url"
        ],
        "properties": {
          "anchor_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "attachment_name": {
            "type": "string"
          },
          "attachment_size": {
            "type": "string"
          },
          "attachment_type": {
            "type": "string"
          },
          "attachment_url": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "DocumentAttr": {
        "type": "object",
        "description": "A value assigned to a configured document attribute.",
        "required": [
          "attribute_label",
          "attribute_value"
        ],
        "properties": {
          "attribute_label": {
            "type": "string",
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": "string",
            "description": "Custom field value."
          }
        }
      },
      "DocumentAttrFormModel": {
        "type": "object",
        "description": "Creates or updates a configurable document attribute definition.",
        "required": [
          "docs",
          "attribute",
          "reason"
        ],
        "properties": {
          "attribute": {
            "$ref": "#/components/schemas/DocumentAttributeEnum"
          },
          "docs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "doc_123",
              "doc_456"
            ]
          },
          "reason": {
            "type": "string",
            "example": "Quarterly audit cleanup"
          },
          "value": {
            "type": [
              "string",
              "null"
            ],
            "example": "archive"
          }
        }
      },
      "DocumentAttrFormResponseModel": {
        "type": "object",
        "description": "Successful response containing the updated document summary rows after an attribute write.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocModel"
            }
          }
        }
      },
      "DocumentAttributeEnum": {
        "type": "string",
        "description": "The supported document attributes that a bulk attribute update may change.",
        "enum": [
          "state",
          "late_fee",
          "reference_number",
          "notes",
          "terms",
          "due_date"
        ]
      },
      "DocumentAttributeModel": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "attribute_label",
          "attribute_value",
          "created_at",
          "company_id"
        ],
        "properties": {
          "attribute_label": {
            "type": "string",
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": "string",
            "description": "Custom field value."
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "document_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          }
        }
      },
      "DocumentCommentFormModel": {
        "type": "object",
        "description": "Adds or updates a comment on a document. Actor and company identity come from authentication.",
        "required": [
          "comment"
        ],
        "properties": {
          "anchor_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "comment": {
            "type": "string"
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_type_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_internal": {
            "type": "boolean"
          }
        }
      },
      "DocumentCommentModel": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "user_id",
          "company_id",
          "comment",
          "created_at",
          "is_internal"
        ],
        "properties": {
          "comment": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "company_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company or business name."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "document_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_internal": {
            "type": "boolean"
          },
          "user_contact": {
            "type": [
              "string",
              "null"
            ]
          },
          "user_email": {
            "type": [
              "string",
              "null"
            ]
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "DocumentContact": {
        "type": "object",
        "description": "A contact associated with a document's delivery or billing details.",
        "required": [
          "people_contact_id"
        ],
        "properties": {
          "people_contact_id": {
            "type": "string"
          }
        }
      },
      "DocumentContactModel": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "people_contact_id",
          "created_at",
          "company_id"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "document_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "people_contact_id": {
            "type": "string"
          }
        }
      },
      "DocumentEmailModel": {
        "type": "object",
        "description": "A document email's message and delivery metadata.",
        "required": [
          "id",
          "user_id",
          "user_company_id",
          "document_id",
          "document_type_id",
          "email_template_type",
          "subject",
          "body",
          "from",
          "to",
          "is_pdf_attached",
          "status",
          "created_at",
          "anchor_id"
        ],
        "properties": {
          "anchor_id": {
            "type": "string",
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "bcc": {
            "type": [
              "string",
              "null"
            ]
          },
          "body": {
            "type": "string"
          },
          "cc": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "document_id": {
            "type": "string"
          },
          "document_type_id": {
            "type": "string"
          },
          "email_template_type": {
            "type": "string"
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "from": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_pdf_attached": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "subject": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "user_company_id": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "DocumentFormAttributeModel": {
        "type": "object",
        "description": "An attribute definition available when editing a document.",
        "properties": {
          "attribute_label": {
            "type": [
              "string",
              "null"
            ],
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": [
              "string",
              "null"
            ],
            "description": "Custom field value."
          },
          "show_in_form": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      },
      "DocumentFormModel": {
        "type": "object",
        "description": "Creates or updates an accounting document with a counterparty, currency, issue date, and item lines. Use existing company-owned IDs for referenced records.",
        "required": [
          "currency",
          "people_id",
          "document_issue_date",
          "items"
        ],
        "properties": {
          "credited_document_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Credit notes only: the invoice version this credits (the invoice's\n`id`, not its `anchor_id`; versions are frozen, so the reference\nnever moves). Lines that set `credited_document_item_id` take that\ninvoice line's saved tax rates and split instead of current rates."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "document_address": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_adjustment": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DocumentAdjustmentWrapper"
              }
            ]
          },
          "document_attachment": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/AttachmentModel"
            }
          },
          "document_attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DocumentAttr"
            }
          },
          "document_contact": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DocumentContact"
            }
          },
          "document_delivery_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "document_due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Due date (`YYYY-MM-DD`); null when the document has none."
          },
          "document_exchange_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string: one unit of the document currency equals this many units of the company base currency."
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_issue_date": {
            "type": "string",
            "description": "Issue date (`YYYY-MM-DD`)."
          },
          "document_notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_number": {
            "type": [
              "string",
              "null"
            ],
            "example": "INV-00042"
          },
          "document_payment_method": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DocumentPaymentMethod"
            }
          },
          "document_po_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_schedule_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "document_shipping_address": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_terms": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of this document in an external system you sync from,\npaired with `external_source`. Optional; unique per source and\ndocument type."
          },
          "external_source": {
            "type": [
              "string",
              "null"
            ],
            "description": "System `external_id` comes from, for example `shopify`."
          },
          "is_partial_payment_allowed": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "is_recurring": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether this is a recurring template."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentItemFormModel"
            }
          },
          "late_fee_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "late_fee_term": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "meta_data": {
            "$ref": "#/components/schemas/Value"
          },
          "min_payment_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Smallest partial payment accepted, as a decimal string."
          },
          "payment_gateway_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "people_id": {
            "type": "string",
            "description": "Client or vendor identifier."
          },
          "recalculate_taxes": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Re-resolve every tax from the rate history for the issue date. By\ndefault a saved document keeps the rates it was saved with until its\nissue date changes or a tax is added."
          },
          "recurrence_days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "recurring_delivery_instruction": {
            "type": [
              "string",
              "null"
            ]
          },
          "recurring_document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "recurring_end_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "recurring_start_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "template_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "version_number": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Version of the record, increased by every saved edit.",
            "example": 1
          }
        },
        "example": {
          "currency": "USD",
          "document_issue_date": "2026-10-15",
          "document_number": "INV-1042",
          "items": [
            {
              "item_cost": "100.00",
              "item_id": "00000000-0000-4000-8000-000000000005",
              "item_quantity": "1"
            }
          ],
          "people_id": "00000000-0000-4000-8000-000000000004"
        }
      },
      "DocumentFormResponseModel": {
        "type": "object",
        "description": "The document returned after a create or update operation.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/DocumentModel"
          }
        }
      },
      "DocumentItem": {
        "type": "object",
        "required": [
          "item_type",
          "item_name",
          "item_quantity",
          "item_unit",
          "item_cost",
          "item_discount_type",
          "created_at",
          "item_sales_cost_snapshot",
          "item_purchase_cost_snapshot"
        ],
        "properties": {
          "banking_account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "credited_document_item_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Credit notes: the invoice line this line credits."
          },
          "dimension_state": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DimensionState"
              }
            ]
          },
          "expense_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the record."
          },
          "item_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "The line total as saved: quantity x unit price with the line's\nadjustments, in the document currency. Absent on lines saved before\nit was recorded."
          },
          "item_attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DocumentItemAttributeModel"
            }
          },
          "item_cost": {
            "type": "string",
            "description": "Unit price on the line, as a decimal string in the document currency."
          },
          "item_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_discount_type": {
            "type": "string"
          },
          "item_discount_value": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_name": {
            "type": "string",
            "description": "Name of the item."
          },
          "item_purchase_cost_snapshot": {
            "type": "string",
            "description": "Line unit price converted to the company base currency at the time it was priced."
          },
          "item_quantity": {
            "type": "string"
          },
          "item_sales_cost_snapshot": {
            "type": "string",
            "description": "Line unit price converted to the company base currency at the time it was priced."
          },
          "item_tax": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DocumentItemTaxDetailModel"
            }
          },
          "item_type": {
            "type": "string"
          },
          "item_unit": {
            "type": "string"
          },
          "time_sheet_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DocumentItemAttr": {
        "type": "object",
        "description": "A custom attribute assigned to a document item line.",
        "required": [
          "item_attribute_label",
          "item_attribute_description"
        ],
        "properties": {
          "item_attribute_calc_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_attribute_cost": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_attribute_description": {
            "type": "string"
          },
          "item_attribute_label": {
            "type": "string"
          },
          "item_attribute_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "optional_field_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DocumentItemAttributeModel": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "document_item_id",
          "created_at",
          "company_id"
        ],
        "properties": {
          "adjustable_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "adjusted_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "document_id": {
            "type": "string"
          },
          "document_item_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_system_defined": {
            "type": "boolean",
            "description": "Calculated by Core, never entered: today only a settling credit\nnote's `rounding` adjustment (the signed remainder of the credited\ninvoice line, in `adjusted_amount`)."
          },
          "item_attribute_calc_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_attribute_cost": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_attribute_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_attribute_label": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_attribute_type": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DocumentItemFormModel": {
        "type": "object",
        "description": "One document item line with an item UUID, quantity, and unit cost. Optional taxes, discounts, and dimensions apply to this line.",
        "required": [
          "item_id",
          "item_quantity",
          "item_cost"
        ],
        "properties": {
          "banking_account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "client_line_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "credited_document_item_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Credit notes only: the line of `credited_document_id` this line\ncredits. Requires `credited_document_id`."
          },
          "dimension_values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DimensionValueRef"
            }
          },
          "expense_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the record."
          },
          "item_attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DocumentItemAttr"
            }
          },
          "item_cost": {
            "type": "string",
            "description": "Unit price on the line, as a decimal string in the document currency."
          },
          "item_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_discount_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_discount_value": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_id": {
            "type": "string"
          },
          "item_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Name of the item."
          },
          "item_quantity": {
            "type": "string"
          },
          "item_tax": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DocumentItemTax"
            }
          },
          "item_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "time_sheet_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DocumentItemTax": {
        "type": "object",
        "description": "A tax selection attached to a document item line.",
        "properties": {
          "item_tax_position": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DocumentItemTaxDetailModel": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "document_item_id",
          "tax_id",
          "item_tax_name",
          "item_tax_rate",
          "item_tax_type",
          "item_tax_position",
          "item_taxable_amount",
          "item_tax_amount",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "document_id": {
            "type": "string"
          },
          "document_item_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_recoverable": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether this tax was recoverable when the line was saved. Absent on\nlines saved before it was recorded."
          },
          "item_tax_amount": {
            "type": "string",
            "description": "Tax on the line for this tax, as a decimal string."
          },
          "item_tax_name": {
            "type": "string"
          },
          "item_tax_position": {
            "type": "string"
          },
          "item_tax_rate": {
            "type": "string",
            "description": "Tax rate in percent, as a decimal string."
          },
          "item_tax_type": {
            "type": "string"
          },
          "item_taxable_amount": {
            "type": "string",
            "description": "Amount the tax is calculated on, as a decimal string."
          },
          "tax_id": {
            "type": "string"
          }
        }
      },
      "DocumentMailFromModel": {
        "type": "object",
        "description": "Sends a document by email using the selected recipients and message content.",
        "required": [
          "email_template_type",
          "subject",
          "body",
          "from",
          "to"
        ],
        "properties": {
          "attachment": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": [
              "string",
              "null"
            ]
          },
          "body": {
            "type": "string"
          },
          "cc": {
            "type": [
              "string",
              "null"
            ]
          },
          "email_template_type": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "is_pdf_attached": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "subject": {
            "type": "string"
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "DocumentMailFromResponseModel": {
        "type": "object",
        "description": "The result of requesting email delivery for a document.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/DocumentEmailModel"
          }
        }
      },
      "DocumentMetaData": {
        "type": "object",
        "description": "Associates a document with caller-supplied metadata.",
        "properties": {
          "anchor_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "color": {
            "type": [
              "string",
              "null"
            ]
          },
          "doc_type_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "language": {
            "type": [
              "string",
              "null"
            ]
          },
          "style": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "DocumentModel": {
        "type": "object",
        "description": "A stored accounting document with its version identity, status, dates, currency, and calculated totals.",
        "required": [
          "id",
          "document_type_id",
          "user_id",
          "company_id",
          "currency",
          "people_id",
          "template_id",
          "document_status",
          "document_number_sequence",
          "document_number",
          "document_issue_date",
          "document_sub_total",
          "document_total",
          "document_net_balance",
          "document_gross_total",
          "created_at",
          "document_exchange_rate",
          "is_partial_payment_allowed",
          "is_recurring",
          "is_accrual",
          "anchor_id",
          "document_version_id",
          "version_number",
          "is_current"
        ],
        "properties": {
          "anchor_id": {
            "type": "string",
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "banking_transaction_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "buyer_company_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "dimension_line_keys": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DimensionLineKey"
            }
          },
          "dimension_state": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DimensionState"
              }
            ]
          },
          "document_address": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_delivery_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "document_due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "Due date (`YYYY-MM-DD`); null when the document has none."
          },
          "document_exchange_rate": {
            "type": "string",
            "description": "Decimal string: one unit of the document currency equals this many units of the company base currency."
          },
          "document_gross_total": {
            "type": "string",
            "description": "Amount due: the total plus document-level adjustments, as a decimal string."
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_issue_date": {
            "type": "string",
            "format": "date",
            "description": "Issue date (`YYYY-MM-DD`)."
          },
          "document_late_fee_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Late fee charged so far, as a decimal string."
          },
          "document_late_fee_next_calculation_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "document_net_balance": {
            "type": "string",
            "description": "Amount still outstanding after payments and credits, as a decimal string."
          },
          "document_notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_number": {
            "type": "string"
          },
          "document_number_prefix": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_number_sequence": {
            "type": "string"
          },
          "document_number_suffix": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_po_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_schedule_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "document_shipping_address": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_state": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Record state: `0` active, `1` archived, `2` deleted."
          },
          "document_status": {
            "type": "string",
            "description": "Workflow status key from the module's status settings."
          },
          "document_status_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_sub_total": {
            "type": "string",
            "description": "Sum of line totals before tax and document-level adjustments, as a decimal string."
          },
          "document_terms": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_total": {
            "type": "string",
            "description": "Sub-total plus tax, before document-level adjustments, as a decimal string."
          },
          "document_type_id": {
            "type": "string"
          },
          "document_version_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_accrual": {
            "type": "boolean"
          },
          "is_current": {
            "type": "boolean"
          },
          "is_partial_payment_allowed": {
            "type": "boolean"
          },
          "is_recurring": {
            "type": "boolean",
            "description": "Whether this is a recurring template."
          },
          "late_fee_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "meta_data": {
            "type": [
              "string",
              "null"
            ]
          },
          "min_payment_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Smallest partial payment accepted, as a decimal string."
          },
          "payment_gateway_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "people_id": {
            "type": "string",
            "description": "Client or vendor identifier."
          },
          "recurring_document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "template_id": {
            "type": "string"
          },
          "threshold_crossed_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          },
          "version_number": {
            "type": "integer",
            "format": "int32",
            "description": "Version of the record, increased by every saved edit."
          }
        }
      },
      "DocumentPayment": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "anchor_id",
          "user_id",
          "company_id",
          "payment_amount",
          "payment_date",
          "is_tax_deducted",
          "created_at"
        ],
        "properties": {
          "anchor_id": {
            "type": "string",
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "bank_charge": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank fee withheld from the payment, as a decimal string. The payment amount plus this charge is applied to the document."
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "credit_note_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Credit note applied as this payment, when the payment is a credit."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "document_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_payment_approved": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "is_tax_deducted": {
            "type": "boolean"
          },
          "payment_amount": {
            "type": "string",
            "description": "Amount paid, as a decimal string."
          },
          "payment_date": {
            "type": "string",
            "format": "date",
            "description": "Date the payment was made (`YYYY-MM-DD`)."
          },
          "payment_mode": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your reference for the record, for example a PO or receipt number."
          },
          "tax_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Tax as a decimal string in the record's currency."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "updated_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "User who last changed the record."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "DocumentPaymentGatewayModel": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "company_id",
          "payment_gateway_id",
          "is_online",
          "provider"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "document_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_online": {
            "type": "boolean"
          },
          "payment_gateway_id": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          }
        }
      },
      "DocumentPaymentMethod": {
        "type": "object",
        "description": "A payment method made available on a document.",
        "required": [
          "payment_gateway_id",
          "provider",
          "is_online"
        ],
        "properties": {
          "is_online": {
            "type": "boolean"
          },
          "payment_gateway_id": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          }
        }
      },
      "DocumentPaymentModel": {
        "type": "object",
        "description": "A recorded document payment with its monetary amounts, reference, approval status, and audit metadata.",
        "required": [
          "id",
          "document_id",
          "user_id",
          "user_company_id",
          "payment_amount",
          "payment_date",
          "is_tax_deducted",
          "is_payment_approved",
          "created_at",
          "exchange_rate",
          "payment_identifier",
          "anchor_id"
        ],
        "properties": {
          "anchor_id": {
            "type": "string",
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "bank_charge": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank fee withheld from the payment, as a decimal string. The payment amount plus this charge is applied to the document."
          },
          "bank_settlement": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/BankSettlement"
              }
            ]
          },
          "banking_account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "banking_transaction_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "credit_note_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Credit note applied as this payment, when the payment is a credit."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "document_id": {
            "type": "string"
          },
          "exchange_rate": {
            "type": "string",
            "description": "Decimal string: one unit of this record's currency equals `exchange_rate` units of the company base currency. `1` when the record is in the base currency."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_payment_approved": {
            "type": "boolean"
          },
          "is_tax_deducted": {
            "type": "boolean"
          },
          "payment_amount": {
            "type": "string",
            "description": "Amount paid, as a decimal string."
          },
          "payment_date": {
            "type": "string",
            "format": "date",
            "description": "Date the payment was made (`YYYY-MM-DD`)."
          },
          "payment_identifier": {
            "type": "string"
          },
          "payment_mode": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your reference for the record, for example a PO or receipt number."
          },
          "tax_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Tax as a decimal string in the record's currency."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "updated_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "User who last changed the record."
          },
          "user_company_id": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "DocumentRecurringModel": {
        "type": "object",
        "description": "The recurrence configuration associated with a scheduled document.",
        "required": [
          "id",
          "company_id",
          "document_type_id",
          "document_id",
          "start_date",
          "recurrence_days",
          "created_at"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "delivery_instruction": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_id": {
            "type": "string"
          },
          "document_type_id": {
            "type": "string"
          },
          "end_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "End date (`YYYY-MM-DD`), inclusive; null when open-ended."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "next_occurrence_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "recurrence_days": {
            "type": "integer",
            "format": "int64"
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "description": "Start date (`YYYY-MM-DD`), inclusive."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          }
        }
      },
      "DocumentSettingChildModel": {
        "type": "object",
        "description": "A configuration option nested under a document-module setting.",
        "required": [
          "setting",
          "attribute"
        ],
        "properties": {
          "attribute": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DocumentFormAttributeModel"
            }
          },
          "setting": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "null"
              ]
            },
            "propertyNames": {
              "type": "string",
              "enum": [
                "DOCUMENT_NOTE",
                "DOCUMENT_TERM",
                "DOCUMENT_NUMBER_PREFIX",
                "DOCUMENT_NUMBER_SEQUENCE",
                "DOCUMENT_NUMBER_SUFFIX",
                "DOCUMENT_ALLOW_EDIT_SENT",
                "DOCUMENT_SHOW_ITEM_NUMBER",
                "DOCUMENT_SHOW_TAX_SUMMARY",
                "DOCUMENT_NUMBER_GENERATE_MODE",
                "DOCUMENT_ALLOW_PARTIAL_PAYMENT",
                "DOCUMENT_ALLOW_CHARGE_DISCOUNT_SUBTOTAL",
                "DOCUMENT_ALLOW_CHARGE_DISCOUNT_TOTAL",
                "DOCUMENT_ALLOW_FIELD_CHARGE_DISCOUNT_ITEM",
                "DOCUMENT_ALLOW_SCHEDULING"
              ]
            },
            "example": {
              "DOCUMENT_NUMBER_PREFIX": "IN",
              "DOCUMENT_SHOW_TAX_SUMMARY": "1"
            }
          }
        }
      },
      "DocumentSettingModel": {
        "type": "object",
        "description": "Document-module configuration and the options available to document forms.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/DocumentSettingChildModel"
          }
        }
      },
      "DocumentSettlementEstimate": {
        "type": "object",
        "required": [
          "currency",
          "amount",
          "rate",
          "rate_source",
          "rate_time",
          "as_of_date_matched",
          "estimated"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          },
          "as_of_date_matched": {
            "type": "boolean"
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "estimated": {
            "type": "boolean"
          },
          "rate": {
            "type": "string"
          },
          "rate_source": {
            "type": "string"
          },
          "rate_time": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "DocumentStatusHistoryModel": {
        "type": "object",
        "required": [
          "document_status",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "document_status": {
            "type": "string",
            "description": "Workflow status key from the module's status settings."
          }
        }
      },
      "DocumentStatusModel": {
        "type": "object",
        "description": "The workflow status assigned to a document.",
        "required": [
          "id",
          "status",
          "is_active",
          "is_user_defined",
          "is_issued",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "is_issued": {
            "type": "boolean"
          },
          "is_user_defined": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "description": "Status key from this module's status settings; the set of statuses is configured per company."
          },
          "status_category": {
            "type": [
              "string",
              "null"
            ]
          },
          "status_color": {
            "type": [
              "string",
              "null"
            ]
          },
          "status_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "User who last changed the record."
          }
        }
      },
      "DocumentSummaryStateCounts": {
        "type": "object",
        "description": "Documents per record state, under the same search filters, whichever state was requested.",
        "required": [
          "active",
          "archived",
          "deleted"
        ],
        "properties": {
          "active": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "archived": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "deleted": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "DocumentSummaryStatus": {
        "type": "object",
        "description": "Everything the document type holds in one status. The summary knows no status names: what\ncounts as open, overdue or unpaid is the caller's grouping of these rows, in the document\nmodule's own language.",
        "required": [
          "status",
          "count",
          "recurring_count",
          "gross_bcy",
          "balance_bcy",
          "due_soon_balance_bcy",
          "past_due_count",
          "past_due_balance_bcy"
        ],
        "properties": {
          "balance_bcy": {
            "type": "string",
            "description": "Net balance in base currency, at each document's own stored rate."
          },
          "count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "due_soon_balance_bcy": {
            "type": "string",
            "description": "The part of `balance_bcy` on documents due from today through `due_soon_days` ahead."
          },
          "gross_bcy": {
            "type": "string",
            "description": "Gross total in base currency, at each document's own stored rate."
          },
          "past_due_balance_bcy": {
            "type": "string",
            "description": "The part of `balance_bcy` on documents already past their due date. For workflows without an\n`overdue` status (bills) this is the overdue figure."
          },
          "past_due_count": {
            "type": "integer",
            "format": "int64",
            "description": "Documents in this status whose due date has passed (before the company's today).",
            "minimum": 0
          },
          "recurring_count": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "status": {
            "type": "string",
            "description": "Status key from this module's status settings; the set of statuses is configured per company."
          }
        }
      },
      "DocumentVersionModel": {
        "type": "object",
        "required": [
          "document_id",
          "anchor_id",
          "document_version_id",
          "company_id",
          "created_by",
          "version_number",
          "is_current"
        ],
        "properties": {
          "anchor_id": {
            "type": "string",
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "created_by": {
            "type": "string"
          },
          "document_id": {
            "type": "string"
          },
          "document_version_id": {
            "type": "string"
          },
          "is_current": {
            "type": "boolean"
          },
          "version_number": {
            "type": "integer",
            "format": "int32",
            "description": "Version of the record, increased by every saved edit."
          }
        }
      },
      "EmailTemplateTypeModel": {
        "type": "object",
        "required": [
          "id",
          "email_template_type",
          "email_subject",
          "email_body"
        ],
        "properties": {
          "email_body": {
            "type": "string"
          },
          "email_subject": {
            "type": "string"
          },
          "email_template_type": {
            "type": "string"
          },
          "from": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          }
        }
      },
      "EndpointResponse": {
        "type": "object",
        "description": "A registered webhook destination with its URL, enabled events, and delivery state.",
        "required": [
          "id",
          "url",
          "spec_version",
          "status",
          "enabled_events",
          "header_names",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "enabled_events": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "header_names": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Configured names only. Secret header values are never returned."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Display name."
          },
          "spec_version": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "`pending_verification` until the endpoint is verified, then `active`. A delivery that exhausts its retries makes it `failing`; three in a row make it `paused`. A successful delivery returns a `failing` endpoint to `active`."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "url": {
            "type": "string"
          }
        }
      },
      "EntityActivityListModel": {
        "type": "object",
        "description": "Activities associated with the entity selected by the request.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActivityDbModel"
            }
          }
        }
      },
      "EventBusinessArea": {
        "type": "object",
        "description": "The business area grouping a webhook event.",
        "required": [
          "key",
          "label",
          "label_key",
          "resource_groups"
        ],
        "properties": {
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "label_key": {
            "type": "string"
          },
          "resource_groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventResourceGroup"
            }
          }
        }
      },
      "EventResourceGroup": {
        "type": "object",
        "description": "The resource category grouping a webhook event.",
        "required": [
          "key",
          "label",
          "description",
          "label_key",
          "description_key",
          "events"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "description_key": {
            "type": "string"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EventType"
            }
          },
          "key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "label_key": {
            "type": "string"
          }
        }
      },
      "EventType": {
        "type": "object",
        "description": "A supported webhook event identifier and its catalog metadata.",
        "required": [
          "type",
          "label",
          "description",
          "label_key",
          "description_key"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "description_key": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "label_key": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        }
      },
      "ExceptionReviewRequest": {
        "type": "object",
        "description": "Records a review of a control-account exception using the supplied review details.",
        "required": [
          "note"
        ],
        "properties": {
          "note": {
            "type": "string",
            "description": "Free-text note."
          }
        }
      },
      "ExpenseAttModel": {
        "type": "object",
        "description": "A custom attribute assigned to an expense.",
        "required": [
          "attribute_label"
        ],
        "properties": {
          "attribute_label": {
            "type": "string",
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": [
              "string",
              "null"
            ],
            "description": "Custom field value."
          }
        }
      },
      "ExpenseAttachmentModel": {
        "type": "object",
        "description": "A file attachment associated with an expense.",
        "required": [
          "id",
          "attachment_name",
          "attachment_type",
          "attachment_size",
          "attachment_url",
          "created_at"
        ],
        "properties": {
          "attachment_name": {
            "type": "string"
          },
          "attachment_size": {
            "type": "string"
          },
          "attachment_type": {
            "type": "string"
          },
          "attachment_url": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "expense_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          }
        }
      },
      "ExpenseDataModel": {
        "type": "object",
        "required": [
          "id",
          "user_id",
          "company_id",
          "currency",
          "amount",
          "note",
          "expense_date",
          "is_billable",
          "is_active",
          "is_billed",
          "created_at",
          "exchange_rate",
          "is_tax_inclusive",
          "is_itemize"
        ],
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "amount": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate": {
            "type": "string",
            "description": "Decimal string: one unit of this record's currency equals `exchange_rate` units of the company base currency. `1` when the record is in the base currency."
          },
          "expense_date": {
            "type": "string",
            "format": "date",
            "description": "Date the expense was incurred (`YYYY-MM-DD`)."
          },
          "expense_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Caller-supplied id from the system that created this record (see `external_source`)."
          },
          "external_source": {
            "type": [
              "string",
              "null"
            ],
            "description": "System `external_id` comes from, for example `shopify`."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "is_billable": {
            "type": "boolean",
            "description": "Whether the time or cost can be billed to the client."
          },
          "is_billed": {
            "type": "string"
          },
          "is_itemize": {
            "type": "boolean"
          },
          "is_recurring": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether this is a recurring template."
          },
          "is_tax_inclusive": {
            "type": "boolean"
          },
          "note": {
            "type": "string",
            "description": "Free-text note."
          },
          "paid_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "people_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Client or vendor identifier."
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your reference for the record, for example a PO or receipt number."
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Expense workflow status, for example `draft`, `submitted` or `approved`."
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          },
          "vendor_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ExpenseDeleteFormModel": {
        "type": "object",
        "description": "Selects expenses to delete. Actor and company identity come from authentication.",
        "required": [
          "expense_ids"
        ],
        "properties": {
          "expense_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ExpenseDeleteResponseModel": {
        "type": "object",
        "properties": {
          "deleted_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "non_deleted_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ExpenseDetailResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ExpenseModel"
              }
            ]
          }
        }
      },
      "ExpenseFormModel": {
        "type": "object",
        "description": "Records an expense with a paid account, date, and expense lines. Currency and exchange rate describe the expense's monetary values.",
        "required": [
          "paid_account_id",
          "expense_date",
          "items"
        ],
        "properties": {
          "attachment": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/AttachmentModel"
            }
          },
          "attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/AttributeModel"
            }
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string: one unit of this record's currency equals `exchange_rate` units of the company base currency. `1` when the record is in the base currency.",
            "example": "1"
          },
          "expense_date": {
            "type": "string",
            "description": "Date the expense was incurred (`YYYY-MM-DD`).",
            "example": "2026-04-15"
          },
          "expense_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Calculate only: the saved expense this form edits, so the preview\nkeeps the rates that expense charged, as saving it would. Ignored on\ncreate and update, which take it from the path."
          },
          "invoice_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_billable": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the time or cost can be billed to the client."
          },
          "is_itemize": {
            "type": "boolean"
          },
          "is_recurring": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether this is a recurring template."
          },
          "is_tax_inclusive": {
            "type": "boolean"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseItemFormModel"
            },
            "minItems": 1
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text note."
          },
          "paid_account_id": {
            "type": "string",
            "example": "019dbf14-7e76-7852-babb-4c311341af24"
          },
          "people_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Client or vendor identifier."
          },
          "recalculate_taxes": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Re-resolve every tax from the rate history for the expense date. By\ndefault a saved expense keeps the rates it was saved with until its\ndate changes or a tax is added."
          },
          "recurring_end_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "recurring_frequency": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "recurring_start_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your reference for the record, for example a PO or receipt number."
          },
          "transaction_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "vendor_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "example": {
          "currency": "USD",
          "exchange_rate": "1",
          "expense_date": "2026-10-15",
          "items": [
            {
              "amount": "25.00",
              "description": "Printer paper",
              "expense_account_id": "00000000-0000-4000-8000-000000000006",
              "taxes": []
            }
          ],
          "note": "Office supplies",
          "paid_account_id": "00000000-0000-4000-8000-000000000001"
        }
      },
      "ExpenseItemFormModel": {
        "type": "object",
        "description": "One expense line with its posting account, description, amount, and optional taxes.",
        "required": [
          "expense_account_id",
          "description",
          "amount"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "description": "Decimal string in the record's currency.",
            "example": "350.00"
          },
          "client_line_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": "string",
            "example": "Team dinner"
          },
          "dimension_values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DimensionValueRef"
            }
          },
          "expense_account_id": {
            "type": "string",
            "example": "019dbf14-7e76-7852-babb-4c311341af24"
          },
          "source_line_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "taxes": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ExpenseItemTaxFormModel"
            }
          }
        }
      },
      "ExpenseItemTaxFormModel": {
        "type": "object",
        "description": "A tax selection attached to an expense line.",
        "properties": {
          "tax_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_position": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ExpenseItemTaxModel": {
        "type": "object",
        "description": "A stored tax amount associated with an expense line.",
        "required": [
          "id",
          "expense_id",
          "expense_item_id",
          "tax_id",
          "tax_name",
          "tax_rate",
          "tax_type",
          "tax_position",
          "taxable_amount",
          "tax_amount",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "expense_id": {
            "type": "string"
          },
          "expense_item_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_recoverable": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether this tax was recoverable when the expense was saved. Absent on\nlines saved before it was recorded."
          },
          "tax_amount": {
            "type": "string",
            "description": "Tax as a decimal string in the record's currency."
          },
          "tax_id": {
            "type": "string"
          },
          "tax_name": {
            "type": "string"
          },
          "tax_position": {
            "type": "string"
          },
          "tax_rate": {
            "type": "string",
            "description": "Tax rate in percent, as a decimal string."
          },
          "tax_type": {
            "type": "string"
          },
          "taxable_amount": {
            "type": "string",
            "description": "Amount the tax is calculated on, as a decimal string."
          }
        }
      },
      "ExpenseItemWithTaxes": {
        "type": "object",
        "description": "An expense line returned together with its tax details.",
        "required": [
          "id",
          "expense_id",
          "description",
          "amount",
          "created_at",
          "taxes"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          },
          "client_line_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "description": {
            "type": "string"
          },
          "dimension_state": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DimensionState"
              }
            ]
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "expense_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "expense_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseItemTaxModel"
            }
          }
        }
      },
      "ExpenseListModel": {
        "type": "object",
        "required": [
          "total_records",
          "page_size",
          "page_number",
          "expenses",
          "status_badges",
          "cards"
        ],
        "properties": {
          "cards": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CardData"
            }
          },
          "expenses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExpenseDataModel"
            }
          },
          "page_number": {
            "type": "integer",
            "format": "int64",
            "description": "Page returned, 1-based.",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "description": "Records per page in this response.",
            "minimum": 0
          },
          "status_badges": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/StatusMetaData"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "total_records": {
            "type": "integer",
            "format": "int64",
            "description": "Records matching the filters, across all pages.",
            "minimum": 0
          }
        }
      },
      "ExpenseListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ExpenseListModel"
              }
            ]
          }
        }
      },
      "ExpenseModel": {
        "type": "object",
        "description": "A stored expense with its status, currency, references, and audit metadata.",
        "required": [
          "id",
          "currency",
          "amount",
          "exchange_rate",
          "note",
          "expense_date",
          "is_active",
          "is_itemize",
          "is_tax_inclusive",
          "is_billed",
          "created_at"
        ],
        "properties": {
          "account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "amount": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          },
          "attachment": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ExpenseAttachmentModel"
            }
          },
          "attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ExpenseAttModel"
            }
          },
          "can_edit": {
            "type": "boolean",
            "description": "Whether the expense state allows edits. Permissions and governance locks\nare still checked when a write is attempted."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "dimension_state": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DimensionState"
              }
            ]
          },
          "document_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "document_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate": {
            "type": "string",
            "description": "Decimal string: one unit of this record's currency equals `exchange_rate` units of the company base currency. `1` when the record is in the base currency."
          },
          "expense_date": {
            "type": "string",
            "format": "date",
            "description": "Date the expense was incurred (`YYYY-MM-DD`)."
          },
          "expense_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "is_billable": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the time or cost can be billed to the client."
          },
          "is_billed": {
            "type": "string"
          },
          "is_itemize": {
            "type": "boolean"
          },
          "is_recurring": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether this is a recurring template."
          },
          "is_tax_inclusive": {
            "type": "boolean"
          },
          "items": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ExpenseItemWithTaxes"
            }
          },
          "note": {
            "type": "string",
            "description": "Free-text note."
          },
          "paid_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "people_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Client or vendor identifier."
          },
          "recurring_end_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "recurring_frequency": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "recurring_next_schedule": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "recurring_start_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your reference for the record, for example a PO or receipt number."
          },
          "status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Expense workflow status, for example `draft`, `submitted` or `approved`."
          },
          "status_actions": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ExpenseUIData"
              }
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "vendor_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "workflow": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ExpenseStatus": {
        "type": "string",
        "description": "The supported workflow states of an expense.",
        "enum": [
          "Draft",
          "Submitted",
          "Approved",
          "Rejected",
          "Cancelled",
          "Reserved",
          "Billed",
          "Invoiced",
          "PartialPaid",
          "Paid",
          "Settled"
        ]
      },
      "ExpenseStatusUpdateResult": {
        "type": "object",
        "description": "The outcome of changing an expense's workflow status.",
        "required": [
          "success_count",
          "error_count",
          "successful_updates",
          "failed_updates"
        ],
        "properties": {
          "error_count": {
            "type": "integer",
            "minimum": 0
          },
          "failed_updates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FailedUpdate"
            }
          },
          "success_count": {
            "type": "integer",
            "minimum": 0
          },
          "successful_updates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SuccessfulUpdate"
            }
          }
        }
      },
      "ExpenseUIData": {
        "type": "object",
        "required": [
          "ui_elements"
        ],
        "properties": {
          "ui_elements": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Action"
            }
          }
        }
      },
      "FailedUpdate": {
        "type": "object",
        "required": [
          "expense_id",
          "previous_status",
          "new_status",
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "expense_id": {
            "type": "string"
          },
          "new_status": {
            "type": "string",
            "description": "Status the transition tried to reach."
          },
          "previous_status": {
            "type": "string",
            "description": "Expense status when the transition was attempted."
          }
        }
      },
      "FormAttributeModel": {
        "type": "object",
        "required": [
          "attribute_label"
        ],
        "properties": {
          "attribute_label": {
            "type": "string",
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": [
              "string",
              "null"
            ],
            "description": "Custom field value."
          },
          "show_in_form": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      },
      "FullyConnectedStripConnectModel": {
        "type": "object",
        "required": [
          "id",
          "stripe_account_id",
          "stripe_email",
          "connection_label"
        ],
        "properties": {
          "connection_label": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "stripe_account_id": {
            "type": "string"
          },
          "stripe_email": {
            "type": "string"
          }
        }
      },
      "FxRateSource": {
        "type": "string",
        "description": "Where a resolved exchange rate came from.",
        "enum": [
          "automatic",
          "custom"
        ]
      },
      "FxResolveItem": {
        "type": "object",
        "required": [
          "base",
          "target"
        ],
        "properties": {
          "at": {
            "type": [
              "string",
              "null"
            ],
            "description": "Transaction date: `YYYY-MM-DD` (company-local) or RFC 3339. Omit for today.",
            "example": "2026-09-01"
          },
          "base": {
            "type": "string",
            "description": "Currency to convert from (ISO 4217).",
            "example": "AUD"
          },
          "target": {
            "type": "string",
            "description": "Currency to convert into (ISO 4217).",
            "example": "USD"
          }
        }
      },
      "FxResolveRequest": {
        "type": "object",
        "description": "Resolves exchange rates for a bounded set of currency and date selections.",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/FxResolveItem"
            },
            "description": "1–500 lookups."
          }
        }
      },
      "FxResolveResult": {
        "type": "object",
        "description": "One resolved lookup, in request order. `rate` is `null` with `error = RATE_NOT_FOUND`\nwhen neither a custom nor an automatic rate exists for the pair.",
        "required": [
          "base",
          "target",
          "as_of_date_matched"
        ],
        "properties": {
          "as_of_date_matched": {
            "type": "boolean"
          },
          "at": {
            "type": [
              "string",
              "null"
            ]
          },
          "base": {
            "type": "string"
          },
          "custom_rate_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ]
          },
          "rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/FxRateSource"
              }
            ]
          },
          "target": {
            "type": "string"
          },
          "time": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "GeneralLedgerEntry": {
        "type": "object",
        "required": [
          "id",
          "account",
          "account_currency",
          "account_subtype",
          "account_type"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "account_currency": {
            "type": "string"
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank account number, when the account is a bank account."
          },
          "account_subtype": {
            "type": "string",
            "description": "Account subtype within its classification."
          },
          "account_type": {
            "type": "string",
            "description": "Account classification: `asset`, `liability`, `equity`, `revenue` or `expense`."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "total_credit_bcy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Total credits in the company base currency, as a decimal string."
          },
          "total_credit_fcy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Total credits in the transaction currency, as a decimal string."
          },
          "total_debit_bcy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Total debits in the company base currency, as a decimal string."
          },
          "total_debit_fcy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Total debits in the transaction currency, as a decimal string."
          }
        }
      },
      "InternalServerErrorResponse": {
        "type": "string",
        "description": "An unexpected server error, returned as a JSON string. Some operations instead return\nthe standard error envelope; the 500 response schema documents both shapes.",
        "example": "INTERNAL_SERVER_ERROR"
      },
      "ItemAttModel": {
        "type": "object",
        "description": "A custom attribute assigned to an item.",
        "required": [
          "item_id",
          "attribute_label"
        ],
        "properties": {
          "attribute_label": {
            "type": "string",
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": [
              "string",
              "null"
            ],
            "description": "Custom field value."
          },
          "is_system_defined": {
            "type": "boolean",
            "description": "`true` for system fields, such as identifiers written by a connected\nintegration. They are read-only and cannot be changed through the API."
          },
          "item_id": {
            "type": "string"
          },
          "show_in_form": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      },
      "ItemAttributeModel": {
        "type": "object",
        "description": "A custom field on an item.\n\nAn update replaces the item's custom fields with the ones sent. System\nfields (`is_system_defined: true` on reads) cannot be written here and\nare kept unchanged. Extra keys copied from a GET response are ignored.",
        "required": [
          "attribute_label",
          "attribute_value"
        ],
        "properties": {
          "attribute_label": {
            "type": "string",
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": "string",
            "description": "Custom field value."
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the record."
          },
          "show_in_form": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      },
      "ItemDirectoryResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "object",
              "null"
            ],
            "description": "Directory keyed by item ID. Each value contains the ItemModel fields\nshown under Child Attributes. Null when empty.",
            "additionalProperties": {
              "$ref": "#/components/schemas/ItemModel"
            },
            "propertyNames": {
              "type": "string"
            }
          }
        }
      },
      "ItemFormModel": {
        "type": "object",
        "description": "Creates or updates an inventory or service item, including its SKU and optional sales and purchase configurations.",
        "required": [
          "item_name",
          "sku"
        ],
        "properties": {
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "dimension_values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DimensionValueRef"
            }
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of this item in an external system you sync from, paired\nwith `external_source`. Optional; unique per source."
          },
          "external_source": {
            "type": [
              "string",
              "null"
            ],
            "description": "System `external_id` comes from, for example `shopify`."
          },
          "has_purchase_price": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the item has a non-zero purchase price (is bought)."
          },
          "has_sales_price": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the item has a non-zero sales price (is sold)."
          },
          "is_active": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the record is active."
          },
          "item_attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ItemAttributeModel"
            }
          },
          "item_name": {
            "type": "string",
            "description": "Name of the item."
          },
          "item_type": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ItemType"
              }
            ]
          },
          "item_unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_price": {
            "type": [
              "string",
              "null"
            ],
            "description": "Default purchase price, as a decimal string in the item purchase currency."
          },
          "purchase_tax_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "sales_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "sales_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "sales_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "sales_price": {
            "type": [
              "string",
              "null"
            ],
            "description": "Default sales price, as a decimal string in the item sales currency."
          },
          "sales_tax_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "sku": {
            "type": "string"
          }
        },
        "example": {
          "has_purchase_price": false,
          "has_sales_price": false,
          "item_name": "Consulting hour",
          "item_type": "service",
          "purchase_currency": "USD",
          "sales_currency": "USD",
          "sku": "CONSULTING-HOUR"
        }
      },
      "ItemFormResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/ItemFormResultModel"
          }
        }
      },
      "ItemFormResultModel": {
        "type": "object",
        "required": [
          "id",
          "user_id",
          "company_id",
          "item_name",
          "item_quantity",
          "item_cost",
          "is_active",
          "item_type",
          "sku",
          "has_sales_price",
          "sales_price",
          "sales_currency",
          "has_purchase_price",
          "purchase_price",
          "purchase_currency"
        ],
        "properties": {
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "cost_for_client": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "dimension_state": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DimensionState"
              }
            ]
          },
          "has_purchase_price": {
            "type": "boolean",
            "description": "Whether the item has a non-zero purchase price (is bought)."
          },
          "has_sales_price": {
            "type": "boolean",
            "description": "Whether the item has a non-zero sales price (is sold)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "item_cost": {
            "type": "string",
            "description": "Unit price on the line, as a decimal string in the document currency."
          },
          "item_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_name": {
            "type": "string",
            "description": "Name of the item."
          },
          "item_quantity": {
            "type": "string"
          },
          "item_tax": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_type": {
            "type": "string"
          },
          "item_unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_currency": {
            "type": "string"
          },
          "purchase_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_price": {
            "type": "string",
            "description": "Default purchase price, as a decimal string in the item purchase currency."
          },
          "purchase_tax_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "sales_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "sales_currency": {
            "type": "string"
          },
          "sales_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "sales_price": {
            "type": "string",
            "description": "Default sales price, as a decimal string in the item sales currency."
          },
          "sales_tax_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "sku": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "ItemListModel": {
        "type": "object",
        "required": [
          "total_records",
          "page_size",
          "page_number",
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ItemModelForList"
            }
          },
          "page_number": {
            "type": "integer",
            "format": "int64",
            "description": "Page returned, 1-based.",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "description": "Records per page in this response.",
            "minimum": 0
          },
          "total_records": {
            "type": "integer",
            "format": "int64",
            "description": "Records matching the filters, across all pages.",
            "minimum": 0
          }
        }
      },
      "ItemListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ItemListModel"
              }
            ]
          }
        }
      },
      "ItemModel": {
        "type": "object",
        "required": [
          "id",
          "user_id",
          "company_id",
          "sku",
          "item_name",
          "item_quantity",
          "item_cost",
          "is_active",
          "item_type",
          "has_sales_price",
          "sales_price",
          "sales_currency",
          "has_purchase_price",
          "purchase_price",
          "purchase_currency"
        ],
        "properties": {
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "cost_for_client": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "dimension_state": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DimensionState"
              }
            ]
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_source": {
            "type": [
              "string",
              "null"
            ],
            "description": "System `external_id` comes from, for example `shopify`."
          },
          "has_purchase_price": {
            "type": "boolean",
            "description": "Whether the item has a non-zero purchase price (is bought)."
          },
          "has_sales_price": {
            "type": "boolean",
            "description": "Whether the item has a non-zero sales price (is sold)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "item_attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ItemAttModel"
            }
          },
          "item_cost": {
            "type": "string",
            "description": "Unit price on the line, as a decimal string in the document currency."
          },
          "item_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_name": {
            "type": "string",
            "description": "Name of the item."
          },
          "item_quantity": {
            "type": "string"
          },
          "item_tax": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_type": {
            "type": "string"
          },
          "item_unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "pricing": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ItemPriceResult"
              }
            ]
          },
          "purchase_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_currency": {
            "type": "string"
          },
          "purchase_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_price": {
            "type": "string",
            "description": "Default purchase price, as a decimal string in the item purchase currency."
          },
          "purchase_tax_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "sales_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "sales_currency": {
            "type": "string"
          },
          "sales_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "sales_price": {
            "type": "string",
            "description": "Default sales price, as a decimal string in the item sales currency."
          },
          "sales_tax_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "sku": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "ItemModelForList": {
        "type": "object",
        "description": "An item summary returned by the paginated item list.",
        "required": [
          "id",
          "user_id",
          "company_id",
          "item_name",
          "item_quantity",
          "item_cost",
          "is_active",
          "item_type",
          "sku",
          "has_sales_price",
          "sales_price",
          "sales_currency",
          "has_purchase_price",
          "purchase_price",
          "purchase_currency"
        ],
        "properties": {
          "barcode": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "cost_for_client": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Caller-supplied id from the system that created this record (see `external_source`)."
          },
          "external_source": {
            "type": [
              "string",
              "null"
            ],
            "description": "System `external_id` comes from, for example `shopify`."
          },
          "has_purchase_price": {
            "type": "boolean",
            "description": "Whether the item has a non-zero purchase price (is bought)."
          },
          "has_sales_price": {
            "type": "boolean",
            "description": "Whether the item has a non-zero sales price (is sold)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "item_cost": {
            "type": "string",
            "description": "Unit price on the line, as a decimal string in the document currency."
          },
          "item_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_name": {
            "type": "string",
            "description": "Name of the item."
          },
          "item_quantity": {
            "type": "string"
          },
          "item_tax": {
            "type": [
              "string",
              "null"
            ]
          },
          "item_type": {
            "type": "string"
          },
          "item_unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_currency": {
            "type": "string"
          },
          "purchase_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "purchase_price": {
            "type": "string",
            "description": "Default purchase price, as a decimal string in the item purchase currency."
          },
          "purchase_tax_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "sales_account_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "sales_currency": {
            "type": "string"
          },
          "sales_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "sales_price": {
            "type": "string",
            "description": "Default sales price, as a decimal string in the item sales currency."
          },
          "sales_tax_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "sku": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "ItemPriceResult": {
        "type": "object",
        "description": "An item's resolved price in the requested pricing context.",
        "required": [
          "item_cost",
          "resolved_taxes"
        ],
        "properties": {
          "banking_account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "item_cost": {
            "type": "string",
            "description": "Unit price on the line, as a decimal string in the document currency."
          },
          "item_purchase_cost_snapshot": {
            "type": [
              "string",
              "null"
            ],
            "description": "Line unit price converted to the company base currency at the time it was priced."
          },
          "item_sales_cost_snapshot": {
            "type": [
              "string",
              "null"
            ],
            "description": "Line unit price converted to the company base currency at the time it was priced."
          },
          "resolved_taxes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "ItemType": {
        "type": "string",
        "description": "Whether an item is a physical good or a service.",
        "enum": [
          "goods",
          "service"
        ]
      },
      "JournalDimensionCaptureState": {
        "type": "object",
        "required": [
          "lines"
        ],
        "properties": {
          "lines": {
            "type": "object",
            "description": "Concrete persisted user-line IDs, excluding generated FX rounding rows.",
            "additionalProperties": {
              "$ref": "#/components/schemas/JournalDimensionLineState"
            },
            "propertyNames": {
              "type": "string"
            }
          }
        }
      },
      "JournalDimensionLineState": {
        "type": "object",
        "required": [
          "dimension_state"
        ],
        "properties": {
          "client_line_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "dimension_state": {
            "$ref": "#/components/schemas/DimensionState"
          }
        }
      },
      "JournalEntryMetadata": {
        "type": "object",
        "description": "Links a journal to the originating entity using the caller's entity type and external reference.",
        "required": [
          "root_entity_type",
          "root_entity_id"
        ],
        "properties": {
          "custom_data": {
            "description": "Custom module-specific data"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "related_entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "related_entity_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "root_entity_id": {
            "type": "string"
          },
          "root_entity_type": {
            "type": "string"
          }
        }
      },
      "JournalIdModel": {
        "type": "object",
        "required": [
          "journal_id",
          "journal_line_id"
        ],
        "properties": {
          "journal_id": {
            "type": "string"
          },
          "journal_line_id": {
            "type": "string"
          }
        }
      },
      "JournalLineItem": {
        "type": "object",
        "description": "A stored journal posting line with its account, amount, side, and reconciliation metadata.",
        "required": [
          "id",
          "account_id",
          "amount",
          "base_currency_amount",
          "type",
          "is_reconciled",
          "created_at",
          "banking_journal_id"
        ],
        "properties": {
          "account_id": {
            "type": "string",
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "amount": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          },
          "banking_journal_id": {
            "type": "string"
          },
          "base_currency_amount": {
            "type": "string",
            "description": "Amount converted to the company base currency, as a decimal string."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_reconciled": {
            "type": "boolean"
          },
          "line_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "people_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Client or vendor identifier."
          },
          "type": {
            "type": "string"
          }
        }
      },
      "JournalLineModel": {
        "type": "object",
        "description": "One debit or credit posting to an existing company account. A journal must balance across all lines; account codes do not resolve account IDs.",
        "required": [
          "account_id",
          "description"
        ],
        "properties": {
          "account_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional account code metadata; does not resolve or replace account_id."
          },
          "account_id": {
            "type": "string",
            "description": "UUID of an existing posting account in this company. Account codes do not replace this ID."
          },
          "account_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account name in the chart of accounts."
          },
          "client_line_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit": {
            "type": [
              "string",
              "null"
            ],
            "description": "Credit amount as a decimal string. Set a positive debit or credit, never both."
          },
          "debit": {
            "type": [
              "string",
              "null"
            ],
            "description": "Debit amount as a decimal string. Set a positive debit or credit, never both."
          },
          "description": {
            "type": "string",
            "description": "Line description, between 3 and 200 characters."
          },
          "dimension_values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DimensionValueRef"
            }
          },
          "dimensions": {
            "type": "object",
            "description": "Resolved posting facts. Owning source adapters validate these before posting.",
            "additionalProperties": {
              "type": "string"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "is_tax": {
            "type": "boolean"
          },
          "is_taxable": {
            "type": "boolean"
          },
          "line_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "people_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Client or vendor identifier."
          },
          "source_line_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_direction": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_meta_data": {
            "description": "Free-form JSON; keys and values depend on the producing workflow."
          }
        }
      },
      "JournalReportEntry": {
        "type": "object",
        "required": [
          "id"
        ],
        "properties": {
          "account": {
            "type": [
              "string",
              "null"
            ]
          },
          "account_subtype": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account subtype within its classification."
          },
          "account_type": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account classification: `asset`, `liability`, `equity`, `revenue` or `expense`."
          },
          "balance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string in the record's currency."
          },
          "credit": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit_fcy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Credit in the transaction currency, as a decimal string."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "debit": {
            "type": [
              "string",
              "null"
            ]
          },
          "debit_fcy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Debit in the transaction currency, as a decimal string."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "entity": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "identifier": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_manual_override": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "override_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "JournalVersionHistoryItem": {
        "type": "object",
        "description": "An entry in a journal's version history. Version-row IDs differ from the stable journal anchor.",
        "required": [
          "id",
          "version_number",
          "is_current",
          "created_at",
          "transaction_hash",
          "is_voided"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_current": {
            "type": "boolean"
          },
          "is_voided": {
            "type": "boolean"
          },
          "prev_hash": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_hash": {
            "type": "string"
          },
          "version_number": {
            "type": "integer",
            "format": "int32",
            "description": "Version of the record, increased by every saved edit."
          }
        }
      },
      "JournalVoidError": {
        "type": "object",
        "description": "A per-journal failure returned when a void request cannot be applied.",
        "required": [
          "journal_id",
          "error"
        ],
        "properties": {
          "error": {
            "type": "string"
          },
          "identifier": {
            "type": [
              "string",
              "null"
            ]
          },
          "journal_id": {
            "type": "string"
          }
        }
      },
      "JournalVoidSuccess": {
        "type": "object",
        "description": "Identifies a journal successfully voided by the operation.",
        "required": [
          "journal_id"
        ],
        "properties": {
          "identifier": {
            "type": [
              "string",
              "null"
            ]
          },
          "journal_id": {
            "type": "string"
          }
        }
      },
      "LateFeeDbModel": {
        "type": "object",
        "required": [
          "id",
          "user_id",
          "company_id",
          "label",
          "rate",
          "calc_type",
          "is_active",
          "term",
          "calc_base"
        ],
        "properties": {
          "calc_base": {
            "type": "string"
          },
          "calc_type": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "label": {
            "type": "string"
          },
          "rate": {
            "type": "string"
          },
          "term": {
            "type": "integer",
            "format": "int64"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "LateFeeDetailResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/LateFeeDbModel"
              }
            ]
          }
        }
      },
      "LateFeeFormModel": {
        "type": "object",
        "description": "Creates or updates a late-fee rule used by document payment terms.",
        "required": [
          "label",
          "rate",
          "term",
          "calc_type",
          "calc_base"
        ],
        "properties": {
          "calc_base": {
            "type": "string"
          },
          "calc_type": {
            "type": "string"
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the record is active."
          },
          "label": {
            "type": "string"
          },
          "rate": {
            "type": "string"
          },
          "term": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "LateFeeFormResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/LateFeeDbModel"
          }
        }
      },
      "LedgerEffect": {
        "type": "string",
        "description": "What a document status transition should do to the entity's own journal.\nStored on `document_state_transition`, independent of the free-text status\nlabel (which operators can write in any language).",
        "enum": [
          "none",
          "post",
          "void",
          "payment"
        ]
      },
      "LedgerTransaction": {
        "type": "object",
        "required": [
          "journal_id",
          "journal_currency",
          "journal_identifier",
          "journal_date",
          "debit_fcy",
          "credit_fcy",
          "debit_bcy",
          "credit_bcy",
          "running_balance_bcy"
        ],
        "properties": {
          "credit_bcy": {
            "type": "string",
            "description": "Credit in the company base currency, as a decimal string."
          },
          "credit_fcy": {
            "type": "string",
            "description": "Credit in the transaction currency, as a decimal string."
          },
          "debit_bcy": {
            "type": "string",
            "description": "Debit in the company base currency, as a decimal string."
          },
          "debit_fcy": {
            "type": "string",
            "description": "Debit in the transaction currency, as a decimal string."
          },
          "entity_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "journal_currency": {
            "type": "string"
          },
          "journal_date": {
            "type": "string",
            "format": "date"
          },
          "journal_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "journal_id": {
            "type": "string"
          },
          "journal_identifier": {
            "type": "string"
          },
          "running_balance_bcy": {
            "type": "string",
            "description": "Account balance after this entry, in the company base currency."
          }
        }
      },
      "Locale": {
        "type": "object",
        "description": "A supported locale used for formatting and localization.",
        "required": [
          "country_code",
          "code",
          "name"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "country_code": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "Display name."
          }
        }
      },
      "LocaleListModel": {
        "type": "object",
        "description": "The supported locales available to company and counterparty forms.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Locale"
            }
          }
        }
      },
      "LocaleModel": {
        "type": "object",
        "description": "A locale option with its identifier and display metadata.",
        "required": [
          "code",
          "name"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "Display name."
          }
        }
      },
      "MatchGroupTransactionModel": {
        "type": "object",
        "description": "Selects bank transactions and accounting records to reconcile as a group.",
        "required": [
          "transactions",
          "selection"
        ],
        "properties": {
          "match_policy_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "selection": {
            "type": "string"
          },
          "transactions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "MatchModel": {
        "type": "object",
        "required": [
          "transaction_id",
          "amount",
          "currency",
          "date"
        ],
        "properties": {
          "amount": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          },
          "confidence_tier": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "doc_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "doc_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "doc_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "doc_description": {
            "type": [
              "string",
              "null"
            ]
          },
          "doc_exchange_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "doc_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "doc_people": {
            "type": [
              "string",
              "null"
            ]
          },
          "doc_reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "doc_status": {
            "type": [
              "string",
              "null"
            ],
            "description": "Workflow status of the matched document."
          },
          "entity": {
            "type": [
              "string",
              "null"
            ]
          },
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "match_reasons": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "score": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_id": {
            "type": "string"
          }
        }
      },
      "OAuthAuthorizationPreviewModel": {
        "type": "object",
        "description": "The application and requested access shown before an OAuth authorization decision.",
        "required": [
          "client_id",
          "client_name",
          "permissions"
        ],
        "properties": {
          "client_id": {
            "type": "string"
          },
          "client_name": {
            "type": "string"
          },
          "client_uri": {
            "type": [
              "string",
              "null"
            ]
          },
          "logo_uri": {
            "type": [
              "string",
              "null"
            ]
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "OAuthAuthorizationPreviewResponseModel": {
        "type": "object",
        "description": "The authorization preview returned for an OAuth consent flow.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/OAuthAuthorizationPreviewModel"
          }
        }
      },
      "OAuthAuthorizationServerMetadataModel": {
        "type": "object",
        "description": "OAuth authorization-server discovery metadata, including supported endpoints and capabilities.",
        "required": [
          "issuer",
          "authorization_endpoint",
          "token_endpoint",
          "registration_endpoint",
          "response_types_supported",
          "grant_types_supported",
          "code_challenge_methods_supported",
          "token_endpoint_auth_methods_supported",
          "scopes_supported"
        ],
        "properties": {
          "authorization_endpoint": {
            "type": "string"
          },
          "code_challenge_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "grant_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "issuer": {
            "type": "string"
          },
          "registration_endpoint": {
            "type": "string"
          },
          "response_types_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "scopes_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "token_endpoint": {
            "type": "string"
          },
          "token_endpoint_auth_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "OAuthClientRegistrationFormModel": {
        "type": "object",
        "description": "Registers an OAuth client with redirect URIs and supported authentication settings.",
        "required": [
          "redirect_uris"
        ],
        "properties": {
          "client_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "client_uri": {
            "type": [
              "string",
              "null"
            ]
          },
          "grant_types": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "logo_uri": {
            "type": [
              "string",
              "null"
            ]
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Optional at dynamic registration. Effective MCP permissions are granted\nduring the OAuth consent flow, not required upfront at register time."
          },
          "redirect_uris": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "response_types": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "scope": {
            "type": [
              "string",
              "null"
            ],
            "description": "RFC 7591 scope string; normalized into `permissions` when that field is empty."
          },
          "token_endpoint_auth_method": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "OAuthClientRegistrationModel": {
        "type": "object",
        "description": "The registered OAuth client's identifiers and protocol settings.",
        "required": [
          "id",
          "client_id",
          "client_secret",
          "client_id_issued_at",
          "client_name",
          "permissions",
          "redirect_uris",
          "grant_types",
          "response_types",
          "token_endpoint_auth_method"
        ],
        "properties": {
          "client_id": {
            "type": "string"
          },
          "client_id_issued_at": {
            "type": "integer",
            "format": "int64"
          },
          "client_name": {
            "type": "string"
          },
          "client_secret": {
            "type": "string"
          },
          "client_uri": {
            "type": [
              "string",
              "null"
            ]
          },
          "grant_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "logo_uri": {
            "type": [
              "string",
              "null"
            ]
          },
          "permissions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "redirect_uris": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "response_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "token_endpoint_auth_method": {
            "type": "string"
          }
        }
      },
      "OAuthProtectedResourceMetadataModel": {
        "type": "object",
        "description": "OAuth protected-resource discovery metadata describing the resource and its authorization servers.",
        "required": [
          "resource",
          "authorization_servers",
          "bearer_methods_supported",
          "scopes_supported"
        ],
        "properties": {
          "authorization_servers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bearer_methods_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "resource": {
            "type": "string"
          },
          "scopes_supported": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "PaymentFromModel": {
        "type": "object",
        "description": "Records a document payment. The document comes from the URL; tenant and actor identity\ncome from authentication. Amounts are decimal strings in the document currency.",
        "required": [
          "payment_mode",
          "payment_amount",
          "payment_date",
          "reference_number",
          "deposit_account"
        ],
        "properties": {
          "anchor_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "bank_charge": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank fee withheld from the payment, as a decimal string. The payment amount plus this charge is applied to the document."
          },
          "banking_transaction_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit_note_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Credit note applied as this payment, when the payment is a credit."
          },
          "deposit_account": {
            "type": "string",
            "description": "UUID of the bank or cash account receiving or funding the payment."
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string: one unit of this record's currency equals `exchange_rate` units of the company base currency. `1` when the record is in the base currency."
          },
          "is_tax_deducted": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "payment_amount": {
            "type": "string",
            "description": "Payment amount in document currency, as a decimal string."
          },
          "payment_date": {
            "type": "string",
            "description": "Payment date in YYYY-MM-DD format."
          },
          "payment_mode": {
            "type": "string",
            "description": "Payment method identifier."
          },
          "receiver_mode": {
            "type": "boolean"
          },
          "reference_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_number": {
            "type": "string",
            "description": "Reference supplied by the payer or payment provider, such as a transfer or receipt number."
          },
          "tax_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Tax as a decimal string in the record's currency."
          }
        },
        "example": {
          "deposit_account": "00000000-0000-4000-8000-000000000001",
          "payment_amount": "100.00",
          "payment_date": "2026-10-15",
          "payment_mode": "bank_transfer",
          "reference_number": "TRANSFER-1042"
        }
      },
      "PaymentFromResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/DocumentPaymentModel"
          }
        }
      },
      "PendingCompanyPaymentModel": {
        "type": "object",
        "required": [
          "company_quantity"
        ],
        "properties": {
          "company_quantity": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "payment_url": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "PeopleAttributeDetailModel": {
        "type": "object",
        "required": [
          "id",
          "people_id",
          "attribute_label",
          "attribute_value",
          "created_at",
          "company_id"
        ],
        "properties": {
          "attribute_label": {
            "type": "string",
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": "string",
            "description": "Custom field value."
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_system_defined": {
            "type": "boolean",
            "description": "`true` for system fields, such as identifiers written by a connected\nintegration. They are read-only and cannot be changed through the API."
          },
          "people_id": {
            "type": "string",
            "description": "Client or vendor identifier."
          },
          "show_in_pdf": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      },
      "PeopleAttributeModel": {
        "type": "object",
        "description": "A custom field on a client or vendor.\n\nAn update replaces the record's custom fields with the ones sent. System\nfields (`is_system_defined: true` on reads) cannot be written here and\nare kept unchanged. Extra keys copied from a GET response are ignored.",
        "required": [
          "attribute_label",
          "attribute_value"
        ],
        "properties": {
          "attribute_label": {
            "type": "string",
            "description": "Custom field name."
          },
          "attribute_value": {
            "type": "string",
            "description": "Custom field value."
          },
          "show_in_pdf": {
            "type": [
              "boolean",
              "null"
            ]
          }
        }
      },
      "PeopleContactDetailModel": {
        "type": "object",
        "description": "An additional customer or vendor contact and communication details.",
        "required": [
          "id",
          "people_id",
          "email",
          "created_at",
          "company_id"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "contact_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "contact_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "email": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "people_id": {
            "type": "string",
            "description": "Client or vendor identifier."
          }
        }
      },
      "PeopleContactModel": {
        "type": "object",
        "description": "An additional customer or vendor contact and communication details.",
        "required": [
          "contact_name",
          "email"
        ],
        "properties": {
          "contact_name": {
            "type": "string"
          },
          "contact_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          }
        }
      },
      "PeopleData": {
        "type": "object",
        "description": "Counterparty details grouped for a customer or vendor response.",
        "required": [
          "id",
          "user_id",
          "company_id",
          "currency",
          "locale",
          "people_type",
          "company_name",
          "company_email",
          "is_active",
          "is_portal_enabled",
          "created_at"
        ],
        "properties": {
          "billing_city": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_country": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "State, province or region of the address."
          },
          "billing_street1": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_street2": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_zip": {
            "type": [
              "string",
              "null"
            ]
          },
          "buyer_company_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_email": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "company_name": {
            "type": "string",
            "description": "Company or business name."
          },
          "contact_first_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "First name of the contact person."
          },
          "contact_last_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Last name of the contact person."
          },
          "contact_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "dimension_state": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DimensionState"
              }
            ]
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "external_source": {
            "type": [
              "string",
              "null"
            ],
            "description": "System `external_id` comes from, for example `shopify`."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "internal_notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "is_portal_enabled": {
            "type": "boolean"
          },
          "late_fee": {
            "type": [
              "string",
              "null"
            ]
          },
          "locale": {
            "type": "string",
            "description": "Locale used for language and number formats, for example `en_US`."
          },
          "payment_term": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "people_attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/PeopleAttributeDetailModel"
            }
          },
          "people_contact": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/PeopleContactDetailModel"
            }
          },
          "people_type": {
            "type": "string"
          },
          "shipping_city": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_country": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "State, province or region of the address."
          },
          "shipping_street1": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_street2": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_zip": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "PeopleDeleteResponseModel": {
        "type": "object",
        "required": [
          "delete_id"
        ],
        "properties": {
          "delete_id": {
            "type": "string"
          }
        }
      },
      "PeopleDetailResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/PeopleData"
              }
            ]
          }
        }
      },
      "PeopleFormModel": {
        "type": "object",
        "description": "Creates or updates a customer or vendor, including currency, locale, company details, contacts, and addresses.",
        "required": [
          "currency",
          "locale",
          "company_name",
          "company_email",
          "contact_first_name"
        ],
        "properties": {
          "billing_city": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_country": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "State, province or region of the address."
          },
          "billing_street1": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_street2": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_zip": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_email": {
            "type": "string"
          },
          "company_name": {
            "type": "string",
            "description": "Company or business name."
          },
          "contact_first_name": {
            "type": "string",
            "description": "First name of the contact person.",
            "minLength": 3
          },
          "contact_last_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Last name of the contact person."
          },
          "contact_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "dimension_values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DimensionValueRef"
            }
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of this client or vendor in an external system you sync\nfrom, paired with `external_source`. Optional; unique per source."
          },
          "external_source": {
            "type": [
              "string",
              "null"
            ],
            "description": "System `external_id` comes from, for example `shopify`."
          },
          "internal_notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_portal_enabled": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "late_fee": {
            "type": [
              "string",
              "null"
            ]
          },
          "locale": {
            "type": "string",
            "description": "Locale used for language and number formats, for example `en_US`."
          },
          "partner_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_term": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "people_attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/PeopleAttributeModel"
            }
          },
          "people_contact": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/PeopleContactModel"
            }
          },
          "shipping_city": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_country": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "State, province or region of the address."
          },
          "shipping_street1": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_street2": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_zip": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "example": {
          "company_email": "billing@example.com",
          "company_name": "Example Studio",
          "contact_first_name": "Alex",
          "currency": "USD",
          "locale": "en-US"
        }
      },
      "PeopleFormResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/PeopleModel"
          }
        }
      },
      "PeopleFullListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "object",
              "null"
            ],
            "description": "Directory keyed by client or vendor ID. Each value contains the full\nPeopleListRowModel fields shown under Child Attributes. Null when empty.",
            "additionalProperties": {
              "$ref": "#/components/schemas/PeopleListRowModel"
            },
            "propertyNames": {
              "type": "string"
            }
          }
        }
      },
      "PeopleListModel": {
        "type": "object",
        "required": [
          "total_records",
          "page_size",
          "page_number",
          "peoples"
        ],
        "properties": {
          "page_number": {
            "type": "integer",
            "format": "int64",
            "description": "Page returned, 1-based.",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "description": "Records per page in this response.",
            "minimum": 0
          },
          "peoples": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PeopleListRowModel"
            }
          },
          "total_records": {
            "type": "integer",
            "format": "int64",
            "description": "Records matching the filters, across all pages.",
            "minimum": 0
          }
        }
      },
      "PeopleListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/PeopleListModel"
              }
            ]
          }
        }
      },
      "PeopleListRowModel": {
        "type": "object",
        "description": "Counterparty details grouped for a customer or vendor response.",
        "required": [
          "id",
          "currency",
          "locale",
          "people_type",
          "company_name",
          "company_email",
          "is_active",
          "created_at"
        ],
        "properties": {
          "attributes": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/PeopleAttributeDetailModel"
            }
          },
          "company_email": {
            "type": "string"
          },
          "company_name": {
            "type": "string",
            "description": "Company or business name."
          },
          "contact_first_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "First name of the contact person."
          },
          "contact_last_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Last name of the contact person."
          },
          "contacts": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/PeopleContactDetailModel"
            }
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "credit": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit_bcy": {
            "type": [
              "string",
              "null"
            ],
            "description": "Credit in the company base currency, as a decimal string."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "external_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Caller-supplied id from the system that created this record (see `external_source`)."
          },
          "external_source": {
            "type": [
              "string",
              "null"
            ],
            "description": "System `external_id` comes from, for example `shopify`."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "locale": {
            "type": "string",
            "description": "Locale used for language and number formats, for example `en_US`."
          },
          "outstanding": {
            "type": [
              "string",
              "null"
            ]
          },
          "outstanding_bcy": {
            "type": [
              "string",
              "null"
            ]
          },
          "people_type": {
            "type": "string"
          }
        }
      },
      "PeopleModel": {
        "type": "object",
        "description": "A stored customer or vendor profile, including its contacts, addresses, and commercial settings.",
        "required": [
          "id",
          "currency",
          "locale",
          "people_type",
          "company_name",
          "company_email",
          "is_active",
          "is_portal_enabled",
          "created_at"
        ],
        "properties": {
          "billing_city": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_country": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "State, province or region of the address."
          },
          "billing_street1": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_street2": {
            "type": [
              "string",
              "null"
            ]
          },
          "billing_zip": {
            "type": [
              "string",
              "null"
            ]
          },
          "buyer_company_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_email": {
            "type": "string"
          },
          "company_name": {
            "type": "string",
            "description": "Company or business name."
          },
          "contact_first_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "First name of the contact person."
          },
          "contact_last_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Last name of the contact person."
          },
          "contact_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "dimension_state": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/DimensionState"
              }
            ]
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "internal_notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "is_portal_enabled": {
            "type": "boolean"
          },
          "late_fee": {
            "type": [
              "string",
              "null"
            ]
          },
          "locale": {
            "type": "string",
            "description": "Locale used for language and number formats, for example `en_US`."
          },
          "payment_term": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "people_type": {
            "type": "string"
          },
          "shipping_city": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_country": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_state": {
            "type": [
              "string",
              "null"
            ],
            "description": "State, province or region of the address."
          },
          "shipping_street1": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_street2": {
            "type": [
              "string",
              "null"
            ]
          },
          "shipping_zip": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          }
        }
      },
      "ProjectAttachmentDbModel": {
        "type": "object",
        "description": "A file attachment associated with a project.",
        "required": [
          "id",
          "company_id",
          "user_id",
          "attachment_name",
          "attachment_size",
          "attachment_type",
          "attachment_url"
        ],
        "properties": {
          "attachment_name": {
            "type": "string"
          },
          "attachment_size": {
            "type": "string"
          },
          "attachment_type": {
            "type": "string"
          },
          "attachment_url": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "project_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "ProjectDetailResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ProjectModel"
              }
            ]
          }
        }
      },
      "ProjectFormModel": {
        "type": "object",
        "description": "Creates or updates a project, its commercial settings, and staff assignments. Nested staff IDs identify the assigned users.",
        "required": [
          "currency",
          "title",
          "billing_method"
        ],
        "properties": {
          "attachment": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/AttachmentModel"
            }
          },
          "billing_method": {
            "type": "string"
          },
          "budget": {
            "type": [
              "string",
              "null"
            ]
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "people_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Client or vendor identifier."
          },
          "priority": {
            "type": [
              "string",
              "null"
            ]
          },
          "project_cost": {
            "type": [
              "string",
              "null"
            ]
          },
          "project_manager": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your reference for the record, for example a PO or receipt number."
          },
          "staff": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/StaffModel"
            }
          },
          "task": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ProjectTaskAssignmentModel"
            }
          },
          "title": {
            "type": "string"
          }
        }
      },
      "ProjectFormResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ProjectModel"
              }
            ]
          }
        }
      },
      "ProjectListModel": {
        "type": "object",
        "required": [
          "total_records",
          "page_size",
          "page_number",
          "projects"
        ],
        "properties": {
          "page_number": {
            "type": "integer",
            "format": "int64",
            "description": "Page returned, 1-based.",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "description": "Records per page in this response.",
            "minimum": 0
          },
          "projects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectListRowModel"
            }
          },
          "total_records": {
            "type": "integer",
            "format": "int64",
            "description": "Records matching the filters, across all pages.",
            "minimum": 0
          }
        }
      },
      "ProjectListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ProjectListModel"
              }
            ]
          }
        }
      },
      "ProjectListRowModel": {
        "type": "object",
        "description": "A project record with its commercial settings, status, and audit metadata.",
        "required": [
          "id",
          "company_id",
          "currency",
          "title",
          "billing_method"
        ],
        "properties": {
          "billing_method": {
            "type": "string"
          },
          "budget": {
            "type": [
              "string",
              "null"
            ]
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "people_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Client or vendor identifier."
          },
          "priority": {
            "type": [
              "string",
              "null"
            ]
          },
          "project_cost": {
            "type": [
              "string",
              "null"
            ]
          },
          "project_manager": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your reference for the record, for example a PO or receipt number."
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "time_estimation": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "total_log_time": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_project_cost": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_unbilled_time": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ProjectModel": {
        "type": "object",
        "description": "A project record with its commercial settings, status, and audit metadata.",
        "required": [
          "id",
          "user_id",
          "company_id",
          "currency",
          "title",
          "budget",
          "billing_method"
        ],
        "properties": {
          "attachment": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ProjectAttachmentDbModel"
            }
          },
          "billing_method": {
            "type": "string"
          },
          "budget": {
            "type": "string"
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "due_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "people_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Client or vendor identifier."
          },
          "priority": {
            "type": [
              "string",
              "null"
            ]
          },
          "project_cost": {
            "type": [
              "string",
              "null"
            ]
          },
          "project_manager": {
            "type": [
              "string",
              "null"
            ]
          },
          "reference_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Your reference for the record, for example a PO or receipt number."
          },
          "staff": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ProjectStaffDbModel"
            }
          },
          "status": {
            "type": [
              "string",
              "null"
            ]
          },
          "task": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/ProjectTaskMappingModel"
            }
          },
          "time_estimation": {
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "total_project_cost": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "updated_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "User who last changed the record."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "ProjectStaffDbModel": {
        "type": "object",
        "description": "A saved assignment linking a user to a project.",
        "required": [
          "id",
          "project_id",
          "company_id",
          "user_id"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "hour_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Hourly rate, as a decimal string."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "project_id": {
            "type": "string"
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "ProjectTaskAssignmentModel": {
        "type": "object",
        "description": "Associates a user with a project task.",
        "required": [
          "project_task_id"
        ],
        "properties": {
          "hour_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Hourly rate, as a decimal string."
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the record."
          },
          "project_task_id": {
            "type": "string"
          }
        }
      },
      "ProjectTaskDbModel": {
        "type": "object",
        "description": "A saved project task with its status and scheduling metadata.",
        "required": [
          "id",
          "company_id",
          "title"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "hour_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Hourly rate, as a decimal string."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "title": {
            "type": "string"
          }
        }
      },
      "ProjectTaskMappingModel": {
        "type": "object",
        "description": "Connects a task to its owning project and related records.",
        "required": [
          "id",
          "project_task_id"
        ],
        "properties": {
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "hour_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Hourly rate, as a decimal string."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "project_task_id": {
            "type": "string"
          },
          "task_title": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ProjectTimesheetDbModel": {
        "type": "object",
        "description": "A saved project time entry and its billing metadata.",
        "required": [
          "id",
          "user_id",
          "company_id",
          "project_id",
          "project_task_id",
          "timesheet_date",
          "logged_hours",
          "is_billable",
          "status"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "invoice_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_billable": {
            "type": "boolean",
            "description": "Whether the time or cost can be billed to the client."
          },
          "logged_hours": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text note."
          },
          "project_id": {
            "type": "string"
          },
          "project_task_id": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "Billing state of the time entry, for example `unbilled`."
          },
          "timesheet_date": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "PublicEmailConfirmationCodeRequest": {
        "type": "object",
        "description": "Requests an email confirmation code for the supplied public confirmation flow.",
        "required": [
          "email",
          "confirmation_context"
        ],
        "properties": {
          "confirmation_context": {
            "type": "string"
          },
          "confirmation_entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "email": {
            "type": "string"
          }
        }
      },
      "ReconciliationConfirmFormModel": {
        "type": "object",
        "description": "Confirms a reconciliation using the selected accounting and bank-side records.",
        "required": [
          "currency",
          "status",
          "closing_balance"
        ],
        "properties": {
          "calculated_balance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Book balance calculated for the period, as a decimal string."
          },
          "closing_balance": {
            "type": "string",
            "description": "Balance at the end of the period, as a decimal string."
          },
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "diff": {
            "type": [
              "string",
              "null"
            ]
          },
          "journals": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/JournalIdModel"
            }
          },
          "opening_balance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Balance at the start of the period, as a decimal string."
          },
          "reconciliation_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "description": "`draft` saves the reconciliation for later; `completed` finalizes it."
          }
        }
      },
      "ReconciliationFormModel": {
        "type": "object",
        "description": "Creates or updates a reconciliation and its selected transaction details.",
        "required": [
          "account",
          "start_date",
          "end_date",
          "closing_balance"
        ],
        "properties": {
          "account": {
            "type": "string"
          },
          "calculated_balance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Book balance calculated for the period, as a decimal string."
          },
          "closing_balance": {
            "type": "string",
            "description": "Balance at the end of the period, as a decimal string."
          },
          "diff": {
            "type": [
              "string",
              "null"
            ]
          },
          "end_date": {
            "type": "string",
            "description": "End date (`YYYY-MM-DD`), inclusive; null when open-ended."
          },
          "opening_balance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Balance at the start of the period, as a decimal string."
          },
          "start_date": {
            "type": "string",
            "description": "Start date (`YYYY-MM-DD`), inclusive."
          }
        }
      },
      "ReconciliationVoidFormModel": {
        "type": "object",
        "description": "Voids the reconciliation selected by the URL and records the supplied note.",
        "required": [
          "note"
        ],
        "properties": {
          "note": {
            "type": "string",
            "description": "Free-text note."
          }
        }
      },
      "RepairRequest": {
        "type": "object",
        "description": "Requests posting repair for the selected accounting source records. Preview the repair before applying it.",
        "required": [
          "kind",
          "source_id"
        ],
        "properties": {
          "kind": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text note."
          },
          "preview_token": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_id": {
            "type": "string"
          }
        }
      },
      "ReportHealthStatus": {
        "type": "string",
        "enum": [
          "needsAttention",
          "reconciled",
          "checksIncomplete"
        ]
      },
      "ResolvedDimension": {
        "type": "object",
        "required": [
          "dimension_id",
          "value_id",
          "dimension_name",
          "value_name",
          "value_code",
          "path"
        ],
        "properties": {
          "dimension_id": {
            "type": "string"
          },
          "dimension_name": {
            "type": "string"
          },
          "path": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValuePathEntry"
            }
          },
          "value_code": {
            "type": "string"
          },
          "value_id": {
            "type": "string"
          },
          "value_name": {
            "type": "string"
          }
        }
      },
      "SettingFromModel": {
        "type": "object",
        "description": "Updates the selected module's configuration settings.",
        "required": [
          "setting"
        ],
        "properties": {
          "attribute": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/FormAttributeModel"
            }
          },
          "setting": {
            "type": "object",
            "additionalProperties": {
              "type": [
                "string",
                "null"
              ]
            },
            "propertyNames": {
              "type": "string",
              "enum": [
                "DOCUMENT_NOTE",
                "DOCUMENT_TERM",
                "DOCUMENT_NUMBER_PREFIX",
                "DOCUMENT_NUMBER_SEQUENCE",
                "DOCUMENT_NUMBER_SUFFIX",
                "DOCUMENT_ALLOW_EDIT_SENT",
                "DOCUMENT_SHOW_ITEM_NUMBER",
                "DOCUMENT_SHOW_TAX_SUMMARY",
                "DOCUMENT_NUMBER_GENERATE_MODE",
                "DOCUMENT_ALLOW_PARTIAL_PAYMENT",
                "DOCUMENT_ALLOW_CHARGE_DISCOUNT_SUBTOTAL",
                "DOCUMENT_ALLOW_CHARGE_DISCOUNT_TOTAL",
                "DOCUMENT_ALLOW_FIELD_CHARGE_DISCOUNT_ITEM",
                "DOCUMENT_ALLOW_SCHEDULING"
              ]
            },
            "example": {
              "DOCUMENT_NUMBER_PREFIX": "IN",
              "DOCUMENT_SHOW_TAX_SUMMARY": "1"
            }
          }
        }
      },
      "SettlementPreviewForm": {
        "type": "object",
        "description": "Selects bank and document records for a settlement preview before reconciliation is confirmed.",
        "required": [
          "entity",
          "entity_id",
          "selections"
        ],
        "properties": {
          "entity": {
            "type": "string"
          },
          "entity_id": {
            "type": "string"
          },
          "selections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SettlementPreviewSelection"
            },
            "maxItems": 50,
            "minItems": 1
          }
        }
      },
      "SettlementPreviewRow": {
        "type": "object",
        "required": [
          "mapping",
          "estimated",
          "rate",
          "settlement_rate",
          "rate_base",
          "rate_target",
          "rate_source",
          "as_of_date_matched",
          "bank_remaining",
          "realised_fx"
        ],
        "properties": {
          "as_of_date_matched": {
            "type": "boolean"
          },
          "bank_remaining": {
            "type": "string"
          },
          "estimated": {
            "type": "boolean",
            "description": "FX estimate only; confirmation is established by the two explicit amounts."
          },
          "mapping": {
            "$ref": "#/components/schemas/TransactionMappingModel"
          },
          "rate": {
            "type": "string"
          },
          "rate_base": {
            "type": "string"
          },
          "rate_source": {
            "type": "string"
          },
          "rate_target": {
            "type": "string"
          },
          "rate_time": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "realised_fx": {
            "type": "string",
            "description": "Positive is a gain, negative is a loss, in company base currency."
          },
          "settlement_rate": {
            "type": "string",
            "description": "Implied bank currency per document unit, including the confirmed fee.\nUnlike `rate` (the quote), this is derived from the explicit amounts."
          }
        }
      },
      "SettlementPreviewSelection": {
        "type": "object",
        "required": [
          "transaction_id"
        ],
        "properties": {
          "bank_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "bank_charge": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank fee withheld from the payment, as a decimal string. The payment amount plus this charge is applied to the document."
          },
          "document_amount": {
            "type": [
              "string",
              "null"
            ]
          },
          "settlement_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional settlement rate: one document-currency unit in bank currency.\nPositive, with up to 12 whole digits and six decimal places."
          },
          "transaction_id": {
            "type": "string"
          }
        }
      },
      "SmtpDeleteResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "boolean"
          }
        }
      },
      "SmtpFormModel": {
        "type": "object",
        "description": "Configures the company's outbound SMTP transport and sender details.",
        "required": [
          "server",
          "port",
          "method"
        ],
        "properties": {
          "method": {
            "type": "string"
          },
          "password": {
            "type": [
              "string",
              "null"
            ],
            "description": "Write-only credential. Omit or send an empty string on update to retain the configured password.",
            "writeOnly": true
          },
          "port": {
            "type": "integer",
            "format": "int64"
          },
          "server": {
            "type": "string"
          },
          "username": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "SmtpPublicDetailResponse": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SmtpPublicModel"
              }
            ]
          }
        }
      },
      "SmtpPublicFormResponse": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/SmtpPublicModel"
          }
        }
      },
      "SmtpPublicModel": {
        "type": "object",
        "description": "HTTP response view. SMTP credentials never leave the mail-delivery boundary.",
        "required": [
          "id",
          "server",
          "password_configured"
        ],
        "properties": {
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "method": {
            "type": [
              "string",
              "null"
            ]
          },
          "password_configured": {
            "type": "boolean"
          },
          "port": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "server": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "username": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "SourceJournalMatch": {
        "type": "object",
        "required": [
          "journal_id",
          "journal_anchor_id",
          "journal_version",
          "transaction_hash",
          "root_entity_id",
          "root_entity_type"
        ],
        "properties": {
          "journal_anchor_id": {
            "type": "string"
          },
          "journal_id": {
            "type": "string"
          },
          "journal_version": {
            "type": "integer",
            "format": "int32"
          },
          "related_entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "related_entity_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "root_entity_id": {
            "type": "string"
          },
          "root_entity_type": {
            "type": "string"
          },
          "source_version_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_hash": {
            "type": "string"
          }
        }
      },
      "SourcePostingGap": {
        "type": "object",
        "required": [
          "acceptance_status",
          "posting_status",
          "required_effects",
          "journals",
          "evidence_coverage",
          "kind",
          "source_id",
          "anchor_id",
          "document_type_id",
          "document_number",
          "date",
          "missing"
        ],
        "properties": {
          "acceptance_status": {
            "type": "string"
          },
          "anchor_id": {
            "type": "string",
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "date": {
            "type": "string",
            "format": "date"
          },
          "document_number": {
            "type": "string"
          },
          "document_type_id": {
            "type": "string"
          },
          "evidence_coverage": {
            "type": "string"
          },
          "journals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SourceJournalMatch"
            }
          },
          "kind": {
            "type": "string"
          },
          "missing": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Which journals are absent for this source. Documents and expenses have\none (\"document\" / \"expense\"); a payment can be missing \"payment\",\n\"payment_fx\" (the realised-FX companion), or both."
          },
          "posting_status": {
            "type": "string"
          },
          "required_effects": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "source_id": {
            "type": "string"
          },
          "source_version_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "SourcePostingRepairJournal": {
        "type": "object",
        "description": "Serialized journal form plus computed totals. Identity fields are output metadata,\nalthough the corresponding write form hides them from caller input schemas.",
        "required": [
          "total_debit",
          "total_credit"
        ],
        "properties": {
          "company_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Company the record belongs to."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "date": {
            "type": [
              "string",
              "null"
            ]
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string: one unit of this record's currency equals `exchange_rate` units of the company base currency. `1` when the record is in the base currency."
          },
          "is_manual": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "key": {
            "type": [
              "string",
              "null"
            ]
          },
          "lines": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/SourcePostingRepairLine"
            }
          },
          "meta_data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/JournalEntryMetadata"
              }
            ]
          },
          "override": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "override_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "posted": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "reference": {
            "type": [
              "string",
              "null"
            ]
          },
          "reversal_of": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_document_version_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_credit": {
            "type": "string",
            "description": "Total credit in journal currency, encoded as a decimal string."
          },
          "total_debit": {
            "type": "string",
            "description": "Total debit in journal currency, encoded as a decimal string."
          },
          "user_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "version_number": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Version of the record, increased by every saved edit."
          }
        }
      },
      "SourcePostingRepairLine": {
        "type": "object",
        "description": "A planned posting line. Output fields can be null even when the write form\nrequires caller input, so this schema is separate from journal validation.",
        "required": [
          "is_tax",
          "is_taxable"
        ],
        "properties": {
          "account_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account code in the chart of accounts."
          },
          "account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "account_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account name in the chart of accounts."
          },
          "client_line_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "credit": {
            "type": [
              "string",
              "null"
            ],
            "description": "Credit amount in journal currency, encoded as a decimal string."
          },
          "debit": {
            "type": [
              "string",
              "null"
            ],
            "description": "Debit amount in journal currency, encoded as a decimal string."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "dimension_values": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/DimensionValueRef"
            }
          },
          "dimensions": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "is_tax": {
            "type": "boolean"
          },
          "is_taxable": {
            "type": "boolean"
          },
          "line_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "people_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Client or vendor identifier."
          },
          "source_line_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_direction": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_meta_data": {
            "description": "Provider-specific tax metadata; intentionally free-form JSON.\nFree-form JSON; keys and values depend on the producing workflow."
          }
        }
      },
      "StaffModel": {
        "type": "object",
        "description": "Assigns a specific user to a project. The nested `user_id` identifies the assignee and is supplied by the caller.",
        "required": [
          "user_id"
        ],
        "properties": {
          "hour_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Hourly rate, as a decimal string."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "StatementEntry": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "date",
          "kind",
          "reference",
          "debit",
          "credit",
          "balance"
        ],
        "properties": {
          "balance": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          },
          "credit": {
            "type": "string"
          },
          "date": {
            "type": "string"
          },
          "debit": {
            "type": "string",
            "description": "Exact company-base-currency amounts, represented as decimal strings."
          },
          "document_id": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "kind": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          }
        }
      },
      "StatusCategorizeFormModel": {
        "type": "object",
        "description": "Gives every uncategorised custom status of a document type one category, in a single call.",
        "required": [
          "status_category"
        ],
        "properties": {
          "status_category": {
            "type": "string"
          }
        }
      },
      "StatusFormModel": {
        "type": "object",
        "description": "Creates or updates a document workflow status and its configured behavior.",
        "required": [
          "status"
        ],
        "properties": {
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the record is active."
          },
          "is_issued": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "At most one issued status per document type. Saving true clears the rest."
          },
          "status": {
            "type": "string",
            "description": "Status key from this module's status settings; the set of statuses is configured per company."
          },
          "status_category": {
            "type": [
              "string",
              "null"
            ],
            "description": "What the status means for the money on a document: `draft`, `open`, `settled` or `void`.\nLists and summaries group by it. Absent leaves the status uncategorised (counted nowhere)."
          },
          "status_color": {
            "type": [
              "string",
              "null"
            ]
          },
          "status_note": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "StatusFormResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/DocumentStatusModel"
          }
        }
      },
      "StatusListModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StatusModel"
            }
          }
        }
      },
      "StatusMetaData": {
        "type": "object",
        "required": [
          "label",
          "color",
          "icon"
        ],
        "properties": {
          "color": {
            "type": "string"
          },
          "icon": {
            "type": "string"
          },
          "label": {
            "type": "string"
          }
        }
      },
      "StatusModel": {
        "type": "object",
        "required": [
          "id",
          "status",
          "status_color",
          "is_user_defined"
        ],
        "properties": {
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_issued": {
            "type": "boolean"
          },
          "is_user_defined": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "description": "Status key from this module's status settings; the set of statuses is configured per company."
          },
          "status_category": {
            "type": [
              "string",
              "null"
            ],
            "description": "`draft`, `open`, `settled`, `void`, or none when the status was never categorised."
          },
          "status_color": {
            "type": "string"
          },
          "status_note": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_by": {
            "type": [
              "string",
              "null"
            ],
            "description": "User who last changed the record."
          }
        }
      },
      "StripeConnectAccount": {
        "type": "object",
        "description": "A connected Stripe account as returned by the existing account workflows.\nThis response contract is separate from the persistence entity.",
        "required": [
          "id",
          "company_id",
          "stripe_account_id",
          "stripe_email",
          "connection_label",
          "account_type",
          "country",
          "charges_enabled",
          "payouts_enabled",
          "details_submitted",
          "onboarding_completed",
          "is_fully_connected",
          "created_at"
        ],
        "properties": {
          "account_type": {
            "type": "string",
            "description": "Account classification: `asset`, `liability`, `equity`, `revenue` or `expense`."
          },
          "business_profile": {
            "description": "Provider-defined business profile; free-form JSON returned by Stripe."
          },
          "business_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "capabilities": {
            "description": "Provider-defined capabilities; free-form JSON returned by Stripe."
          },
          "charges_enabled": {
            "type": "boolean"
          },
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "connection_label": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "details_submitted": {
            "type": "boolean"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_fully_connected": {
            "type": "boolean"
          },
          "last_synced_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "metadata": {
            "description": "Caller-defined metadata; free-form JSON."
          },
          "onboarding_completed": {
            "type": "boolean"
          },
          "onboarding_url": {
            "type": [
              "string",
              "null"
            ],
            "description": "Short-lived onboarding link returned for the current account workflow."
          },
          "payouts_enabled": {
            "type": "boolean"
          },
          "requirements": {
            "description": "Provider-defined account requirements; free-form JSON returned by Stripe."
          },
          "stripe_account_id": {
            "type": "string"
          },
          "stripe_email": {
            "type": "string"
          },
          "tos_acceptance_date": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "tos_acceptance_ip": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          }
        }
      },
      "StripeConnectListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/FullyConnectedStripConnectModel"
            }
          }
        }
      },
      "StripeConnectRawListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/StripeConnectAccount"
            }
          }
        }
      },
      "StripeConnectUrlResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/StripeConnectAccount"
              }
            ]
          }
        }
      },
      "SubscriptionCompanyModel": {
        "type": "object",
        "required": [
          "id",
          "stripe_subscription_id",
          "subscription_status",
          "charge_start_at",
          "charge_next_at",
          "subscription_created_at"
        ],
        "properties": {
          "charge_next_at": {
            "type": "string",
            "format": "date-time"
          },
          "charge_start_at": {
            "type": "string",
            "format": "date-time"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "managed_by": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SubscriptionManagedByModel",
                "description": "PL-222. Who manages this subscription (see `SubscriptionManagedByModel`).\nFilled by the company subscription read; absent only on rows read some\nother way (lists, history)."
              }
            ]
          },
          "metadata": {
            "type": [
              "string",
              "null"
            ]
          },
          "pending_company_payment": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/PendingCompanyPaymentModel",
                "description": "A browser-initiated company increase waiting for payment."
              }
            ]
          },
          "stripe_subscription_id": {
            "type": "string"
          },
          "subscription_created_at": {
            "type": "string",
            "format": "date-time"
          },
          "subscription_payment": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/SubscriptionPaymentSnapshotModel",
                "description": "Latest `subscription_payment` snapshot so subscription overview screens do not need a second detail call."
              }
            ]
          },
          "subscription_payment_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Latest `subscription_payment` row for the company by `created_at` (trial/free rows included)."
          },
          "subscription_status": {
            "type": "string"
          }
        }
      },
      "SubscriptionManagedByKind": {
        "type": "string",
        "enum": [
          "platform",
          "organization",
          "partner"
        ]
      },
      "SubscriptionManagedByModel": {
        "type": "object",
        "description": "PL-222. Who manages a company's subscription, filled on every company\nsubscription read, so the web app decides \"billing actions or contact\nsomeone\" from `kind` alone instead of from status strings. Names only: a\nmember's users may be outside the organization, so never admin names or\nemails.",
        "required": [
          "kind",
          "name"
        ],
        "properties": {
          "kind": {
            "$ref": "#/components/schemas/SubscriptionManagedByKind"
          },
          "name": {
            "type": "string",
            "description": "The brand (`platform`), the organization's company (`organization`)\nor the partner (`partner`), as shown to users."
          },
          "organization_company_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Only for `organization`."
          }
        }
      },
      "SubscriptionPaymentSnapshotModel": {
        "type": "object",
        "required": [
          "id",
          "payment_amount",
          "reference_number",
          "payment_status",
          "payment_type",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "metadata": {
            "type": [
              "string",
              "null"
            ]
          },
          "payment_amount": {
            "type": "string",
            "description": "Amount paid, as a decimal string."
          },
          "payment_status": {
            "type": "string"
          },
          "payment_type": {
            "type": "string"
          },
          "reference_number": {
            "type": "string",
            "description": "Your reference for the record, for example a PO or receipt number."
          }
        }
      },
      "SuccessfulUpdate": {
        "type": "object",
        "required": [
          "expense_id",
          "previous_status",
          "new_status"
        ],
        "properties": {
          "expense_id": {
            "type": "string"
          },
          "new_status": {
            "type": "string",
            "description": "Expense status after the transition."
          },
          "previous_status": {
            "type": "string",
            "description": "Expense status before the transition."
          }
        }
      },
      "TaskFormModel": {
        "type": "object",
        "description": "Creates or updates a project task, its scheduling details, and assignments.",
        "required": [
          "task_title"
        ],
        "properties": {
          "hour_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Hourly rate, as a decimal string."
          },
          "id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Identifier of the record."
          },
          "task_title": {
            "type": "string"
          }
        }
      },
      "TaskFormResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ProjectTaskDbModel"
              }
            ]
          }
        }
      },
      "TaskListModel": {
        "type": "object",
        "required": [
          "total_records",
          "page_size",
          "page_number",
          "task"
        ],
        "properties": {
          "page_number": {
            "type": "integer",
            "format": "int64",
            "description": "Page returned, 1-based.",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "description": "Records per page in this response.",
            "minimum": 0
          },
          "task": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaskModel"
            }
          },
          "total_records": {
            "type": "integer",
            "format": "int64",
            "description": "Records matching the filters, across all pages.",
            "minimum": 0
          }
        }
      },
      "TaskListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TaskListModel"
              }
            ]
          }
        }
      },
      "TaskModel": {
        "type": "object",
        "description": "A project task returned with its editable and stored details.",
        "required": [
          "id",
          "title"
        ],
        "properties": {
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "hour_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Hourly rate, as a decimal string."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "title": {
            "type": "string"
          },
          "total_billed_time": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_log_time": {
            "type": [
              "string",
              "null"
            ]
          },
          "total_unbilled_time": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "TaxComponentCounts": {
        "type": "object",
        "description": "Company-wide totals per status, for the list's quick filters. Not\nnarrowed by `q` or the cursor.",
        "required": [
          "active",
          "archived"
        ],
        "properties": {
          "active": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "archived": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "TaxComponentFormModel": {
        "type": "object",
        "description": "Create or update body. Every field is required on both: an update states\nthe component in full, like the tax form does.",
        "required": [
          "code",
          "name",
          "kind",
          "rates"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "The company's identifier: 1 to 120 letters, digits and `_ . : -`,\nstarting with a letter or digit, e.g. `US-CA:state` or `CGST`.\nUnique in the company, archived components included, compared\nexactly after trimming (`cgst` and `CGST` are different codes).\nEditable: taxes and posted journals refer to the component by id.",
            "example": "US-CA:state"
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional ISO 3166-1 alpha-2 country, uppercase, e.g. `US` or `IN`.\nChecked for format only, not against the ISO list.",
            "example": "US"
          },
          "kind": {
            "type": "string",
            "description": "Free lowercase label, 1 to 32 of `a-z`, `0-9` and `_`, such as\n`state`, `central` or `levy`. Describes the component; it never\nchanges how it is calculated or ordered.",
            "example": "state"
          },
          "name": {
            "type": "string",
            "description": "Display name.",
            "example": "San Francisco transit district"
          },
          "rates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxComponentRateFormModel"
            },
            "description": "The full rate history: exactly one opening rate (no\n`effective_from`) and at most one rate per date. A rate applies from\nits date until the next one. Replaces the stored history; documents\nalready saved keep the rates they charged."
          },
          "region": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional ISO 3166-2 subdivision, uppercase, e.g. `US-CA`. Requires\n`country_code`, and its prefix must match it. Checked for format and\nthat prefix only, not against the ISO list.",
            "example": "US-CA"
          }
        }
      },
      "TaxComponentModel": {
        "type": "object",
        "required": [
          "id",
          "code",
          "name",
          "kind",
          "rate",
          "rates",
          "is_active",
          "tax_count",
          "created_at"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "kind": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "rate": {
            "type": "string",
            "description": "The rate in force today (UTC)."
          },
          "rates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxRatePeriodSharedModel"
            },
            "description": "Opening rate first, then by date."
          },
          "region": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_count": {
            "type": "integer",
            "format": "int64",
            "description": "Active taxes that use this component. Archiving is refused while\nthis is above zero.",
            "minimum": 0
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          }
        }
      },
      "TaxComponentRateFormModel": {
        "type": "object",
        "required": [
          "rate"
        ],
        "properties": {
          "effective_from": {
            "type": [
              "string",
              "null"
            ],
            "description": "First day the rate applies, `YYYY-MM-DD`. Leave out (or null) on the\nopening rate.",
            "example": "2027-01-01"
          },
          "rate": {
            "type": "string",
            "description": "Percentage as a decimal string, zero or more, at most 6 decimals.",
            "example": "0.5"
          }
        }
      },
      "TaxComponentSharedModel": {
        "type": "object",
        "description": "One component a tax is made of, in split order: the catalog\ncomponent's current code, name and level, today's rate and the rate\nhistory that prices any other date.",
        "required": [
          "component_id",
          "component_code",
          "component_name",
          "component_kind",
          "rate",
          "sort_order"
        ],
        "properties": {
          "component_code": {
            "type": "string",
            "description": "The company's identifier for the component, e.g. `US-CA:state` or\n`CGST`."
          },
          "component_country_code": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-1 alpha-2, when the component has a country."
          },
          "component_id": {
            "type": "string",
            "description": "The `tax_component` id; stable when the code is edited."
          },
          "component_kind": {
            "type": "string",
            "description": "Free label such as `state` or `central`."
          },
          "component_name": {
            "type": "string"
          },
          "component_region": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 3166-2 subdivision, e.g. `US-CA`, when it has one."
          },
          "rate": {
            "type": "string",
            "description": "The rate in force on the date this model was priced for: today when\nread from the catalog, the document's date inside a calculation."
          },
          "rates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxRatePeriodSharedModel"
            },
            "description": "Opening rate first, then dated rates in ascending order. Defaults so\na tax map cached before rate history existed still reads; an empty\nhistory means `rate` applies on every date."
          },
          "sort_order": {
            "type": "integer",
            "format": "int32"
          }
        }
      },
      "TaxComponentStatus": {
        "type": "string",
        "description": "Which components a list returns.",
        "enum": [
          "active",
          "archived",
          "all"
        ]
      },
      "TaxCreateModel": {
        "type": "object",
        "description": "Creates a tax definition available to the authenticated company.",
        "required": [
          "tax_name",
          "tax_value",
          "display_label",
          "tax_category"
        ],
        "properties": {
          "component_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Catalog components this tax is made of, in split order (PL-253).\nWhen the list is non-empty, `tax_value` is the sum of their rates and\nwhatever was sent is ignored. On update, leaving this out keeps the\ncurrent assignments, `[]` removes them and a list replaces them."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_label": {
            "type": "string"
          },
          "is_active": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the record is active."
          },
          "is_recoverable": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text note."
          },
          "tax_category": {
            "type": "string"
          },
          "tax_group_ids": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_name": {
            "type": "string"
          },
          "tax_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_value": {
            "type": "string"
          }
        }
      },
      "TaxCreateResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/TaxDbModel"
          }
        }
      },
      "TaxDbModel": {
        "type": "object",
        "required": [
          "id",
          "user_id",
          "tax_type",
          "tax_name",
          "tax_value",
          "is_active",
          "display_label",
          "tax_category",
          "is_recoverable",
          "company_id"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxComponentSharedModel"
            },
            "description": "Component components in split order; empty for a simple tax."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_label": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "is_recoverable": {
            "type": "boolean"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text note."
          },
          "tax_category": {
            "type": "string"
          },
          "tax_group_ids": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_name": {
            "type": "string"
          },
          "tax_type": {
            "type": "string"
          },
          "tax_value": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "TaxDetailResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TaxDbModel"
              }
            ]
          }
        }
      },
      "TaxListModel": {
        "type": "object",
        "required": [
          "total_records",
          "page_size",
          "page_number",
          "taxes"
        ],
        "properties": {
          "page_number": {
            "type": "integer",
            "format": "int64",
            "description": "Page returned, 1-based.",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "description": "Records per page in this response.",
            "minimum": 0
          },
          "taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxModel"
            }
          },
          "total_records": {
            "type": "integer",
            "format": "int64",
            "description": "Records matching the filters, across all pages.",
            "minimum": 0
          }
        }
      },
      "TaxListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TaxListModel"
              }
            ]
          }
        }
      },
      "TaxModel": {
        "type": "object",
        "required": [
          "id",
          "user_id",
          "tax_type",
          "tax_name",
          "tax_value",
          "is_active",
          "display_label",
          "tax_category",
          "is_recoverable",
          "company_id"
        ],
        "properties": {
          "company_id": {
            "type": "string",
            "description": "Company the record belongs to."
          },
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxComponentSharedModel"
            },
            "description": "The parts of a split tax in split order, each at today's rate; empty\nfor a simple tax. Lets a list show what a tax is made of without a\nread per row or a catalog fetch."
          },
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "deleted_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was deleted (ISO 8601 timestamp); null while it is not deleted."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_label": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "is_active": {
            "type": "boolean",
            "description": "Whether the record is active."
          },
          "is_recoverable": {
            "type": "boolean"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text note."
          },
          "tax_category": {
            "type": "string"
          },
          "tax_group_ids": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_name": {
            "type": "string"
          },
          "tax_type": {
            "type": "string"
          },
          "tax_value": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the record was last changed (ISO 8601 timestamp); null if it never was."
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "TaxRatePeriodSharedModel": {
        "type": "object",
        "description": "One rate of a component's history. The opening rate has no\n`effective_from` and applies before the first dated rate.",
        "required": [
          "rate"
        ],
        "properties": {
          "effective_from": {
            "type": [
              "string",
              "null"
            ],
            "format": "date",
            "description": "First day the rate applies, `YYYY-MM-DD`; absent on the opening rate.",
            "example": "2027-01-01"
          },
          "rate": {
            "type": "string"
          }
        }
      },
      "TaxReportSubmissionRequestModel": {
        "type": "object",
        "description": "Submits the selected tax report with its reporting-period details.",
        "required": [
          "date_range",
          "report_key"
        ],
        "properties": {
          "date_range": {
            "type": "string"
          },
          "report_key": {
            "type": "string"
          }
        }
      },
      "TaxSummary": {
        "type": "object",
        "required": [
          "total",
          "display_label",
          "tax_name",
          "tax_rate",
          "taxable_amount"
        ],
        "properties": {
          "display_label": {
            "type": "string"
          },
          "tax_name": {
            "type": "string"
          },
          "tax_rate": {
            "type": "string",
            "description": "Tax rate in percent, as a decimal string."
          },
          "taxable_amount": {
            "type": "string",
            "description": "Amount the tax is calculated on, as a decimal string."
          },
          "total": {
            "type": "string",
            "description": "Decimal string in the record's currency."
          }
        }
      },
      "TaxUpdateModel": {
        "type": "object",
        "description": "Updates an existing company tax definition.",
        "required": [
          "tax_name",
          "tax_value",
          "display_label",
          "tax_category"
        ],
        "properties": {
          "component_ids": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "Catalog components this tax is made of, in split order (PL-253).\nWhen the list is non-empty, `tax_value` is the sum of their rates and\nwhatever was sent is ignored. On update, leaving this out keeps the\ncurrent assignments, `[]` removes them and a list replaces them."
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_label": {
            "type": "string"
          },
          "is_active": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the record is active."
          },
          "is_recoverable": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text note."
          },
          "tax_category": {
            "type": "string"
          },
          "tax_group_ids": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_name": {
            "type": "string"
          },
          "tax_type": {
            "type": [
              "string",
              "null"
            ]
          },
          "tax_value": {
            "type": "string"
          }
        }
      },
      "TaxUpdateResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "$ref": "#/components/schemas/TaxDbModel"
          }
        }
      },
      "TimesheetFormModel": {
        "type": "object",
        "description": "Creates or updates a time entry associated with a project and task.",
        "required": [
          "project_id",
          "project_task_id",
          "timesheet_date",
          "logged_hours",
          "note"
        ],
        "properties": {
          "is_billable": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the time or cost can be billed to the client."
          },
          "logged_hours": {
            "type": "string"
          },
          "note": {
            "type": "string",
            "description": "Free-text note."
          },
          "project_id": {
            "type": "string"
          },
          "project_task_id": {
            "type": "string"
          },
          "timesheet_date": {
            "type": "string"
          }
        }
      },
      "TimesheetFormResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ProjectTimesheetDbModel"
              }
            ]
          }
        }
      },
      "TimesheetInvoiceFormModel": {
        "type": "object",
        "required": [
          "group_by",
          "timesheet_id",
          "project_id",
          "project_title",
          "billing_method"
        ],
        "properties": {
          "billing_method": {
            "type": "string"
          },
          "group_by": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text note."
          },
          "project_cost": {
            "type": [
              "string",
              "null"
            ]
          },
          "project_id": {
            "type": "string"
          },
          "project_task_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "project_title": {
            "type": "string"
          },
          "task_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "timesheet_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "timesheet_id": {
            "type": "string"
          },
          "unbilled_hours": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "TimesheetInvoiceResponseModel": {
        "type": "object",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimesheetInvoiceFormModel"
            }
          }
        }
      },
      "TimesheetListModel": {
        "type": "object",
        "required": [
          "total_records",
          "page_size",
          "page_number",
          "timesheet"
        ],
        "properties": {
          "page_number": {
            "type": "integer",
            "format": "int64",
            "description": "Page returned, 1-based.",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "description": "Records per page in this response.",
            "minimum": 0
          },
          "timesheet": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimesheetModel"
            }
          },
          "total_records": {
            "type": "integer",
            "format": "int64",
            "description": "Records matching the filters, across all pages.",
            "minimum": 0
          }
        }
      },
      "TimesheetListResponseModel": {
        "type": "object",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TimesheetListModel"
              }
            ]
          }
        }
      },
      "TimesheetModel": {
        "type": "object",
        "description": "A project time entry returned with its duration and billing details.",
        "required": [
          "id",
          "project_id",
          "project_task_id",
          "user_id",
          "timesheet_date",
          "logged_hours",
          "is_billable",
          "status"
        ],
        "properties": {
          "created_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When the record was created (ISO 8601 timestamp)."
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "invoice_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_billable": {
            "type": "boolean",
            "description": "Whether the time or cost can be billed to the client."
          },
          "logged_hours": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ],
            "description": "Free-text note."
          },
          "project_id": {
            "type": "string"
          },
          "project_task_id": {
            "type": "string"
          },
          "project_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "description": "Billing state of the time entry, for example `unbilled`."
          },
          "task_title": {
            "type": [
              "string",
              "null"
            ]
          },
          "timesheet_date": {
            "type": "string",
            "format": "date"
          },
          "user_id": {
            "type": "string"
          }
        }
      },
      "Timezone": {
        "type": "object",
        "description": "A supported timezone identifier and its display metadata.",
        "required": [
          "country_code",
          "timezone"
        ],
        "properties": {
          "country_code": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          }
        }
      },
      "TimezoneListModel": {
        "type": "object",
        "description": "The supported timezones available to company configuration.",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Timezone"
            }
          }
        }
      },
      "TimezoneModel": {
        "type": "object",
        "description": "A timezone option with its identifier and display metadata.",
        "required": [
          "code",
          "name"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "description": "Display name."
          }
        }
      },
      "TransactionConfirmFormModel": {
        "type": "object",
        "description": "Confirms selected bank transactions using the supplied accounting mappings.",
        "required": [
          "currency",
          "entity",
          "mapping"
        ],
        "properties": {
          "currency": {
            "type": "string",
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "entity": {
            "type": "string"
          },
          "mapping": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TransactionMappingModel"
            },
            "maxItems": 50,
            "minItems": 1
          }
        }
      },
      "TransactionExcludeFormModel": {
        "type": "object",
        "description": "Selects bank transactions to exclude from reconciliation work.",
        "required": [
          "reason",
          "transactions"
        ],
        "properties": {
          "reason": {
            "type": "string"
          },
          "transactions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "TransactionMappingModel": {
        "type": "object",
        "required": [
          "entity_id",
          "amount",
          "currency",
          "transaction_id",
          "exchange_rate",
          "original_amount",
          "original_currency"
        ],
        "properties": {
          "amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Explicit allocation in the bank transaction currency. Must be positive and within its remaining balance."
          },
          "bank_charge": {
            "type": [
              "string",
              "null"
            ],
            "description": "Optional fee in bank currency, included in the selected bank amount for withdrawals."
          },
          "currency": {
            "type": [
              "string",
              "null"
            ],
            "description": "ISO 4217 currency code, for example `USD`."
          },
          "entity_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "exchange_rate": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank currency to company base currency; must match the bank transaction rate."
          },
          "notes": {
            "type": [
              "string",
              "null"
            ]
          },
          "original_amount": {
            "type": [
              "string",
              "null"
            ],
            "description": "Confirmed settlement amount in the document currency."
          },
          "original_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "transaction_id": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "TransactionRestoreFormModel": {
        "type": "object",
        "description": "Restores selected excluded bank transactions to the active transaction list.",
        "required": [
          "transactions"
        ],
        "properties": {
          "transactions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "TransactionRevertFormModel": {
        "type": "object",
        "description": "Reverts the selected bank transaction's accounting classification or confirmation.",
        "required": [
          "transactions"
        ],
        "properties": {
          "transactions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "maxItems": 50,
            "minItems": 1
          }
        }
      },
      "TransitionFromModel": {
        "type": "object",
        "description": "Moves a document through its configured workflow using the selected transition.",
        "required": [
          "to_state"
        ],
        "properties": {
          "anchor_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Stable identifier that stays the same across versions; use it in URLs and links."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "to_state": {
            "type": "string",
            "description": "Key of the status to move to, from this module's status settings.",
            "example": "open"
          }
        }
      },
      "TransitionStatusFormModel": {
        "type": "object",
        "description": "Moves selected expenses to the requested workflow status.",
        "required": [
          "status",
          "expense_ids"
        ],
        "properties": {
          "expense_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "status": {
            "type": "string",
            "description": "Target status. Transitions are strictly `draft` -> `submitted` -> `approved`; the ledger\nentry is posted on `approved`. A disallowed move is reported per expense in `failed_updates`."
          }
        },
        "example": {
          "expense_ids": [
            "00000000-0000-4000-8000-000000000009"
          ],
          "status": "submitted"
        }
      },
      "TrialBalanceEntry": {
        "type": "object",
        "required": [
          "account_code",
          "is_system_defined"
        ],
        "properties": {
          "account_code": {
            "type": "string",
            "description": "Account code in the chart of accounts."
          },
          "account_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account identifier (`id` from the chart of accounts)."
          },
          "account_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Account name in the chart of accounts."
          },
          "account_number": {
            "type": [
              "string",
              "null"
            ],
            "description": "Bank account number, when the account is a bank account."
          },
          "balance": {
            "type": [
              "string",
              "null"
            ],
            "description": "Decimal string in the record's currency."
          },
          "credit": {
            "type": [
              "string",
              "null"
            ]
          },
          "debit": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_system_defined": {
            "type": "boolean",
            "description": "Set by the system or a connected integration; read-only."
          }
        }
      },
      "UpdateDimensionRequest": {
        "type": "object",
        "description": "Updates an accounting dimension's editable definition fields. Omitted fields retain their current values.",
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "scopes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DimensionScope"
            }
          }
        },
        "additionalProperties": false
      },
      "UpdateDimensionValueRequest": {
        "type": "object",
        "description": "Updates a dimension value's editable fields, including its label and parent assignment.",
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_group": {
            "type": "boolean"
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "parent_value_id": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "additionalProperties": false
      },
      "UpdateEndpointRequest": {
        "type": "object",
        "description": "Updates a webhook destination's editable delivery settings and event subscriptions.",
        "properties": {
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "enabled_events": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            }
          },
          "headers": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/CustomHeaderInput"
            }
          },
          "name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Display name."
          },
          "url": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "example": {
          "description": "Receives accounting lifecycle events",
          "name": "Accounting events"
        }
      },
      "UserActivityListModel": {
        "type": "object",
        "description": "Activities visible to the selected user and tenant context.",
        "required": [
          "total_records",
          "page_size",
          "page_number",
          "activity"
        ],
        "properties": {
          "activity": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActivityDbModel"
            }
          },
          "page_number": {
            "type": "integer",
            "format": "int64",
            "description": "Page returned, 1-based.",
            "minimum": 0
          },
          "page_size": {
            "type": "integer",
            "format": "int64",
            "description": "Records per page in this response.",
            "minimum": 0
          },
          "total_records": {
            "type": "integer",
            "format": "int64",
            "description": "Records matching the filters, across all pages.",
            "minimum": 0
          }
        }
      },
      "UserActivityListResponseModel": {
        "type": "object",
        "description": "The user activity feed returned with its continuation metadata.",
        "properties": {
          "data": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/UserActivityListModel"
              }
            ]
          }
        }
      },
      "UserError": {
        "type": "object",
        "description": "Structured details explaining why an API operation was rejected.",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "integer",
            "format": "int32",
            "description": "HTTP status of the response, repeated in the body.",
            "minimum": 0
          },
          "details": {
            "description": "Free-form JSON; keys and values depend on the producing workflow."
          },
          "message": {
            "type": "string",
            "description": "What went wrong. Usually a stable upper-case code such as `INVALID_ISSUE_DATE`; branch on\nit, and translate it for display. Some older operations return a short English sentence."
          }
        }
      },
      "UserErrorModel": {
        "type": "object",
        "description": "An API error containing a stable machine code and optional structured details for the client to translate.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/UserError"
          }
        }
      },
      "ValidateAppTokenFormModel": {
        "type": "object",
        "description": "Validates the supplied App Connect token without requiring that token in the authorization header.",
        "properties": {
          "token": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ValidationErrorResponse": {
        "type": "object",
        "description": "A validation error response identifying invalid fields and their machine-readable errors.",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "description": "Field name mapped to its error codes. Nested fields join their path with underscores,\nincluding list indexes: `items_0_item_id` is `item_id` on the first entry of `items`.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "propertyNames": {
              "type": "string"
            }
          }
        },
        "example": {
          "error": {
            "item_name": [
              "REQUIRED_FIELD"
            ],
            "unit_price": [
              "MUST_BE_POSITIVE"
            ]
          }
        }
      },
      "Value": {},
      "ValueCounts": {
        "type": "object",
        "required": [
          "active",
          "archived",
          "all"
        ],
        "properties": {
          "active": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "all": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "archived": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      },
      "ValuePathEntry": {
        "type": "object",
        "required": [
          "id",
          "code",
          "name"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "id": {
            "type": "string",
            "description": "Identifier of the record."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          }
        }
      },
      "VoidJournalForm": {
        "type": "object",
        "description": "Selects journals by stable anchor ID for voiding. Voiding preserves journal history and reverses its financial effect.",
        "required": [
          "journal_ids"
        ],
        "properties": {
          "journal_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Journals to void, by anchor_id. The current version of each journal is\nvoided. Transitional: the current version's id is also accepted; an\narchived version id is rejected with JOURNAL_NOT_CURRENT."
          }
        },
        "example": {
          "journal_ids": [
            "00000000-0000-4000-8000-000000000008"
          ]
        }
      },
      "WebhookProtocolResponse": {
        "type": "object",
        "description": "The protocol-level response returned by a webhook operation.",
        "required": [
          "header_prefix",
          "signature_header",
          "event_id_header",
          "delivery_attempt_header",
          "user_agent"
        ],
        "properties": {
          "delivery_attempt_header": {
            "type": "string"
          },
          "event_id_header": {
            "type": "string"
          },
          "header_prefix": {
            "type": "string"
          },
          "signature_header": {
            "type": "string"
          },
          "user_agent": {
            "type": "string"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Access & Permissions",
      "description": "### Access Control & Authorization\n\nThis module manages role-based access control (RBAC) across the platform. It defines how users are authorized to perform actions within a company by assigning roles and permissions.\n\n**Key Capabilities:**\n- Create and manage company-specific roles\n- Assign granular permissions to roles across modules\n- Resolve effective permissions for users\n- Enforce tenant-isolated access\n\n**How It Works:**\nEach user is associated with a role within a company. Roles contain a set of permissions (e.g., `invoice.create`, `expense.approve`) that determine what actions the user can perform.\n\nAll access checks are evaluated dynamically and are scoped per tenant, ensuring strict data isolation and security.\n\n**Use Cases:**\n- Define Admin, Accountant, or Viewer roles\n- Restrict access to sensitive operations (e.g., financial approvals)\n- Enable fine-grained feature control across modules\n\n"
    },
    {
      "name": "Action Verification",
      "description": "Context-bound email confirmation challenges for sensitive actions."
    },
    {
      "name": "App Connect",
      "description": "Create and manage external application credentials, role-backed access, token exchange, and App Connect audit trails."
    },
    {
      "name": "Webhooks",
      "description": "Configure signed webhook notifications and inspect their event catalog."
    },
    {
      "name": "Company / Payment Instructions",
      "description": "### Treasury & Payout Configuration\nEndpoints for managing the organization's verified bank accounts and disbursement methods. These instructions serve as the authoritative source for automated payouts, payroll distribution, and bank reconciliation within the accounting engine. \n\n**Security Note:** All modifications are recorded in the system audit log to maintain fiscal integrity."
    },
    {
      "name": "Company",
      "description": "### Organization Management\nEndpoints for creating, updating, and managing company profiles. Includes onboarding workflows, logo management, and soft-delete capabilities."
    },
    {
      "name": "Company / Connections",
      "description": "### Inter-Company Relationships\nManagement of company-to-company connection mappings, enabling B2B collaboration and document exchange between organizations."
    },
    {
      "name": "Company / Currency",
      "description": "### Multi-Currency Configuration\nEndpoints for configuring the currencies supported by the organization, including default currency selection and exchange rate preferences."
    },
    {
      "name": "Company / Email Templates",
      "description": "### Transactional Email Customization\nManagement of email templates used for automated communications such as invoice delivery, payment reminders, and receipt notifications."
    },
    {
      "name": "Company / Payment Modes",
      "description": "### Accepted Payment Methods\nManagement of the payment methods (e.g., Bank Transfer, Cash, Cheque) that the organization accepts from its clients."
    },
    {
      "name": "Company / Payment Terms",
      "description": "### Invoice Payment Terms\nConfiguration of standard payment term templates (e.g., Net 30, Net 60, Due on Receipt) applied to invoices and bills."
    },
    {
      "name": "Company / Email Delivery",
      "description": "### Email Delivery Configuration\nManagement of SMTP server settings used for sending transactional emails. Supports TLS/SSL security methods and custom server configurations."
    },
    {
      "name": "Company / Stripe Connect",
      "description": "### Stripe Connect Integration\nEndpoints for managing Stripe Connect accounts, enabling marketplace-style payment flows with connected account onboarding, status tracking, and account lifecycle management."
    },
    {
      "name": "Items",
      "description": "### Product & Service Registry\n\nCentralized management of the organization's catalog. This module handles both tangible inventory and intangible services, providing the essential pricing, tax, and accounting metadata required for document line items (Invoices, Bills, and Quotes)."
    },
    {
      "name": "Clients",
      "description": "### Customer Relationship Management\n\nCentral registry for all revenue-generating entities. This module tracks client profiles, billing addresses, and default payment terms used to automate the generation of **Quotes** and **Invoices**."
    },
    {
      "name": "Vendors",
      "description": "### Supplier & Partner Registry\n\nManagement of external service providers and product suppliers. Use these endpoints to maintain procurement contact data, default expense categories, and credit terms for **Bills** and **Purchase Orders**."
    },
    {
      "name": "Invoices",
      "description": "### Accounts Receivable\n\nFormal billing documents issued to clients. Use these endpoints to manage the lifecycle of revenue collection, from draft generation to final payment reconciliation."
    },
    {
      "name": "Quotes",
      "description": "### Sales Proposals\n\nNon-binding estimates and price quotes. These serve as the initial engagement point and can be converted into active Invoices once approved by the customer."
    },
    {
      "name": "Credit Notes",
      "description": "### Revenue Adjustments\n\nDocuments issued to reduce a customer's balance. Essential for handling returns, disputes, or overpayments while maintaining an accurate audit trail."
    },
    {
      "name": "Bills",
      "description": "### Accounts Payable\n\nVendor-issued invoices recorded for internal payment. Use these to track external liabilities and manage outgoing cash flow and supplier settlements."
    },
    {
      "name": "Purchase Orders",
      "description": "### Procurement Control\n\nOfficial authorization sent to vendors for purchases. POs act as the primary control mechanism for corporate spending and inventory tracking."
    },
    {
      "name": "Expenses",
      "description": "Record, inspect, and manage tenant expenses, including line items, taxes, attributes, and supporting attachments."
    },
    {
      "name": "Accounting / Dimensions",
      "description": "Tenant-owned dimension registry and versioned classification corrections. Activation is gated pending database acceptance."
    },
    {
      "name": "Accounting / Journals",
      "description": "### General Ledger & Journal Entries\n\nCreate, inspect, and correct the tenant's primary accounting records. Posted journals follow double-entry rules and retain their original audit evidence.\n\n* **Audit Trail:** Every entry generates a unique transaction hash.\n* **Immutability:** Once 'Posted', entries can only be reversed or voided."
    },
    {
      "name": "Accounting / Accounts",
      "description": "### Cash & Liquidity Management\n\nControl and reconciliation of bank accounts, petty cash, and credit lines. Use these endpoints to track real-time balances and synchronize external bank statements with the internal ledger."
    },
    {
      "name": "Accounting / Reconciliations",
      "description": "### Verification & Financial Integrity\n\nThe process of matching internal ledger records against external bank statements. This module ensures that the 'Book Balance' and 'Statement Balance' are synchronized.\n\n* **Discrepancy Control:** Automatically calculates the 'diff' to identify missing or erroneous transactions.\n* **Transaction Locking:** Finalizing a reconciliation locks the associated period, preventing retrospective changes to the audit trail.\n* **Adjustment Journals:** Supports the direct creation of balancing entries for bank charges or interest."
    },
    {
      "name": "Accounting / Transactions",
      "description": "### Ledger Ingestion & Categorization\n\nThe foundational layer of the general ledger, handling the intake of all financial movements from linked bank feeds and manual entries.\n\n* **Matching Engine:** Support for linking bank movements to existing Invoices, Bills, and Journal Entries to close the loop on accounts receivable/payable.\n* **Exclusion Logic:** Capabilities to 'Ignore' or 'Exclude' non-business movements or duplicates while maintaining a clear audit trail of the reason.\n* **Entity Mapping:** Allows for complex 'Many-to-Many' splits, where a single transaction can be allocated across multiple ledger entities."
    },
    {
      "name": "Configuration & Reference Data",
      "description": "### Global Configuration & Lookups\nRead-only endpoints for retrieving localized system data, currency conversions, and regional parameters."
    },
    {
      "name": "Taxes & Submissions",
      "description": "### Tax Configuration & Reporting\n\nThis module manages tax definitions, calculations, and regulatory reporting across the platform. It enables businesses to define applicable taxes, apply them to transactions, and generate structured tax reports for compliance.\n\n**Key Capabilities:**\n- Create and manage tax rates (e.g., GST, VAT, Sales Tax)\n- Support multiple tax types and categories (sale, purchase, etc.)\n- Configure recoverable vs non-recoverable taxes\n- Apply taxes dynamically to invoices, expenses, and transactions\n- Generate and submit tax reports\n- Track tax report submissions and their lifecycle\n- Build a tax from reusable components (a US state, county and city stack; an Indian CGST and SGST split), each with its own dated rates\n\n**Tax components:**\nA component is a percentage with its own rate history. A tax made of components charges their sum on the line's taxable base, and the line tax is split across them. Fixed-amount levies, compound (tax-on-tax) components and components on a different base are not supported. Rate classes are separate components. Codes are free identifiers, unique per company and matched exactly after trimming; `country_code` and `region` are optional and checked for ISO format and prefix only.\n\n**How It Works:**\nTaxes are defined at the company (tenant) level and linked to financial transactions. Each tax includes attributes such as rate, category, and recoverability.\n\nDuring transaction processing, applicable taxes are calculated and stored. These records are later aggregated into tax reports, which can be submitted and tracked via the reporting workflow.\n\n**Use Cases:**\n- Configure GST/VAT for invoices and expenses\n- Handle input/output tax tracking for compliance\n- Generate periodic tax reports (monthly, quarterly, etc.)\n- Maintain audit-ready tax submission records\n\n"
    },
    {
      "name": "Audit Activity",
      "description": "### Operational Audit Trail & Record History\n\nA high-fidelity registry of all system interactions and data mutations. This module provides a centralized, immutable timeline of 'Who, What, and When,' ensuring total transparency across the organization. It tracks the complete evolution of records—from initial creation to final archival—offering the forensic evidence required for internal oversight and regulatory compliance."
    },
    {
      "name": "Late Fees",
      "description": "### Invoice Late Fee Rules\nEndpoints for managing the penalty rules applied to overdue invoices. Use these APIs to define percentage-based or flat late fee policies, control activation, and retrieve the rules available to a company for document workflows."
    },
    {
      "name": "Projects & Timesheets",
      "description": "### Project Management\nEndpoints for managing projects, reusable tasks, and billable timesheets within the authenticated company. Use these APIs to maintain project work, log time, and retrieve invoice-ready time summaries."
    },
    {
      "name": "Financial Reports",
      "description": "Generate tenant financial statements and ledger reports from the same posted accounting records used by hosted and embedded reporting experiences."
    }
  ],
  "servers": [
    {
      "url": "https://api.newledger.io",
      "description": "Production (US)"
    }
  ]
}
