{
  "openapi": "3.0.3",
  "info": {
    "title": "EntryHarbor Agent API",
    "version": "1.0.0",
    "description": "Manage organization data using an account-owned API token. Start with GET /api/agent/v1/organizations. Only current administered organizations within the token\u0027s scope are accessible. Read /api/agent/v1/docs for workflows and write semantics."
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "externalDocs": {
    "description": "Agent onboarding and workflows",
    "url": "/api/agent/v1/docs"
  },
  "security": [
    {
      "AgentToken": []
    }
  ],
  "paths": {
    "/api/agent/v1/organizations": {
      "get": {
        "operationId": "ListOrganizations",
        "summary": "List the organizations this token can currently administer. Always start here to discover authorized organization IDs.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/OrganizationResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}": {
      "get": {
        "operationId": "GetOrganization",
        "summary": "Read an authorized organization\u0027s settings.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrganizationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/categories": {
      "get": {
        "operationId": "ListCategories",
        "summary": "List categories. Set includeArchived=true when preparing an update or checking for an existing category.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CategoryResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "CreateCategory",
        "summary": "Create a category. Body organizationId must match the URL. Category types: Expense=0, Income=1. A category maps to a tax line or a balance sheet account, never both.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/categories/{id}": {
      "put": {
        "operationId": "UpdateCategory",
        "summary": "Replace category fields. Read the current category first and preserve values that should remain. Set isArchived=true to archive a category that is in use.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CategoryUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CategoryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "DeleteCategory",
        "summary": "Delete an unused category. Categories referenced by transactions or loans must be archived instead.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentMutationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/payment-accounts": {
      "get": {
        "operationId": "ListPaymentAccounts",
        "summary": "List payment accounts, optionally including archived accounts.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PaymentAccountResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "CreatePaymentAccount",
        "summary": "Create a payment account. Body organizationId must match the URL. Kind: Other=0, Checking=1, Savings=2, CreditCard=3, Cash=4, PersonalFunds=5.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentAccountCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentAccountResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/payment-accounts/{id}": {
      "put": {
        "operationId": "UpdatePaymentAccount",
        "summary": "Replace payment-account fields, including opening balance and archive status. Read current fields before changing them.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentAccountUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentAccountResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "DeletePaymentAccount",
        "summary": "Delete an unused payment account. Accounts used by transactions, bank connections, or task history must be archived instead.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentMutationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/ledger": {
      "get": {
        "operationId": "ListLedger",
        "summary": "List ledger transactions and matching totals. Page starts at 1; pageSize defaults to 50 and must be between 1 and 200. Filter dates are inclusive.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "fromDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "nullable": true
            }
          },
          {
            "name": "toDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "nullable": true
            }
          },
          {
            "name": "categoryId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "nullable": true
            }
          },
          {
            "name": "paymentAccountId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "nullable": true
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "enum": [
                0,
                1,
                2
              ],
              "description": "0=Expense, 1=Income, 2=Transfer",
              "nullable": true
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "uncategorizedOnly",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50,
              "minimum": 1,
              "maximum": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerTransactionListResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "CreateLedger",
        "summary": "Create a ledger transaction. Body organizationId must match the URL. Amount is positive currency, type determines income or expense. Related category, account, receipt, and transfer peer must belong to this organization. Writes are immediate.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LedgerTransactionCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerTransactionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/ledger/{id}": {
      "get": {
        "operationId": "GetLedger",
        "summary": "Read one ledger transaction before editing or verifying a previous write.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerTransactionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "UpdateLedger",
        "summary": "Replace a ledger transaction\u0027s editable fields. Fetch it first. Imported bank facts, loan-backed rows, split classifications, and linked transfer fields retain domain protections.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LedgerTransactionUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerTransactionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "DeleteLedger",
        "summary": "Delete a deletable ledger transaction. Existing protections for bank imports, loan events, and linked transactions still apply.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgentMutationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/receipts": {
      "get": {
        "operationId": "ListReceipts",
        "summary": "Read receipts, optionally filtering vendor and inclusive receipt dates. Page starts at 1; pageSize defaults to 50 and has maximum 100. Results are an array sorted newest first; an empty page ends pagination.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "vendor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "nullable": true
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "nullable": true
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 50,
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReceiptResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/receipts/{id}": {
      "get": {
        "operationId": "GetReceipt",
        "summary": "Read a receipt and its current parsing and review details.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/reports/pnl": {
      "get": {
        "operationId": "GetPnl",
        "summary": "Read profit and loss over inclusive ISO dates from and to. Transfers and balance-sheet classifications are excluded by existing reporting rules.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PnlResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/reports/balance-sheet": {
      "get": {
        "operationId": "GetBalanceSheet",
        "summary": "Read the balance sheet at the required inclusive ISO asOf date.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "asOf",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BalanceSheetResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/customers": {
      "get": {
        "operationId": "ListCustomers",
        "summary": "List customers, including account balances and concurrencyVersion for subsequent updates.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CustomerResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "CreateCustomer",
        "summary": "Create a customer. For creation expectedConcurrencyVersion may be 0.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerWriteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/customers/{id}": {
      "put": {
        "operationId": "UpdateCustomer",
        "summary": "Replace customer fields, sending the last read concurrencyVersion as expectedConcurrencyVersion. A stale version returns 409.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerWriteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CustomerResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/invoice-taxes": {
      "get": {
        "operationId": "ListInvoiceTaxes",
        "summary": "List configured invoice taxes. Use their IDs in invoice lines; tax rates are percentage values.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/InvoiceTaxResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/invoices": {
      "get": {
        "operationId": "ListInvoices",
        "summary": "List invoices with state, totals, outstanding balances, and concurrency versions.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/InvoiceResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      },
      "post": {
        "operationId": "CreateInvoice",
        "summary": "Create a draft invoice for a customer in this organization. Dates use YYYY-MM-DD. Lines contain description, quantity, unitPrice, and optional taxIds.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceWriteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/invoices/{id}": {
      "get": {
        "operationId": "GetInvoice",
        "summary": "Read an invoice before updating or transitioning its state.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "UpdateInvoice",
        "summary": "Replace an eligible draft or issued invoice using expectedConcurrencyVersion from its current concurrencyVersion. Preserve line IDs when retaining existing lines. Existing billing protections apply.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvoiceWriteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/invoices/{id}/issue": {
      "post": {
        "operationId": "IssueInvoice",
        "summary": "Issue a draft invoice using expectedConcurrencyVersion. Issuing changes invoice state; it does not email the invoice or initiate a charge.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillingVersionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/v1/organizations/{organizationId}/invoices/{id}/void": {
      "post": {
        "operationId": "VoidInvoice",
        "summary": "Void an eligible invoice using expectedConcurrencyVersion and reason. Active checkout and existing billing state protections still apply.",
        "parameters": [
          {
            "name": "organizationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          },
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillingVersionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvoiceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/Category": {
      "get": {
        "operationId": "Category_List",
        "summary": "List",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/CategoryResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/Ledger/from-receipt": {
      "post": {
        "operationId": "Ledger_CreateFromReceipt",
        "summary": "CreateFromReceipt",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LedgerTransactionFromReceiptRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerTransactionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/Ledger/from-receipts": {
      "post": {
        "operationId": "Ledger_CreateFromReceipts",
        "summary": "CreateFromReceipts",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LedgerTransactionsFromReceiptsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/LedgerTransactionResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/Ledger/unposted-receipts": {
      "get": {
        "operationId": "Ledger_UnpostedReceipts",
        "summary": "UnpostedReceipts",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UnpostedReceiptResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/PaymentAccount": {
      "get": {
        "operationId": "PaymentAccount_List",
        "summary": "List",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "includeArchived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/PaymentAccountResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/Receipt": {
      "get": {
        "operationId": "Receipt_List",
        "summary": "List",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "vendor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": ""
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "nullable": true
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "nullable": true
            }
          },
          {
            "name": "minAmount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "format": "decimal",
              "nullable": true
            }
          },
          {
            "name": "maxAmount",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "format": "decimal",
              "nullable": true
            }
          },
          {
            "name": "parseStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "enum": [
                0,
                1,
                2,
                3
              ],
              "description": "0=Pending, 1=Processing, 2=Succeeded, 3=Failed",
              "nullable": true
            }
          },
          {
            "name": "reviewStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "enum": [
                0,
                1,
                2,
                3
              ],
              "description": "0=NotEvaluated, 1=Ready, 2=NeedsReview, 3=Reviewed",
              "nullable": true
            }
          },
          {
            "name": "needsReview",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "nullable": true
            }
          },
          {
            "name": "inLedger",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "nullable": true
            }
          },
          {
            "name": "workQueue",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "nullable": true,
              "minimum": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "nullable": true,
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "name": "sortBy",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "enum": [
                0,
                1
              ],
              "description": "0=ReceiptDate, 1=UploadDate",
              "default": 0
            }
          },
          {
            "name": "tag",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ReceiptResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/Receipt/{id}": {
      "get": {
        "operationId": "Receipt_Get",
        "summary": "Get",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      },
      "put": {
        "operationId": "Receipt_Update",
        "summary": "Update",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReceiptUpdateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/Receipt/{id}/review": {
      "get": {
        "operationId": "Receipt_GetReviewDetail",
        "summary": "GetReviewDetail",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/Receipt/{id}/transfer": {
      "post": {
        "operationId": "Receipt_Transfer",
        "summary": "Transfer",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 1
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReceiptTransferRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReceiptResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/Tag": {
      "get": {
        "operationId": "Tag_List",
        "summary": "List",
        "parameters": [
          {
            "name": "organizationId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success. Agent API responses are not cached.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/TagResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed JSON or parameter binding/model validation failure."
          },
          "401": {
            "description": "Missing, invalid, expired, or revoked API token."
          },
          "429": {
            "description": "Rate limit exceeded: 120 requests per minute per IP, shared by agent data, shared frontend, and token-management routes. Wait before retrying reads; verify the outcome of writes before retrying."
          },
          "403": {
            "description": "Token does not authorize the organization, the owner no longer administers it, or a legacy transfer crosses organizations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Record not found in the authorized organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Business rule or concurrency conflict. Read the current state before retrying.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid field values, organization mismatch, or linked records outside the organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiMutationErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "AgentToken": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "EntryHarbor API token",
        "description": "Send Authorization: Bearer \u003Ctoken\u003E. Create this token in Admin \u003E Agent access. Shared frontend routes also accept the app\u2019s interactive login JWT."
      }
    },
    "schemas": {
      "OrganizationResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "purpose": {
            "type": "integer",
            "enum": [
              0,
              1
            ],
            "description": "0=Business, 1=PersonalFamily"
          },
          "paymentAddress": {
            "type": "string",
            "nullable": true
          },
          "invoicePaymentInstructions": {
            "type": "string",
            "nullable": true
          },
          "includeInvoicePaymentLink": {
            "type": "boolean"
          },
          "invoiceEmailDisplayName": {
            "type": "string",
            "nullable": true
          },
          "concurrencyVersion": {
            "type": "integer",
            "format": "int64"
          },
          "role": {
            "type": "integer",
            "enum": [
              0,
              1
            ],
            "description": "0=Admin, 1=Accountant"
          },
          "isOwner": {
            "type": "boolean"
          },
          "taxClassification": {
            "type": "integer",
            "enum": [
              0,
              1,
              2,
              3
            ],
            "description": "0=Unspecified, 1=ScheduleC, 2=Partnership1065, 3=SCorp1120S"
          }
        },
        "required": [
          "id",
          "name",
          "purpose",
          "includeInvoicePaymentLink",
          "concurrencyVersion",
          "role",
          "isOwner",
          "taxClassification"
        ]
      },
      "ApiMutationErrorResponse": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ]
      },
      "CategoryResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Expense, 1=Income, 2=Transfer"
          },
          "taxLineId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "taxForm": {
            "type": "integer",
            "enum": [
              1,
              2,
              3
            ],
            "description": "1=ScheduleC, 2=Form1120S, 3=Form1065",
            "nullable": true
          },
          "taxLineCode": {
            "type": "string",
            "nullable": true
          },
          "taxLineLabel": {
            "type": "string",
            "nullable": true
          },
          "scheduleCLine": {
            "type": "string",
            "nullable": true
          },
          "balanceSheetAccountId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "balanceSheetAccountName": {
            "type": "string",
            "nullable": true
          },
          "balanceSheetAccountKind": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Asset, 1=Liability, 2=Equity",
            "nullable": true
          },
          "isArchived": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "id",
          "name",
          "type",
          "isArchived",
          "sortOrder"
        ]
      },
      "CategoryCreateRequest": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Expense, 1=Income, 2=Transfer"
          },
          "taxLineId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "scheduleCLine": {
            "type": "string",
            "nullable": true
          },
          "balanceSheetAccountId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "required": [
          "organizationId",
          "name",
          "type"
        ]
      },
      "CategoryUpdateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "type": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Expense, 1=Income, 2=Transfer"
          },
          "taxLineId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "scheduleCLine": {
            "type": "string",
            "nullable": true
          },
          "balanceSheetAccountId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "isArchived": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "type",
          "isArchived"
        ]
      },
      "AgentMutationResponse": {
        "type": "object",
        "properties": {
          "deleted": {
            "type": "boolean"
          }
        },
        "required": [
          "deleted"
        ]
      },
      "PaymentAccountResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "integer",
            "enum": [
              0,
              1,
              2,
              3,
              4,
              5
            ],
            "description": "0=Other, 1=Checking, 2=Savings, 3=CreditCard, 4=Cash, 5=PersonalFunds"
          },
          "openingBalance": {
            "type": "number",
            "format": "decimal"
          },
          "openingBalanceDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "isArchived": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "openingBalance",
          "isArchived",
          "sortOrder"
        ]
      },
      "PaymentAccountCreateRequest": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "integer",
            "enum": [
              0,
              1,
              2,
              3,
              4,
              5
            ],
            "description": "0=Other, 1=Checking, 2=Savings, 3=CreditCard, 4=Cash, 5=PersonalFunds"
          },
          "openingBalance": {
            "type": "number",
            "format": "decimal"
          },
          "openingBalanceDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "organizationId",
          "name",
          "kind",
          "openingBalance"
        ]
      },
      "PaymentAccountUpdateRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "integer",
            "enum": [
              0,
              1,
              2,
              3,
              4,
              5
            ],
            "description": "0=Other, 1=Checking, 2=Savings, 3=CreditCard, 4=Cash, 5=PersonalFunds"
          },
          "openingBalance": {
            "type": "number",
            "format": "decimal"
          },
          "openingBalanceDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "isArchived": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "kind",
          "openingBalance",
          "isArchived"
        ]
      },
      "LedgerTransactionListResponse": {
        "type": "object",
        "properties": {
          "loanCandidateForId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerTransactionResponse"
            }
          },
          "totalCount": {
            "type": "integer",
            "format": "int32"
          },
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "pageSize": {
            "type": "integer",
            "format": "int32"
          },
          "expenseTotal": {
            "type": "number",
            "format": "decimal"
          },
          "incomeTotal": {
            "type": "number",
            "format": "decimal"
          },
          "transferTotal": {
            "type": "number",
            "format": "decimal"
          },
          "uncategorizedCount": {
            "type": "integer",
            "format": "int32"
          },
          "unpairedTransferCount": {
            "type": "integer",
            "format": "int32"
          },
          "activityMode": {
            "type": "boolean"
          },
          "activityMoneyIn": {
            "type": "number",
            "format": "decimal"
          },
          "activityMoneyOut": {
            "type": "number",
            "format": "decimal"
          },
          "activityNet": {
            "type": "number",
            "format": "decimal"
          },
          "pendingCreations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerPendingChangeSummaryResponse"
            }
          }
        },
        "required": [
          "transactions",
          "totalCount",
          "page",
          "pageSize",
          "expenseTotal",
          "incomeTotal",
          "transferTotal",
          "uncategorizedCount",
          "unpairedTransferCount",
          "activityMode",
          "activityMoneyIn",
          "activityMoneyOut",
          "activityNet",
          "pendingCreations"
        ]
      },
      "LedgerTransactionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "organizationId": {
            "type": "integer",
            "format": "int32"
          },
          "type": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Expense, 1=Income, 2=Transfer"
          },
          "transactionDate": {
            "type": "string",
            "format": "date-time"
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          },
          "currencyCode": {
            "type": "string",
            "nullable": true
          },
          "bankFactsLocked": {
            "type": "boolean"
          },
          "billPayments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerBillPaymentResponse"
            }
          },
          "payee": {
            "type": "string"
          },
          "notes": {
            "type": "string"
          },
          "categoryId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "categoryName": {
            "type": "string",
            "nullable": true
          },
          "assetId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "assetName": {
            "type": "string",
            "nullable": true
          },
          "assetAssignmentToken": {
            "type": "string"
          },
          "splits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerSplitResponse"
            }
          },
          "classificationToken": {
            "type": "string"
          },
          "matchedActivityAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "paymentAccountId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "paymentAccountName": {
            "type": "string",
            "nullable": true
          },
          "receiptId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "statementImportId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "bankDescription": {
            "type": "string",
            "nullable": true
          },
          "bankPostedDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "appliedByVendorRuleId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "appliedByVendorRuleText": {
            "type": "string",
            "nullable": true
          },
          "transferPeerId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "transferPeerPaymentAccountName": {
            "type": "string",
            "nullable": true
          },
          "transferPeerPayee": {
            "type": "string",
            "nullable": true
          },
          "transferPeerTransactionDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "transferPeerAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "transferPeerDirection": {
            "type": "integer",
            "enum": [
              0,
              1
            ],
            "description": "0=Out, 1=In",
            "nullable": true
          },
          "transferDirection": {
            "type": "integer",
            "enum": [
              0,
              1
            ],
            "description": "0=Out, 1=In",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "loanId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "loanName": {
            "type": "string",
            "nullable": true
          },
          "loanEventId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "loanEventKind": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Advance, 1=Payment, 2=Reversal",
            "nullable": true
          },
          "reversesLoanEventId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "suggestedLoanId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "suggestedLoanName": {
            "type": "string",
            "nullable": true
          },
          "pending": {
            "allOf": [
              {
                "$ref": "#/components/schemas/LedgerPendingChangeSummaryResponse"
              }
            ],
            "nullable": true
          }
        },
        "required": [
          "id",
          "organizationId",
          "type",
          "transactionDate",
          "amount",
          "bankFactsLocked",
          "billPayments",
          "payee",
          "notes",
          "assetAssignmentToken",
          "splits",
          "classificationToken",
          "createdAt"
        ]
      },
      "LedgerBillPaymentResponse": {
        "type": "object",
        "properties": {
          "allocationId": {
            "type": "integer",
            "format": "int32"
          },
          "billId": {
            "type": "integer",
            "format": "int32"
          },
          "supplier": {
            "type": "string"
          },
          "invoiceNumber": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          },
          "currencyCode": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "allocationId",
          "billId",
          "supplier",
          "amount"
        ]
      },
      "LedgerSplitResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "categoryId": {
            "type": "integer",
            "format": "int32"
          },
          "categoryName": {
            "type": "string"
          },
          "assetId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "assetName": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          },
          "notes": {
            "type": "string"
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "id",
          "categoryId",
          "categoryName",
          "amount",
          "notes",
          "sortOrder"
        ]
      },
      "LedgerPendingChangeSummaryResponse": {
        "type": "object",
        "properties": {
          "pendingChangeId": {
            "type": "integer",
            "format": "int32"
          },
          "changeType": {
            "type": "integer",
            "enum": [
              0,
              1,
              2,
              3,
              4,
              5,
              6,
              7,
              8,
              9,
              10,
              11,
              12,
              13,
              14,
              15,
              16,
              17,
              18,
              19,
              20,
              21,
              22,
              23,
              24,
              25,
              26,
              27,
              28,
              29,
              30,
              31,
              32,
              33,
              34,
              35,
              36,
              37,
              38
            ],
            "description": "0=LedgerTransactionCreate, 1=LedgerTransactionUpdate, 2=LedgerTransactionDelete, 3=LedgerBulkUpdate, 4=LedgerCreateFromReceipt, 5=LedgerAttachReceipt, 6=LedgerDetachReceipt, 7=LedgerLinkTransferPeer, 8=LedgerMatchTransfer, 9=LedgerUnlinkTransferPeer, 10=CategoryCreate, 11=CategoryUpdate, 12=CategoryDelete, 13=CategorySeedDefaults, 14=PaymentAccountCreate, 15=PaymentAccountUpdate, 16=PaymentAccountDelete, 17=VendorRuleCreate, 18=VendorRuleUpdate, 19=VendorRuleDelete, 20=VendorRuleApply, 21=CategoryRemapTaxLines, 22=BalanceSheetAccountCreate, 23=BalanceSheetAccountUpdate, 24=BalanceSheetAccountDelete, 25=LedgerSplitSet, 26=LedgerReconcileDuplicate, 27=LedgerDismissDuplicate, 28=LoanCreate, 29=LoanUpdate, 30=LoanTermPeriodAdd, 31=LoanTermPeriodUpdate, 32=LoanEventSet, 33=LoanEventReverse, 34=LoanEventDelete, 35=LoanCheckpointSet, 36=LoanCheckpointDelete, 37=LoanLifecycle, 38=LoanDelete"
          },
          "payloadJson": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "proposedByUserId": {
            "type": "integer",
            "format": "int32"
          },
          "proposedByName": {
            "type": "string"
          },
          "proposedAt": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "pendingChangeId",
          "changeType",
          "payloadJson",
          "summary",
          "proposedByUserId",
          "proposedByName",
          "proposedAt"
        ]
      },
      "LedgerTransactionCreateRequest": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "integer",
            "format": "int32"
          },
          "type": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Expense, 1=Income, 2=Transfer"
          },
          "transactionDate": {
            "type": "string",
            "format": "date-time"
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          },
          "payee": {
            "type": "string"
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "categoryId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "paymentAccountId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "receiptId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "transferDirection": {
            "type": "integer",
            "enum": [
              0,
              1
            ],
            "description": "0=Out, 1=In",
            "nullable": true
          },
          "transferPeerPaymentAccountId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "required": [
          "organizationId",
          "type",
          "transactionDate",
          "amount",
          "payee"
        ]
      },
      "LedgerTransactionUpdateRequest": {
        "type": "object",
        "properties": {
          "type": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Expense, 1=Income, 2=Transfer"
          },
          "transactionDate": {
            "type": "string",
            "format": "date-time"
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          },
          "payee": {
            "type": "string"
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "categoryId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "assetAssignmentToken": {
            "type": "string",
            "nullable": true
          },
          "assetId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "splitAssets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerSplitAssetRequest"
            },
            "nullable": true
          },
          "paymentAccountId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "receiptId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "transferDirection": {
            "type": "integer",
            "enum": [
              0,
              1
            ],
            "description": "0=Out, 1=In",
            "nullable": true
          },
          "transferPeerPaymentAccountId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "required": [
          "type",
          "transactionDate",
          "amount",
          "payee"
        ]
      },
      "LedgerSplitAssetRequest": {
        "type": "object",
        "properties": {
          "splitId": {
            "type": "integer",
            "format": "int32"
          },
          "assetId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "required": [
          "splitId"
        ]
      },
      "ReceiptResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "organizationId": {
            "type": "integer",
            "format": "int32"
          },
          "userId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "concurrencyVersion": {
            "type": "integer",
            "format": "int64"
          },
          "fileName": {
            "type": "string"
          },
          "uploadedAt": {
            "type": "string",
            "format": "date-time"
          },
          "needsParsed": {
            "type": "boolean"
          },
          "vendor": {
            "type": "string"
          },
          "receiptDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "currencyCode": {
            "type": "string",
            "nullable": true
          },
          "subtotalAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "discountAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "taxAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "feeAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "totalAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "tip": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "parseStatus": {
            "type": "integer",
            "enum": [
              0,
              1,
              2,
              3
            ],
            "description": "0=Pending, 1=Processing, 2=Succeeded, 3=Failed"
          },
          "reviewStatus": {
            "type": "integer",
            "enum": [
              0,
              1,
              2,
              3
            ],
            "description": "0=NotEvaluated, 1=Ready, 2=NeedsReview, 3=Reviewed"
          },
          "lastParsedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastParseAttemptNumber": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "lastParserName": {
            "type": "string",
            "nullable": true
          },
          "lastParseStartedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "lastParseCompletedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reviewedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "reviewedByUserId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "reviewedBy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReceiptReviewerSummaryResponse"
              }
            ],
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "fileUrl": {
            "type": "string"
          },
          "thumbnailUrl": {
            "type": "string"
          },
          "ledgerTransactionId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "parseError": {
            "type": "boolean"
          },
          "parseErrorNote": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptItemResponse"
            }
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptAdjustmentResponse"
            }
          },
          "imageVersions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptImageVersionResponse"
            }
          },
          "issues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptReviewIssueResponse"
            }
          },
          "parseProposals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptParseProposalResponse"
            }
          },
          "activeIssueCount": {
            "type": "integer",
            "format": "int32"
          },
          "blockingIssueCount": {
            "type": "integer",
            "format": "int32"
          },
          "hasOutstandingParseProposals": {
            "type": "boolean"
          },
          "canMarkReviewed": {
            "type": "boolean"
          },
          "markReviewedBlockers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "organizationId",
          "concurrencyVersion",
          "fileName",
          "uploadedAt",
          "needsParsed",
          "vendor",
          "parseStatus",
          "reviewStatus",
          "notes",
          "fileUrl",
          "thumbnailUrl",
          "parseError",
          "parseErrorNote",
          "tags",
          "items",
          "adjustments",
          "imageVersions",
          "issues",
          "parseProposals",
          "activeIssueCount",
          "blockingIssueCount",
          "hasOutstandingParseProposals",
          "canMarkReviewed",
          "markReviewedBlockers"
        ]
      },
      "ReceiptReviewerSummaryResponse": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "integer",
            "format": "int32"
          },
          "displayName": {
            "type": "string"
          }
        },
        "required": [
          "userId",
          "displayName"
        ]
      },
      "ReceiptItemResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "unitPrice": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "price": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "lineTotal": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "id",
          "name",
          "sortOrder"
        ]
      },
      "ReceiptAdjustmentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "type": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Discount, 1=Tax, 2=Fee"
          },
          "label": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "affectsTotal": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "id",
          "type",
          "label",
          "affectsTotal",
          "sortOrder"
        ]
      },
      "ReceiptImageVersionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "versionNumber": {
            "type": "integer",
            "format": "int32"
          },
          "fileName": {
            "type": "string"
          },
          "fileUrl": {
            "type": "string"
          },
          "imageHash": {
            "type": "string",
            "nullable": true
          },
          "isCurrent": {
            "type": "boolean"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "supersededAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdByUserId": {
            "type": "integer",
            "format": "int32"
          },
          "createdBy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReceiptReviewerSummaryResponse"
              }
            ],
            "nullable": true
          }
        },
        "required": [
          "id",
          "versionNumber",
          "fileName",
          "fileUrl",
          "isCurrent",
          "createdAt",
          "createdByUserId"
        ]
      },
      "ReceiptReviewIssueResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "receiptId": {
            "type": "integer",
            "format": "int32"
          },
          "sourceParseAttemptId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "duplicateCandidateReceiptId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "code": {
            "type": "string"
          },
          "fieldName": {
            "type": "string"
          },
          "severity": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Information, 1=Warning, 2=Error"
          },
          "isBlocking": {
            "type": "boolean"
          },
          "reason": {
            "type": "string"
          },
          "evidence": {
            "type": "string",
            "nullable": true
          },
          "originalValue": {
            "type": "string",
            "nullable": true
          },
          "resolution": {
            "type": "integer",
            "enum": [
              0,
              1,
              2,
              3,
              4,
              5,
              6
            ],
            "description": "0=Unresolved, 1=Edited, 2=Confirmed, 3=Acknowledged, 4=MarkedUnavailable, 5=AcceptedParseProposal, 6=NoLongerApplicable"
          },
          "acceptedValue": {
            "type": "string",
            "nullable": true
          },
          "resolutionReason": {
            "type": "string",
            "nullable": true
          },
          "isActive": {
            "type": "boolean"
          },
          "allowedActions": {
            "type": "array",
            "items": {
              "type": "integer",
              "enum": [
                0,
                1,
                2,
                3,
                4,
                5
              ],
              "description": "0=ConfirmCorrect, 1=MarkUnavailable, 2=Acknowledge, 3=Reopen, 4=Edit, 5=AcceptParsedReplacement"
            }
          },
          "resolvedByUserId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "resolvedBy": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReceiptReviewerSummaryResponse"
              }
            ],
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "resolvedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "receiptId",
          "code",
          "fieldName",
          "severity",
          "isBlocking",
          "reason",
          "resolution",
          "isActive",
          "allowedActions",
          "createdAt",
          "updatedAt"
        ]
      },
      "ReceiptParseProposalResponse": {
        "type": "object",
        "properties": {
          "sourceParseAttemptId": {
            "type": "integer",
            "format": "int32"
          },
          "sourceAttemptNumber": {
            "type": "integer",
            "format": "int32"
          },
          "fieldPath": {
            "type": "string"
          },
          "acceptedValueJson": {
            "type": "string"
          },
          "proposedValueJson": {
            "type": "string"
          },
          "canAccept": {
            "type": "boolean"
          },
          "unavailableReason": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "sourceParseAttemptId",
          "sourceAttemptNumber",
          "fieldPath",
          "acceptedValueJson",
          "proposedValueJson",
          "canAccept"
        ]
      },
      "PnlResponse": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "integer",
            "format": "int32"
          },
          "from": {
            "type": "string",
            "format": "date-time"
          },
          "to": {
            "type": "string",
            "format": "date-time"
          },
          "income": {
            "$ref": "#/components/schemas/PnlSectionResponse"
          },
          "expenses": {
            "$ref": "#/components/schemas/PnlSectionResponse"
          },
          "net": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "organizationId",
          "from",
          "to",
          "income",
          "expenses",
          "net"
        ]
      },
      "PnlSectionResponse": {
        "type": "object",
        "properties": {
          "type": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Expense, 1=Income, 2=Transfer"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PnlLineResponse"
            }
          },
          "total": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "type",
          "lines",
          "total"
        ]
      },
      "PnlLineResponse": {
        "type": "object",
        "properties": {
          "categoryId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "type": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Expense, 1=Income, 2=Transfer"
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "name",
          "type",
          "amount"
        ]
      },
      "BalanceSheetResponse": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "integer",
            "format": "int32"
          },
          "asOf": {
            "type": "string",
            "format": "date-time"
          },
          "cash": {
            "$ref": "#/components/schemas/BalanceSheetCashSectionResponse"
          },
          "creditCards": {
            "$ref": "#/components/schemas/BalanceSheetOwedSectionResponse"
          },
          "personalFunds": {
            "$ref": "#/components/schemas/BalanceSheetOwedSectionResponse"
          },
          "balanceSheetAccounts": {
            "$ref": "#/components/schemas/BalanceSheetTrackedAccountSectionResponse"
          },
          "retainedEarnings": {
            "type": "number",
            "format": "decimal"
          },
          "totals": {
            "$ref": "#/components/schemas/BalanceSheetTotalsResponse"
          },
          "discrepancy": {
            "type": "number",
            "format": "decimal"
          },
          "dataQuality": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BalanceSheetDataQualityResponse"
            }
          }
        },
        "required": [
          "organizationId",
          "asOf",
          "cash",
          "creditCards",
          "personalFunds",
          "balanceSheetAccounts",
          "retainedEarnings",
          "totals",
          "discrepancy",
          "dataQuality"
        ]
      },
      "BalanceSheetCashSectionResponse": {
        "type": "object",
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BalanceSheetCashAccountResponse"
            }
          },
          "totalBalance": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "accounts",
          "totalBalance"
        ]
      },
      "BalanceSheetCashAccountResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "integer",
            "enum": [
              0,
              1,
              2,
              3,
              4,
              5
            ],
            "description": "0=Other, 1=Checking, 2=Savings, 3=CreditCard, 4=Cash, 5=PersonalFunds"
          },
          "isArchived": {
            "type": "boolean"
          },
          "openingBalance": {
            "type": "number",
            "format": "decimal"
          },
          "balance": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "isArchived",
          "openingBalance",
          "balance"
        ]
      },
      "BalanceSheetOwedSectionResponse": {
        "type": "object",
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BalanceSheetOwedAccountResponse"
            }
          },
          "totalOwed": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "accounts",
          "totalOwed"
        ]
      },
      "BalanceSheetOwedAccountResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "integer",
            "enum": [
              0,
              1,
              2,
              3,
              4,
              5
            ],
            "description": "0=Other, 1=Checking, 2=Savings, 3=CreditCard, 4=Cash, 5=PersonalFunds"
          },
          "isArchived": {
            "type": "boolean"
          },
          "openingBalance": {
            "type": "number",
            "format": "decimal"
          },
          "owed": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "isArchived",
          "openingBalance",
          "owed"
        ]
      },
      "BalanceSheetTrackedAccountSectionResponse": {
        "type": "object",
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BalanceSheetTrackedAccountResponse"
            }
          },
          "assetTotal": {
            "type": "number",
            "format": "decimal"
          },
          "liabilityTotal": {
            "type": "number",
            "format": "decimal"
          },
          "equityTotal": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "accounts",
          "assetTotal",
          "liabilityTotal",
          "equityTotal"
        ]
      },
      "BalanceSheetTrackedAccountResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "kind": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Asset, 1=Liability, 2=Equity"
          },
          "isArchived": {
            "type": "boolean"
          },
          "balance": {
            "type": "number",
            "format": "decimal"
          },
          "loanId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "isArchived",
          "balance"
        ]
      },
      "BalanceSheetTotalsResponse": {
        "type": "object",
        "properties": {
          "assets": {
            "type": "number",
            "format": "decimal"
          },
          "liabilities": {
            "type": "number",
            "format": "decimal"
          },
          "equity": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "assets",
          "liabilities",
          "equity"
        ]
      },
      "BalanceSheetDataQualityResponse": {
        "type": "object",
        "properties": {
          "transactionId": {
            "type": "integer",
            "format": "int32"
          },
          "paymentAccountId": {
            "type": "integer",
            "format": "int32"
          },
          "accountName": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          },
          "transactionDate": {
            "type": "string",
            "format": "date-time"
          },
          "reason": {
            "type": "string"
          }
        },
        "required": [
          "transactionId",
          "paymentAccountId",
          "accountName",
          "amount",
          "transactionDate",
          "reason"
        ]
      },
      "CustomerResponse": {
        "type": "object",
        "properties": {
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerContactResponse"
            }
          },
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "organizationId": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "billingAddress": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "paymentTermsDays": {
            "type": "integer",
            "format": "int32"
          },
          "isArchived": {
            "type": "boolean"
          },
          "concurrencyVersion": {
            "type": "integer",
            "format": "int64"
          },
          "balance": {
            "type": "number",
            "format": "decimal"
          },
          "amountOwed": {
            "type": "number",
            "format": "decimal"
          },
          "creditBalance": {
            "type": "number",
            "format": "decimal"
          },
          "outstandingInvoiceTotal": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "contacts",
          "id",
          "organizationId",
          "name",
          "paymentTermsDays",
          "isArchived",
          "concurrencyVersion",
          "balance",
          "amountOwed",
          "creditBalance",
          "outstandingInvoiceTotal"
        ]
      },
      "CustomerContactResponse": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "contactType": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "contactType"
        ]
      },
      "CustomerWriteRequest": {
        "type": "object",
        "properties": {
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerContactRequest"
            }
          },
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "billingAddress": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "paymentTermsDays": {
            "type": "integer",
            "format": "int32"
          },
          "isArchived": {
            "type": "boolean"
          },
          "expectedConcurrencyVersion": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "contacts",
          "name",
          "paymentTermsDays",
          "isArchived",
          "expectedConcurrencyVersion"
        ]
      },
      "CustomerContactRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "phone": {
            "type": "string",
            "nullable": true
          },
          "contactType": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "contactType"
        ]
      },
      "InvoiceTaxResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "rate": {
            "type": "number",
            "format": "decimal"
          },
          "isDeleted": {
            "type": "boolean"
          },
          "concurrencyVersion": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "id",
          "name",
          "rate",
          "isDeleted",
          "concurrencyVersion"
        ]
      },
      "InvoiceResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "organizationId": {
            "type": "integer",
            "format": "int32"
          },
          "customerId": {
            "type": "integer",
            "format": "int32"
          },
          "customerName": {
            "type": "string"
          },
          "customerEmail": {
            "type": "string",
            "nullable": true
          },
          "paymentLinkUrl": {
            "type": "string",
            "nullable": true
          },
          "hasActiveCheckout": {
            "type": "boolean"
          },
          "hasPendingRefund": {
            "type": "boolean"
          },
          "onlinePaymentStatus": {
            "type": "string",
            "nullable": true
          },
          "emailRecipients": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "automaticEmailPending": {
            "type": "boolean"
          },
          "automaticEmailError": {
            "type": "string",
            "nullable": true
          },
          "firstViewedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "emailSentAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "number": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "string"
          },
          "displayStatus": {
            "type": "string"
          },
          "issueDate": {
            "type": "string",
            "format": "date"
          },
          "dueDate": {
            "type": "string",
            "format": "date"
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "voidReason": {
            "type": "string",
            "nullable": true
          },
          "subtotal": {
            "type": "number",
            "format": "decimal"
          },
          "taxTotal": {
            "type": "number",
            "format": "decimal"
          },
          "total": {
            "type": "number",
            "format": "decimal"
          },
          "amountPaid": {
            "type": "number",
            "format": "decimal"
          },
          "balanceDue": {
            "type": "number",
            "format": "decimal"
          },
          "isOverdue": {
            "type": "boolean"
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineResponse"
            }
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoicePaymentResponse"
            }
          },
          "concurrencyVersion": {
            "type": "integer",
            "format": "int64"
          },
          "recurringInvoiceId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "recurringOccurrence": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "required": [
          "id",
          "organizationId",
          "customerId",
          "customerName",
          "hasActiveCheckout",
          "hasPendingRefund",
          "emailRecipients",
          "automaticEmailPending",
          "status",
          "displayStatus",
          "issueDate",
          "dueDate",
          "subtotal",
          "taxTotal",
          "total",
          "amountPaid",
          "balanceDue",
          "isOverdue",
          "lines",
          "payments",
          "concurrencyVersion"
        ]
      },
      "InvoiceLineResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "number",
            "format": "decimal"
          },
          "unitPrice": {
            "type": "number",
            "format": "decimal"
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          },
          "taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineTaxResponse"
            }
          },
          "taxTotal": {
            "type": "number",
            "format": "decimal"
          },
          "total": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "id",
          "description",
          "quantity",
          "unitPrice",
          "amount",
          "taxes",
          "taxTotal",
          "total"
        ]
      },
      "InvoiceLineTaxResponse": {
        "type": "object",
        "properties": {
          "taxId": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          },
          "rate": {
            "type": "number",
            "format": "decimal"
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          }
        },
        "required": [
          "taxId",
          "name",
          "rate",
          "amount"
        ]
      },
      "InvoicePaymentResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          },
          "effectiveOn": {
            "type": "string",
            "format": "date"
          },
          "paymentMethod": {
            "type": "string",
            "nullable": true
          },
          "paymentReference": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "recordedByUserId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "recordedByName": {
            "type": "string"
          },
          "recordedAt": {
            "type": "string",
            "format": "date-time"
          },
          "isReleased": {
            "type": "boolean"
          },
          "isStripe": {
            "type": "boolean"
          },
          "remainingAmount": {
            "type": "number",
            "format": "decimal"
          },
          "reversals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoicePaymentReversalResponse"
            }
          }
        },
        "required": [
          "id",
          "amount",
          "effectiveOn",
          "recordedByName",
          "recordedAt",
          "isReleased",
          "isStripe",
          "remainingAmount",
          "reversals"
        ]
      },
      "InvoicePaymentReversalResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "decimal"
          },
          "reason": {
            "type": "string"
          },
          "recordedByName": {
            "type": "string"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "stripeRefundId": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "id",
          "kind",
          "status",
          "amount",
          "reason",
          "recordedByName",
          "createdAt"
        ]
      },
      "InvoiceWriteRequest": {
        "type": "object",
        "properties": {
          "customerId": {
            "type": "integer",
            "format": "int32"
          },
          "issueDate": {
            "type": "string",
            "format": "date"
          },
          "dueDate": {
            "type": "string",
            "format": "date"
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "lines": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InvoiceLineRequest"
            }
          },
          "expectedConcurrencyVersion": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "customerId",
          "issueDate",
          "dueDate",
          "lines",
          "expectedConcurrencyVersion"
        ]
      },
      "InvoiceLineRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "description": {
            "type": "string"
          },
          "quantity": {
            "type": "number",
            "format": "decimal"
          },
          "unitPrice": {
            "type": "number",
            "format": "decimal"
          },
          "taxIds": {
            "type": "array",
            "items": {
              "type": "integer",
              "format": "int32"
            }
          }
        },
        "required": [
          "description",
          "quantity",
          "unitPrice",
          "taxIds"
        ]
      },
      "BillingVersionRequest": {
        "type": "object",
        "properties": {
          "expectedConcurrencyVersion": {
            "type": "integer",
            "format": "int64"
          },
          "reason": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "expectedConcurrencyVersion"
        ]
      },
      "LedgerTransactionFromReceiptRequest": {
        "type": "object",
        "properties": {
          "postingAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "expectedReceiptTotal": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "postingPercentage": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "postingBaseAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "receiptId": {
            "type": "integer",
            "format": "int32"
          },
          "categoryId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "paymentAccountId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "required": [
          "receiptId"
        ]
      },
      "LedgerTransactionsFromReceiptsRequest": {
        "type": "object",
        "properties": {
          "paymentAccountId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LedgerTransactionsFromReceiptsItem"
            }
          }
        },
        "required": [
          "items"
        ]
      },
      "LedgerTransactionsFromReceiptsItem": {
        "type": "object",
        "properties": {
          "receiptId": {
            "type": "integer",
            "format": "int32"
          },
          "categoryId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          }
        },
        "required": [
          "receiptId"
        ]
      },
      "UnpostedReceiptResponse": {
        "type": "object",
        "properties": {
          "receiptId": {
            "type": "integer",
            "format": "int32"
          },
          "vendor": {
            "type": "string"
          },
          "receiptDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "uploadedAt": {
            "type": "string",
            "format": "date-time"
          },
          "totalAmount": {
            "type": "number",
            "format": "decimal"
          },
          "suggestedCategoryId": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "suggestedCategoryName": {
            "type": "string",
            "nullable": true
          },
          "suggestedByVendorRuleText": {
            "type": "string",
            "nullable": true
          }
        },
        "required": [
          "receiptId",
          "vendor",
          "uploadedAt",
          "totalAmount"
        ]
      },
      "ReceiptUpdateRequest": {
        "type": "object",
        "properties": {
          "vendor": {
            "type": "string"
          },
          "receiptDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "currencyCode": {
            "type": "string",
            "nullable": true
          },
          "subtotalAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "discountAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "taxAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "feeAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "tip": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "totalAmount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "notes": {
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptItemUpdateRequest"
            }
          },
          "adjustments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptAdjustmentUpdateRequest"
            }
          },
          "expectedConcurrencyVersion": {
            "type": "integer",
            "format": "int64"
          }
        },
        "required": [
          "vendor",
          "notes",
          "tags",
          "items",
          "adjustments",
          "expectedConcurrencyVersion"
        ]
      },
      "ReceiptItemUpdateRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "name": {
            "type": "string"
          },
          "quantity": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "unitPrice": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "lineTotal": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "name",
          "sortOrder"
        ]
      },
      "ReceiptAdjustmentUpdateRequest": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "type": {
            "type": "integer",
            "enum": [
              0,
              1,
              2
            ],
            "description": "0=Discount, 1=Tax, 2=Fee"
          },
          "label": {
            "type": "string"
          },
          "amount": {
            "type": "number",
            "format": "decimal",
            "nullable": true
          },
          "affectsTotal": {
            "type": "boolean"
          },
          "sortOrder": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "type",
          "label",
          "affectsTotal",
          "sortOrder"
        ]
      },
      "ReceiptTransferRequest": {
        "type": "object",
        "properties": {
          "organizationId": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "organizationId"
        ]
      },
      "TagResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ]
      }
    }
  }
}