{
  "openapi": "3.0.1",
  "info": {
    "title": "API",
    "version": "latest"
  },
  "externalDocs": {
    "url": "/"
  },
  "servers": [],
  "tags": [],
  "paths": {
    "/v1/businesses/{businessId}/call-bookings": {
      "get": {
        "summary": "List call bookings",
        "description": "Returns booking details for a business, including scheduled, completed, and cancelled calls. Cancelled bookings are excluded by default. Use this endpoint when you need meeting links, attendance, or bookkeeper contact details. Authenticate with a platform access token or a business-scoped token authorized for this business.",
        "operationId": "call-bookings.list",
        "parameters": [
          {
            "$ref": "#/components/parameters/CallListBusinessId"
          },
          {
            "name": "status",
            "in": "query",
            "description": "Filter by scheduled, completed, or cancelled booking state (case-insensitive). When supplied, this filter takes precedence over include_deleted, so status=cancelled returns cancelled bookings even when include_deleted is false.",
            "schema": {
              "type": "string",
              "example": "cancelled"
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "description": "Include cancelled bookings when no status filter is supplied.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "description": "Sort by a timestamp or derived booking state. Ascending state order is scheduled, completed, then cancelled.",
            "schema": {
              "type": "string",
              "enum": ["event_start_at", "created_at", "updated_at", "status", "state"],
              "default": "event_start_at"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": ["ASC", "DESC"],
              "default": "ASC"
            }
          },
          {
            "$ref": "#/components/parameters/CallListCursor"
          },
          {
            "$ref": "#/components/parameters/CallListLimit"
          },
          {
            "$ref": "#/components/parameters/CallListShowTotalCount"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of call bookings.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["data", "meta"],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiCallBooking"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/calls": {
      "get": {
        "summary": "List business calls",
        "description": "Returns a combined timeline of booked calls and recordings without bookings. Cancelled bookings are included unless you filter by status. Each public response contains only the call ID, start time, and recording flag, not booking details or recording URLs. Authenticate with a platform access token or a business-scoped token authorized for this business. Transcript search with q is not available to public callers.",
        "operationId": "calls.list",
        "parameters": [
          {
            "$ref": "#/components/parameters/CallListBusinessId"
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Inclusive start date in America/New_York. Must not be later than end_date.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "Inclusive end date in America/New_York.",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Filter by booking status. Unbooked calls are recordings without a linked booking. Values are case-sensitive.",
            "schema": {
              "type": "string",
              "enum": ["upcoming", "past", "cancelled", "unbooked"]
            }
          },
          {
            "name": "recording",
            "in": "query",
            "description": "Filter by recording availability. recorded: has a recording; none: has no recording; missing: a past booking without a recording, unless attendance is explicitly false; unbooked: a recording without a booking. Values are case-sensitive.",
            "schema": {
              "type": "string",
              "enum": ["recorded", "none", "missing", "unbooked"]
            }
          },
          {
            "$ref": "#/components/parameters/CallSummarySortBy"
          },
          {
            "$ref": "#/components/parameters/CallSummarySortOrder"
          },
          {
            "$ref": "#/components/parameters/CallListCursor"
          },
          {
            "$ref": "#/components/parameters/CallListLimit"
          },
          {
            "$ref": "#/components/parameters/CallListShowTotalCount"
          }
        ],
        "responses": {
          "200": {
            "description": "A page of public call summaries. No meeting links, recording URLs, or transcripts are returned.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["data", "meta"],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": { "$ref": "#/components/schemas/ApiCallSummary" }
                    },
                    "meta": { "$ref": "#/components/schemas/RequestMetadata" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses": {
      "get": {
        "tags": [],
        "summary": "List businesses",
        "description": "Returns a list of all active businesses that have been registered to a client in Layer.",
        "operationId": "businesses.get",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "legal_name_contains",
            "in": "query",
            "description": "Filter businesses where legal name contains this substring (case-insensitive).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "Filter businesses by exact external ID match.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "industry",
            "in": "query",
            "description": "Filter businesses by exact industry match (e.g. TRUCKING, GENERIC).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "client_name_contains",
            "in": "query",
            "description": "Filter businesses where the owning client's name contains this substring (case-insensitive). Primarily useful for admin users querying across multiple clients.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBusiness"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create business",
        "description": "Creates a new business in Layer. This endpoint is idempotent using the `external_id` field as the idempotency key, so subsequent requests with the same `external_id` will update or no-op.",
        "operationId": "businesses.post",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewBusinessParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "An existing business was found and returned. This occurs when an archived business with matching phone number was unarchived, or a non-archived business with matching external ID was found. The response includes `previously_imported: true` when an existing business is returned.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "A new business was successfully created.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid business creation parameters. Common scenarios include: (1) Phone number already registered with a different external ID, (2) Invalid or missing required fields, (3) Invalid JSON structure.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                },
                "examples": {
                  "phone_number_conflict": {
                    "summary": "Phone number already registered",
                    "value": {
                      "errors": [
                        {
                          "type": "BadRequest",
                          "description": "That phone number is already registered with Layer by another business."
                        }
                      ]
                    }
                  },
                  "invalid_parameters": {
                    "summary": "Invalid or missing required fields",
                    "value": {
                      "errors": [
                        {
                          "type": "InvalidParameters",
                          "description": "Invalid JSON: Field 'id' is required for type with serial name 'AccountId', but it was missing at path: $.line_items[0].account_identifier."
                        }
                      ]
                    }
                  },
                  "general_bad_request": {
                    "summary": "General validation error",
                    "value": {
                      "errors": [
                        {
                          "type": "BadRequest",
                          "description": "At least one field must be provided to update."
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v2/admin/businesses": {
      "get": {
        "tags": [],
        "summary": "List businesses (admin)",
        "description": "Returns a paginated list of businesses with bookkeeping stats. This is an admin-only endpoint that returns businesses across all clients, along with bookkeeping period summaries, task counts, and step counts. Results can be filtered by client, bookkeeper, business search fields, and bookkeeping step/task status.",
        "operationId": "admin.businesses.get",
        "parameters": [
          {
            "name": "client_id",
            "in": "query",
            "description": "Filter businesses belonging to a specific client.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "bookkeeper_id",
            "in": "query",
            "description": "Filter businesses assigned to a specific bookkeeper.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "prioritized_steps",
            "in": "query",
            "description": "Filter by high-priority bookkeeping step status.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "HAS_TODO",
                "NONE"
              ]
            }
          },
          {
            "name": "normal_steps",
            "in": "query",
            "description": "Filter by normal-priority bookkeeping step status.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "HAS_TODO",
                "NONE"
              ]
            }
          },
          {
            "name": "business_tasks",
            "in": "query",
            "description": "Filter by pending business task count.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SOME",
                "NONE"
              ]
            }
          },
          {
            "name": "task_responses",
            "in": "query",
            "description": "Filter by whether businesses have task responses.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SOME",
                "NONE"
              ]
            }
          },
          {
            "name": "legal_name_contains",
            "in": "query",
            "description": "Filter businesses where legal name contains this substring (case-insensitive).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "Filter businesses by exact external ID match.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "industry",
            "in": "query",
            "description": "Filter businesses by exact industry match (e.g. TRUCKING, GENERIC).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "client_name_contains",
            "in": "query",
            "description": "Filter businesses where the owning client's name contains this substring (case-insensitive).",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A paginated list of businesses with admin stats.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/AdminBusiness"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/PaginationMetadata"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}": {
      "get": {
        "tags": [],
        "summary": "Fetch business",
        "description": "Returns the business associated with the provided business id.",
        "operationId": "business.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update business",
        "description": "Updates the business associated with the provided business id. Note that all fields are optional and can be omitted.",
        "operationId": "business.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BusinessUpdatePayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/request-data-deletion": {
      "post": {
        "tags": [],
        "summary": "Request business data deletion",
        "description": "Permanently deletes the business and business-owned data associated with the provided business id. This hard deletion endpoint is intended for CCPA and GDPR compliance requests. Unlike archiving a business, this operation is irreversible.",
        "operationId": "business.request-data-deletion.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to permanently delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Business data deletion request completed. Check the `success` field to determine whether the deletion succeeded.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BusinessDataDeletionResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/archive": {
      "put": {
        "tags": [],
        "summary": "Archive business",
        "description": "Archiving a business makes the business inactive. No additional data will by synchronized and business data is not accessible via normal API endpoints. However, data is retained and can be unarchived in the future.",
        "operationId": "business.archive.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to archive.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business is not found. This indicates the business id is invalid or the business has already been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/unarchive": {
      "post": {
        "tags": [],
        "summary": "Unarchive business",
        "description": "Unarchiving a business will re-activate it. All other endpoints will be able to access the business data again. No additional data syncing or modification will have taken place during the archived period. This is the only method available on a business while it is archived.",
        "operationId": "business.archive.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to archive.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business is not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/readonly-status": {
      "put": {
        "tags": [],
        "summary": "Set business read-only status",
        "description": "Sets or clears the business's read-only mode.",
        "operationId": "business.readonly-status.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BusinessReadOnlyStatusParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated business, reflecting the resulting read-only status.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "403": {
            "description": "Business is read-only. This indicates the business is already in read-only mode.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiError"
                      }
                    }
                  },
                  "required": [
                    "errors"
                  ]
                },
                "examples": {
                  "already_readonly": {
                    "summary": "Business is already read-only",
                    "value": {
                      "errors": [
                        {
                          "type": "InvalidState",
                          "description": "Business is readonly",
                          "error_enum": "ReadOnlyBusiness"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Business is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/categories": {
      "get": {
        "tags": [],
        "summary": "Fetch transaction categories",
        "description": "Retrieves the list of usable transaction categories based on the business' chart of accounts. This endpoint is used by Layer's `<BankTransactions>` embedded component, and can be used to build your own transaction categorization user interface.",
        "operationId": "business.categories.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the tree of available categories for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mode",
            "in": "query",
            "description": "Controls which subset of categories is returned. `DEFAULT` uses the business's configured category list (see `category_list_type` on the accounting configuration). `ALL` returns all accounts and optional categories. `EXPENSES` returns expense categories only. `REVENUE` returns revenue categories only.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DEFAULT",
                "ALL",
                "EXPENSES",
                "REVENUE"
              ],
              "default": "DEFAULT"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CategoryList"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/categorization-rules": {
      "get": {
        "tags": [
          "Categorization Rules"
        ],
        "summary": "List categorization rules",
        "description": "Returns a list of categorization rules for the specified business. Rules can be filtered by archived status and external IDs. Results are paginated.",
        "operationId": "business.categorization-rules.list",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_archived",
            "in": "query",
            "description": "Include archived rules in the response (default: false).",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "external_ids",
            "in": "query",
            "description": "Comma-separated list of external IDs to filter by.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of results per page.",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "description": "Field to sort by (default: created_at).",
            "required": false,
            "schema": {
              "type": "string",
              "default": "created_at"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "description": "Sort order (ASC or DESC).",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ]
            }
          },
          {
            "name": "pagination_cursor",
            "in": "query",
            "description": "Pagination cursor for fetching next page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of categorization rules.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/CategorizationRule"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [
          "Categorization Rules"
        ],
        "summary": "Create categorization rule",
        "description": "Creates a new categorization rule for the business.",
        "operationId": "business.categorization-rules.create",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCategorizationRuleParams"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Categorization rule created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CategorizationRule"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation error (e.g., no filters specified, regex too short)."
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/categorization-rules/{categorizationRuleId}": {
      "get": {
        "tags": [
          "Categorization Rules"
        ],
        "summary": "Get categorization rule",
        "description": "Returns a single categorization rule by ID.",
        "operationId": "business.categorization-rules.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "categorizationRuleId",
            "in": "path",
            "description": "The UUID of the categorization rule.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Categorization rule details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CategorizationRule"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Categorization rule not found."
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [
          "Categorization Rules"
        ],
        "summary": "Update categorization rule",
        "description": "Updates an existing categorization rule. This replaces the entire rule content. The rule can optionally be applied retroactively to existing uncategorized transactions.",
        "operationId": "business.categorization-rules.update",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "categorizationRuleId",
            "in": "path",
            "description": "The UUID of the categorization rule.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCategorizationRuleParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Categorization rule updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CategorizationRule"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Categorization rule not found."
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/categorization-rules/{categorizationRuleId}/archive": {
      "post": {
        "tags": [
          "Categorization Rules"
        ],
        "summary": "Archive categorization rule",
        "description": "Archives (soft-deletes) a categorization rule. The rule will no longer be applied to new transactions. Archived rules can be included in list results using the `include_archived` query parameter.",
        "operationId": "business.categorization-rules.archive",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "categorizationRuleId",
            "in": "path",
            "description": "The UUID of the categorization rule.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Categorization rule archived successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CategorizationRule"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Categorization rule not found."
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/categorization-rules/suggestions": {
      "get": {
        "tags": [
          "Categorization Rules"
        ],
        "summary": "List suggested categorization rules",
        "description": "Returns a paginated list of suggested categorization rule updates for the business.",
        "operationId": "business.categorization-rules.suggestions.list",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "show_affected_transactions",
            "in": "query",
            "description": "Include a `transactions_that_will_be_affected` preview on each suggestion.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "statuses",
            "in": "query",
            "description": "Comma-separated list of suggestion statuses to filter by.",
            "required": false,
            "schema": {
              "type": "string",
              "example": "PENDING"
            }
          },
          {
            "name": "update_type",
            "in": "query",
            "description": "Filter by the suggestion's update type.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CREATE_RULE",
                "CREATE_RULE_FROM_SUGGESTIONS"
              ]
            }
          },
          {
            "name": "direction",
            "in": "query",
            "description": "Filter by bank transaction direction.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "MONEY_IN",
                "MONEY_OUT"
              ]
            }
          },
          {
            "name": "counterparty_id",
            "in": "query",
            "description": "Filter suggestions by counterparty UUID.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "account_identifiers",
            "in": "query",
            "description": "Comma-separated list of account identifiers to filter by.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Free-text search query across suggestion fields.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of results per page.",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "description": "Field to sort by (default: created_at).",
            "required": false,
            "schema": {
              "type": "string",
              "default": "created_at"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "description": "Sort order (ASC or DESC). Defaults to DESC.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ],
              "default": "DESC"
            }
          },
          {
            "name": "pagination_cursor",
            "in": "query",
            "description": "Pagination cursor for fetching next page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of suggested categorization rule updates.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiCreateCategorizationRuleForCounterpartySuggestion"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/categorization-rules/suggestions/{suggestionId}": {
      "get": {
        "tags": [
          "Categorization Rules"
        ],
        "summary": "Get suggested categorization rule",
        "description": "Returns a single suggested categorization rule update by its id.",
        "operationId": "business.categorization-rules.suggestions.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "suggestionId",
            "in": "path",
            "description": "The UUID of the suggestion to fetch.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Suggested categorization rule update.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCreateCategorizationRuleForCounterpartySuggestion"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Suggestion not found."
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [
          "Categorization Rules"
        ],
        "summary": "Update suggested categorization rule",
        "description": "Updates a suggested categorization rule.",
        "operationId": "business.categorization-rules.suggestions.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "suggestionId",
            "in": "path",
            "description": "The UUID of the suggestion to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSuggestedCategorizationRuleParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Suggested categorization rule updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCreateCategorizationRuleForCounterpartySuggestion"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Suggestion not found."
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [
          "Categorization Rules"
        ],
        "summary": "Reject suggested categorization rule",
        "description": "Rejects a suggested categorization rule update. This marks the suggestion as dismissed and prevents it from being shown again.",
        "operationId": "business.categorization-rules.suggestions.reject",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "suggestionId",
            "in": "path",
            "description": "The UUID of the suggestion to reject.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Suggestion rejected successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {}
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Suggestion not found."
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/notifications": {
      "get": {
        "tags": [],
        "summary": "Fetch business notifications",
        "description": "Retrieve counts of outstanding transactions, tasks, or other items that require user attention.",
        "operationId": "business.notifications.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch notifications for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Business notifications retrieved successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BusinessNotifications"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found."
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/support-emails": {
      "get": {
        "tags": [],
        "summary": "List business emails",
        "description": "Lists messages in threads linked to this business, including received emails and sent replies. A linked thread may also contain third-party notifications. Results are ordered by `received_at` descending, then message ID descending. The public API does not support searching email content. List results include attachment metadata, not download URLs.",
        "operationId": "business.support-emails.list",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business whose emails to list.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "received_at_start",
            "in": "query",
            "description": "Include messages received at or after this RFC 3339 instant. Inclusive start of the UTC time range.",
            "schema": { "type": "string", "format": "date-time" }
          },
          {
            "name": "received_at_end",
            "in": "query",
            "description": "Exclude messages received at or after this RFC 3339 instant. Exclusive end of the UTC time range. Must be later than `received_at_start` when both are given.",
            "schema": { "type": "string", "format": "date-time" }
          },
          {
            "name": "has_attachments",
            "in": "query",
            "description": "Filter to messages with at least one stored attachment (`true`) or none (`false`). Omit to include both.",
            "schema": { "type": "boolean" }
          },
          {
            "name": "direction",
            "in": "query",
            "description": "Filter to received emails or sent replies. Omit to include both.",
            "schema": { "type": "string", "enum": ["RECEIVED", "SENT"] }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum messages per page. Defaults to 100.",
            "schema": { "type": "integer", "minimum": 1, "maximum": 1000, "default": 100 }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Opaque cursor from the previous response's `meta.pagination.cursor`. Repeat the same filters on subsequent pages.",
            "schema": { "type": "string" }
          },
          {
            "name": "sort_by",
            "in": "query",
            "description": "The sort field. Only `received_at` is supported; this is the default.",
            "schema": { "type": "string", "enum": ["received_at"], "default": "received_at" }
          },
          {
            "name": "sort_order",
            "in": "query",
            "description": "Order by `received_at`, then message ID. Defaults to `DESC`.",
            "schema": { "type": "string", "enum": ["ASC", "DESC"], "default": "DESC" }
          }
        ],
        "responses": {
          "200": {
            "description": "Business emails retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": { "type": "array", "items": { "$ref": "#/components/schemas/ApiSupportEmailMessage" } },
                    "meta": { "$ref": "#/components/schemas/SupportEmailListMetadata" }
                  },
                  "required": ["data", "meta"]
                }
              }
            }
          },
          "400": { "description": "Invalid filters or pagination parameters, or an unsupported search parameter.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } },
          "404": { "description": "Business not found or inaccessible.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/support-emails/{messageId}": {
      "get": {
        "tags": [],
        "summary": "Fetch business email",
        "description": "Fetches one message from a thread linked to this business. Returns its stored HTML or plain-text body and temporary presigned S3 URLs for attachments. Treat HTML as untrusted before rendering it. Fetch the email again to refresh expired attachment URLs.",
        "operationId": "business.support-emails.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business whose email to fetch.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "messageId",
            "in": "path",
            "description": "The message UUID, for example `data.message_id` from an `email.message_received` webhook.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "responses": {
          "200": {
            "description": "Email retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "data": { "$ref": "#/components/schemas/ApiSupportEmailMessageDetail" } },
                  "required": ["data"]
                }
              }
            }
          },
          "404": { "description": "Business or message not found, or message belongs to another business.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/notifications/uncategorized-monthly": {
      "get": {
        "tags": [],
        "summary": "Fetch uncategorized transaction counts",
        "description": "Retrieve the count of categorized and uncategorized transactions for a range of months.\n\r`start_year`, `start_month`, `end_year`, and `end_month` determine the range of months to fetch.\n\rIf not specified, range will start at January of the current year and end at the current month.",
        "operationId": "business.notifications.uncategorized-monthly.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the uncategorized monthly notifications for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_month",
            "in": "query",
            "description": "The start month (1-12) of the range to fetch uncategorized counts for. If specified, `start_year` must also be specified.",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "start_year",
            "in": "query",
            "description": "The start year of the range to fetch uncategorized counts for. If specified, `start_month` must also be specified.",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "end_month",
            "in": "query",
            "description": "The end month (1-12) of the range to fetch uncategorized counts for. If specified, `end_year` must also be specified.",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "end_year",
            "in": "query",
            "description": "The end year of the range to fetch uncategorized counts for. If specified, `end_month` must also be specified.",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/MonthlyCategorizationCounts"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/sms": {
      "get": {
        "tags": [],
        "summary": "Fetch SMS configuration",
        "description": "Returns the SMS settings for the business associated with the provided business id. Currently this setting is an `enabled` flag. Note that SMS must be enabled on both a platform level (see /v1/configure/sms) and an individual business level in order to receive SMS messages.",
        "operationId": "business.sms.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the SMS settings for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BusinessSmsConfiguration"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update SMS configuration",
        "description": "Updates the SMS settings for the business associated with the provided business id. Currently this setting is an `enabled` flag.",
        "operationId": "business.sms.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update the SMS settings for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BusinessSmsConfigurationInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BusinessSmsConfiguration"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/sms/messages": {
      "get": {
        "tags": [],
        "summary": "Fetch SMS message history",
        "description": "Returns the SMS message log for the specified business. This endpoint returns the most recent messages first.",
        "operationId": "business.sms.messages.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the SMS message log for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiMessages"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "SMS is not enabled for this business. Enable SMS to enable message history.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/s3_doc/{documentId}": {
      "get": {
        "tags": [],
        "summary": "Fetch document",
        "description": "Returns a presigned URL (`S3_Presigned_Url`) for the document associated with the provided document id. This endpoint can fetch any document associated with the business, including transaction-specific receipts. The response includes `document_type` along with `fileName`, `createdAt`, and `documentId`.",
        "operationId": "business.s3_doc.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the document for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "description": "The UUID of the document to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or document id is not found. This indicates the document id is invalid or the document has been deleted, or the business is not found or has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/documents/trial-balances-import": {
      "post": {
        "tags": [],
        "summary": "Import trial balances",
        "description": "Imports trial balances for a business from a `.zip` archive of Excel (`.xlsx`) files \u2014 one sheet per effective date. The earliest trial balance is converted into opening balances for each ledger account, and each subsequent trial balance is imported as a manual journal entry capturing the net change from the prior period. A business may only have one trial balances import at a time; if one already exists, it must be archived first. This endpoint expects a multipart upload.",
        "operationId": "business.documents.trial-balances-import.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to import trial balances for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to multipart/form-data.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "A `.zip` archive containing one or more `.xlsx` trial balance exports."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Trial balances imported successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTrialBalancesImportResult"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Possible causes: missing file, file is not a `.zip`, the archive could not be parsed, trial balance debits and credits do not balance, a ledger account referenced in the trial balance could not be matched, or a trial balances import already exists for this business and must be archived first.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [],
        "summary": "Archive trial balances import",
        "description": "Archives the existing trial balances import for a business, including the opening balances and manual journal entries that were created from it. Use this before re-importing when the source data has changed.",
        "operationId": "business.documents.trial-balances-import.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business whose trial balances import should be archived.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Trial balances import archived successfully. If no trial balances import exists for the business, this endpoint is a no-op and still returns 200.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/demo": {
      "get": {
        "tags": [],
        "summary": "List demo businesses",
        "description": "Returns a list of all demo businesses that have been created for the authenticated client. Demo businesses are used for testing and demonstration purposes and are separate from regular businesses.",
        "operationId": "demo-businesses.get",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBusiness"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create demo business",
        "description": "Creates a new demo business in Layer. Demo businesses are used for testing and demonstration purposes. This endpoint is idempotent using the `external_id` field as the idempotency key, so subsequent requests with the same `external_id` will return the existing demo business if it's not archived.",
        "operationId": "demo-businesses.post",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DemoBusinessCreateParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Demo business already exists with the provided external_id.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Demo business created successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid demo business creation parameters or external_id already in use by another business.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/sales-demos": {
      "post": {
        "tags": [],
        "summary": "Create sales demo business",
        "description": "Creates a sales demo business in Layer and asynchronously seeds it with realistic demo data (customers, invoices, payouts, bank accounts, and transactions) so it is presentation-ready within seconds. A `200` or `201` means the business exists, not that seeding has finished. Re-POSTing the same `external_id` returns an existing sales demo and re-triggers seeding; an empty plain demo is promoted in place.",
        "operationId": "sales-demos.post",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SalesDemoBusinessCreateParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing sales demo, or an empty plain demo promoted in place. Seeding is re-triggered.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Sales demo business created. Seeding runs after this response.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "`enable_bookkeeping` is `true` but the client has no bookkeeping configuration, or `external_id` is already in use by a non-demo, archived demo, or plain demo with existing activity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions": {
      "get": {
        "tags": [],
        "summary": "List bank transactions",
        "description": "Returns a list of bank transactions for the specified business.",
        "operationId": "business.bank-transactions.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch bank transactions for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter transactions. Only transactions with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "The start date of the transaction range to fetch.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "The end date of the transaction range to fetch.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "direction",
            "in": "query",
            "description": "The direction of the transaction to fetch.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "INFLOW",
                "OUTFLOW"
              ]
            }
          },
          {
            "name": "categorization_status",
            "in": "query",
            "description": "The categorization status of the transaction to fetch. If you wish to see all uncategorized transactions, see `categorized=false` query parameter.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PENDING",
                "READY_FOR_INPUT",
                "CATEGORIZED",
                "SPLIT",
                "MATCHED"
              ]
            }
          },
          {
            "name": "amount_min",
            "in": "query",
            "description": "The minimum amount of the transaction to fetch.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "amount_max",
            "in": "query",
            "description": "The maximum amount of the transaction to fetch.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "description_filter",
            "in": "query",
            "description": "Case-insensitive substring to search for in transaction descriptions (contains match, not exact equality).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "description_filter_regex",
            "in": "query",
            "description": "Regex to search for in description transactions. Regex will be parsed exactly as given and an error will be returned if the regex is invalid.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_account_ids",
            "in": "query",
            "description": "Comma-separated list of Layer external account UUIDs (Layer's internal identifier for an external account, e.g. a linked Plaid account). Filters transactions to those within the provided list of accounts. Unlike source_account_ids, these are Layer-assigned IDs rather than the external provider's account IDs.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bank_account_ids",
            "in": "query",
            "description": "Comma-separated list of Layer bank account UUIDs. Filters transactions by their owning bank account. A bank account may back multiple external accounts (Plaid, Unit, Stripe Treasury, or custom), so this provides a higher-level filter than external_account_ids.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source_account_ids",
            "in": "query",
            "description": "Comma-separated list of external provider account IDs. Filters transactions by their source account ID from the external provider (e.g., Plaid account ID, Unit account ID, Stripe financial account ID, or custom account external ID).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo",
            "in": "query",
            "description": "Filter transactions by exact memo match.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo_contains",
            "in": "query",
            "description": "Filter transactions where memo contains this substring.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "UUID of the customer to filter transactions by.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customer_external_id",
            "in": "query",
            "description": "External ID of the customer to filter transactions by.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "vendor_id",
            "in": "query",
            "description": "UUID of the vendor to filter transactions by.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendor_external_id",
            "in": "query",
            "description": "External ID of the vendor to filter transactions by.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_matched",
            "in": "query",
            "description": "Filter transactions by whether they are matched (true) or not matched (false).",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Filter transactions by category identifier or stable name.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categorized",
            "in": "query",
            "description": "Filter transactions by whether they are categorized (single categorization, split transactions, or matched transactions) or not categorized (pending, under review, ready for input).",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "merchant_name_filter",
            "in": "query",
            "description": "Substring to search for in merchant name. Only exact matches will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "merchant_name_filter_regex",
            "in": "query",
            "description": "Regex to search for in merchant name. Regex will be parsed exactly as given and an error will be returned if the regex is invalid.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "description": "Sort key used for pagination ordering. `name` corresponds to transaction description text (for Plaid, this is the Plaid transaction `name` field). Defaults to `date`.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "date",
                "amount",
                "counterparty_name",
                "name"
              ],
              "default": "date"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "description": "Sort direction for `sort_by`. Use `ASC` or `DESC`. Defaults to `ASC`.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ],
              "default": "ASC"
            }
          },
          {
            "name": "external_ids",
            "in": "query",
            "description": "Comma-separated list of external transaction IDs (the upstream provider's identifier). Only transactions whose external ID matches one of the supplied values will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "counterparty_id",
            "in": "query",
            "description": "UUID of a bank transaction counterparty. Only transactions associated with this counterparty will be returned.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "has_counterparty",
            "in": "query",
            "description": "If true, only transactions that have a counterparty assigned are returned. If false, only transactions without a counterparty are returned.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "General-purpose search query. The value is matched against transaction descriptions, and is also parsed for an optional signed amount (e.g. `+1234` to find inflows of $12.34, `-1234` to find outflows) and category names from the chart of accounts.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_key",
            "in": "query",
            "description": "Tag key to filter transactions by. Must be supplied together with `tag_values`. Only transactions tagged with the given key/value pair will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_values",
            "in": "query",
            "description": "Tag values to filter transactions by, paired with `tag_key`. Provide one or more values by repeating the query parameter (e.g. `tag_values=foo&tag_values=bar`). Required when `tag_key` is supplied.",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": true
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBankTransaction"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or pagination parameters (for example unsupported `sort_by` or malformed filters).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/accounting-config": {
      "get": {
        "tags": [],
        "summary": "Fetch accounting configuration",
        "description": "Returns the accounting configuration associated for the provided business.  This is the means by which you can see things such as the default reporting basis for a business or when the books are closed as of.",
        "operationId": "business.accounting-config.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the accounting configuration for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAccountingConfiguration"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [],
        "summary": "Patch accounting configuration",
        "description": "Updates the accounting configuration associated for the provided business. This is the means by which you can update things such as the default reporting basis for a business or mark the books as closed.",
        "operationId": "business.accounting-config.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the accounting configuration for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingConfigurationUpdateParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAccountingConfiguration"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/{bankTransactionId}": {
      "get": {
        "tags": [],
        "summary": "Fetch bank transaction",
        "description": "Returns the bank transaction associated with the provided bank transaction id.",
        "operationId": "business.bank-transactions.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the bank transaction for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bankTransactionId",
            "in": "path",
            "description": "The UUID of the bank transaction to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBankTransaction"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or bank transaction id is not found. This indicates the bank transaction id is invalid or the bank transaction has been deleted, or the business is not found or has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/accounts": {
      "get": {
        "tags": [],
        "summary": "List ledger accounts",
        "description": "Returns all ledger accounts for the business with their current balances in a nested tree structure.",
        "operationId": "business.ledger.accounts.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of ledger accounts with balances.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLedgerBalances"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create ledger account",
        "description": "Creates a new ledger account. The stable_name field can be used for idempotency - if an account with the same stable_name already exists, it will be returned instead of creating a duplicate.",
        "operationId": "business.ledger.accounts.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiLedgerAccount"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created ledger account.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SingleApiChartAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/accounts/{accountId}": {
      "get": {
        "tags": [],
        "summary": "Get ledger account",
        "description": "Returns a single ledger account by ID or stable_name.",
        "operationId": "business.ledger.accounts.accountId.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountId",
            "in": "path",
            "description": "The ID or stable_name of the ledger account.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The ledger account.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SingleApiChartAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or account not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update ledger account",
        "description": "Fully updates a ledger account. All fields must be provided.",
        "operationId": "business.ledger.accounts.accountId.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountId",
            "in": "path",
            "description": "The ID or stable_name of the ledger account to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateApiLedgerAccount"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated ledger account.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SingleApiChartAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or account not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [],
        "summary": "Patch update ledger account",
        "description": "Partially updates a ledger account based on the provided fields.",
        "operationId": "business.ledger.accounts.patch",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to confirm the matches for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountId",
            "in": "path",
            "description": "The id of the ledger account to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchApiLedgerAccount"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated ledger account.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SingleApiChartAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [],
        "summary": "Delete ledger account",
        "description": "Deletes a ledger account. The account must not have any transactions or child accounts.",
        "operationId": "business.ledger.accounts.accountId.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountId",
            "in": "path",
            "description": "The ID or stable_name of the ledger account to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Account successfully deleted."
          },
          "400": {
            "description": "Account cannot be deleted (has transactions or child accounts).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or account not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/accounts/{accountId}/create-child-account": {
      "post": {
        "tags": [],
        "summary": "Create child ledger account",
        "description": "Creates a child account under the specified parent account. The child inherits account_type, account_subtype, and normality from the parent.",
        "operationId": "business.ledger.accounts.accountId.create-child-account.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountId",
            "in": "path",
            "description": "The ID or stable_name of the parent ledger account.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateApiChildLedgerAccount"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The created child ledger account.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SingleApiChartAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or parent account not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/accounts/{accountId}/lines": {
      "get": {
        "tags": [],
        "summary": "Get account line items",
        "description": "Returns all line items for a specific ledger account with running balances.",
        "operationId": "business.ledger.accounts.accountId.lines.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountId",
            "in": "path",
            "description": "The ID or stable_name of the ledger account.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of line items with running balances.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiLedgerAccountLineItem"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or account not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/accounts/{accountId}/exports/excel": {
      "get": {
        "tags": [],
        "summary": "Export account transactions as Excel",
        "description": "Exports the transaction history for a specific ledger account as an Excel file. Returns a pre-signed URL for downloading the generated Excel file. The export includes transaction date, entry number, description, debit/credit amounts, running balance, and related accounts.",
        "operationId": "business.ledger.accounts.accountId.exports.excel.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "accountId",
            "in": "path",
            "description": "The ID or stable_name of the ledger account.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for filtering transactions (inclusive). ISO-8601 format.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for filtering transactions (exclusive). ISO-8601 format.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Reporting basis for the export (ACCRUAL or CASH). Defaults to the business's default reporting basis.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "tag_key",
            "in": "query",
            "description": "Tag key to filter transactions by. Must be used together with tag_values.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_values",
            "in": "query",
            "description": "Comma-separated list of tag values to filter by. Must be used together with tag_key.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_child_account_lines",
            "in": "query",
            "description": "If true, includes transactions from child accounts in the export. Each child account will have its own section. Defaults to false.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "include_entries_before_activation",
            "in": "query",
            "description": "If true, includes ledger entries from before the business activation date. Defaults to false.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the Excel export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or account not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/chart": {
      "get": {
        "tags": [],
        "summary": "Get chart of accounts",
        "description": "Returns the complete chart of accounts for the business as a nested tree structure.",
        "operationId": "business.ledger.chart.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The chart of accounts.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiChartOfAccounts"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/balances": {
      "get": {
        "tags": [],
        "summary": "Get ledger balances",
        "description": "Returns the ledger account balances for the business. Supports filtering by date range, reporting basis, customer, vendor, and tags.",
        "operationId": "business.ledger.balances.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for balance calculation (inclusive).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for balance calculation (exclusive).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Reporting basis for the balances (ACCRUAL or CASH).",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ],
              "default": "ACCRUAL"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "Filter balances by customer UUID.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customer_external_id",
            "in": "query",
            "description": "Filter balances by customer external ID.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "vendor_id",
            "in": "query",
            "description": "Filter balances by vendor UUID.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendor_external_id",
            "in": "query",
            "description": "Filter balances by vendor external ID.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_entries_before_activation",
            "in": "query",
            "description": "Include entries before business activation date.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ledger balances.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLedgerBalances"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/balances/exports/csv": {
      "get": {
        "tags": [],
        "summary": "Export ledger balances to CSV",
        "description": "Exports ledger account balances to a CSV file. Returns a presigned URL to download the file.",
        "operationId": "business.ledger.balances.exports.csv.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for balance calculation (inclusive).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for balance calculation (exclusive).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Presigned URL to download the CSV file.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/entries": {
      "get": {
        "tags": [],
        "summary": "List ledger entries",
        "description": "Returns ledger entries (journal entries) for the business. Supports filtering by date range, reporting basis, customer, vendor, and tags. Results are paginated.",
        "operationId": "business.ledger.entries.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for entries (inclusive).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for entries (exclusive).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Reporting basis for the entries (ACCRUAL or CASH).",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ],
              "default": "ACCRUAL"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "Filter entries by customer UUID.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customer_external_id",
            "in": "query",
            "description": "Filter entries by customer external ID.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "vendor_id",
            "in": "query",
            "description": "Filter entries by vendor UUID.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendor_external_id",
            "in": "query",
            "description": "Filter entries by vendor external ID.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_entries_before_activation",
            "in": "query",
            "description": "Include entries before business activation date.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of ledger entries.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiLedgerEntryWithTransaction"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/entries/{entryId}": {
      "get": {
        "tags": [],
        "summary": "Get ledger entry",
        "description": "Returns a single ledger entry by its ID.",
        "operationId": "business.ledger.entries.entry.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "description": "The ID of the ledger entry.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ledger entry details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLedgerEntryWithTransaction"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or entry not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/entries/{entryId}/reverse": {
      "post": {
        "tags": [],
        "summary": "Reverse ledger entry",
        "description": "Creates a reversal entry for the specified ledger entry.",
        "operationId": "business.ledger.entries.entry.reverse.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "entryId",
            "in": "path",
            "description": "The ID of the ledger entry to reverse.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Reversal entry created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLedgerEntryWithTransaction"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Entry cannot be reversed (already reversed or invalid).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or entry not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/entries/exports/csv": {
      "get": {
        "tags": [],
        "summary": "Export ledger entries to CSV",
        "description": "Exports ledger entries to a CSV file. Returns a presigned URL to download the file.",
        "operationId": "business.ledger.entries.exports.csv.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for entries (inclusive).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for entries (exclusive).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Presigned URL to download the CSV file.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/internal-bank-transactions": {
      "post": {
        "tags": [],
        "summary": "Import bank transactions",
        "description": "This endpoint allows transactions to be imported for any number of businesses simultaneously. Transactions will be matched to businesses using the transactions' `bank_account_id`.",
        "operationId": "internal-bank-transactions.post",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FlatBankTransactionInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/FlatBankTransactionResult"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Bank account id of a specific transaction is not attached to any active business. This failure will prevent any transactions in this request from being uploaded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/bulk-match": {
      "post": {
        "tags": [],
        "summary": "Bulk match",
        "description": "Confirm matches for multiple bank transactions.",
        "operationId": "business.bank-transactions.bulk-match.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to confirm the matches for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SuggestedMatchesWithTransactions"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Matched transactions.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBankTransaction"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters, invalid suggested match IDs.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or transaction not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/bulk-match-or-categorize": {
      "post": {
        "tags": [],
        "summary": "Bulk match or categorize",
        "description": "Match and/or categorize multiple bank transactions in a single request.",
        "operationId": "business.bank-transactions.bulk-match-or-categorize.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkMatchOrCategorizeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Matched and categorized transactions.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBankTransactionWithRuleSuggestion"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters, invalid suggested match IDs, or invalid categorization payloads.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or transaction not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/bulk-categorize": {
      "post": {
        "tags": [],
        "summary": "Bulk categorize transactions",
        "description": "Categorize multiple bank transactions in a single request. Each transaction in the request must include a transaction_id and a categorization object specifying how to categorize it.",
        "operationId": "business.bank-transactions.bulk-categorize.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkCategorizationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bulk categorization results.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBankTransaction"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or transaction not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/bulk-uncategorize": {
      "post": {
        "tags": [],
        "summary": "Bulk uncategorize transactions",
        "description": "Remove categorization from multiple bank transactions in a single request.",
        "operationId": "business.bank-transactions.bulk-uncategorize.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkUncategorizeRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Transactions uncategorized successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBankTransaction"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or transaction not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/{transactionId}/documents": {
      "get": {
        "tags": [],
        "summary": "List transaction documents",
        "description": "Returns the documents associated with the provided bank transaction id. Bank transaction documents are most commonly receipts, but any document may be uploaded, such as an invoice. Images (`jpg` & `png`) and PDFs are supported. Each document will be served as a presigned URL, which is a secure, temporarily available link to the document.",
        "operationId": "business.bank-transactions.documents.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the documents for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the bank transaction to fetch documents for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/DocumentS3Urls"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or transaction id is not found. This indicates the transaction id is invalid or the transaction has been deleted, or the business is not found or has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Upload transaction document",
        "description": "Upload a document for a transaction, such as a receipt or invoice. Images (`jpg` & `png`) and PDFs are supported. The document will be associated with the provided transaction id. This functionality is built into Layer's `<BankTransactions>` embedded component, but can be used directly if needed. This endpoint expects a multipart upload.",
        "operationId": "business.documents.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to upload the document for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the transaction to associate this document with.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to multipart/form-data.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "documentType",
                  "file"
                ],
                "properties": {
                  "documentType": {
                    "$ref": "#/components/schemas/DocumentType",
                    "description": "The type of document being uploaded."
                  },
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The document file. For RECEIPT documents, only images (jpg, png) and PDFs are supported."
                  },
                  "description": {
                    "type": "string",
                    "description": "Optional description for the document."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Document uploaded successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiFileMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Possible causes: missing or invalid `documentType`, no file uploaded, file too large, duplicate file names, unrecognized form fields, or invalid file type for the given document type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/{transactionId}/documents/{documentId}": {
      "get": {
        "tags": [],
        "summary": "Fetch transaction document",
        "description": "Returns the document associated with the provided document id. This endpoint can fetch any document associated with the business, including transaction-specific receipts.",
        "operationId": "business.s3_doc.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business that the transaction to fetch the document for belongs to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "description": "The UUID of the document to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business, transaction, or document id is not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/{transactionId}/documents/{documentId}/archive": {
      "post": {
        "tags": [],
        "summary": "Archive document",
        "description": "Archiving a document makes the document inactive. The document will no longer be accessible via normal API endpoints, but the document is retained and can be unarchived in the future.",
        "operationId": "business.documents.archive.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to archive the document for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the transaction to associate this document with.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "description": "The UUID of the document to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business, transaction, or document id is not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/{transactionId}/metadata": {
      "get": {
        "tags": [],
        "summary": "Fetch transaction metadata",
        "description": "Returns the metadata associated with the provided bank transaction id. Bank transaction metadata includes an optional memo, customer, and vendor.",
        "operationId": "business.bank-transactions.metadata.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business that the transaction to fetch the metadata for belongs to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the bank transaction to fetch metadata for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTransactionMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or transaction id is not found. This indicates the transaction id is invalid or the transaction has been deleted, or the business is not found or has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update transaction metadata",
        "description": "Replaces the metadata associated with the provided bank transaction id. Include customer_id and vendor_id to set or keep those associations. Omit either field, or send null, to clear it.",
        "operationId": "business.bank-transactions.metadata.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business that the transaction to update the metadata for belongs to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the bank transaction to update metadata for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiTransactionMetadata"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTransactionMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or transaction id is not found. This indicates the transaction id is invalid or the transaction has been deleted, or the business is not found or has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [],
        "summary": "Patch transaction metadata",
        "description": "Updates the metadata for the provided bank transaction. Include only the fields you want to change. Omitted fields stay unchanged. Send null for a field to clear it.",
        "operationId": "business.bank-transactions.metadata.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business that the transaction to update the metadata for belongs to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the bank transaction to update metadata for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchTransactionMetadataParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTransactionMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "customer_id and customer_external_id refer to different customers, or vendor_id and vendor_external_id refer to different vendors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "The business, transaction, customer, or vendor is not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/{transactionId}/uncategorize": {
      "put": {
        "tags": [],
        "summary": "Uncategorize bank transaction",
        "description": "Uncategorize a bank transaction. This will remove any categorization or match that has been applied to the transaction and reverse any ledger entries from the previous classification.",
        "operationId": "business.bank-transactions.uncategorize.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business that the transaction to uncategorize belongs to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the bank transaction to uncategorize.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBankTransaction"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or transaction id is not found. This indicates the transaction id is invalid or the transaction has been deleted, or the business is not found or has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/{transactionId}/categorize": {
      "put": {
        "tags": [],
        "summary": "Categorize bank transaction",
        "description": "Categorize a bank transaction to an account defined in the chart of accounts.",
        "operationId": "business.bank-transactions.categorize.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business that the transaction to categorize belongs to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the bank transaction to categorize.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Provide either a `Category` payload (single categorization) or a `Split` payload (array of `entries` with category + amount).",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BankTransactionCategorization"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBankTransactionWithRuleSuggestion"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid categorization. For split transactions, entries must sum to the transaction amount.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or transaction id is not found. This indicates the transaction id is invalid or the transaction has been deleted, or the business is not found or has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/{transactionId}/match": {
      "put": {
        "tags": [],
        "summary": "Match bank transaction",
        "description": "Match a bank transaction to a financial event such as an invoice payment or a payout.",
        "operationId": "business.bank-transactions.match.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "ID of the business the bank transaction is associated with.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the bank transaction to match.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmMatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiMatch"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Id of the business, or one of the specified bank transaction or match ids, is not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Match failure, typically either the transaction or the prospective match have been updated and are no longer compatible matches.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-transactions/{transactionId}/ledger-entries": {
      "get": {
        "tags": [],
        "summary": "Fetch transaction ledger entries",
        "description": "Returns the ledger entries associated with the provided bank transaction id. Ledger entries are the double-entry accounting entries representing this transaction. Ledger entries cannot be directly set, but are created automatically when a transaction is categorized or matched. Uncategorized transactions have no ledger entries.",
        "operationId": "business.bank-transactions.ledger-entries.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business that the transaction to fetch the ledger entries for belongs to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the bank transaction to fetch ledger entries for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiLedgerEntry"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or transaction id is not found. This indicates the transaction id is invalid or the transaction has been deleted, or the business is not found or has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/tags/values": {
      "get": {
        "tags": [],
        "summary": "List tag values",
        "description": "Returns a list of tag values for the business. These are the predefined values that can be used when creating tags.",
        "operationId": "business.tags.values.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch tag values for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "description": "Whether to include deleted tag value definitions.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tag value definitions retrieved successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiTagValueDefinition"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tags/dimensions": {
      "get": {
        "tags": [],
        "summary": "List tag dimensions",
        "description": "Returns a list of tag dimensions for the business. Tag dimensions define the structure and constraints for tags.",
        "operationId": "business.tags.dimensions.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch tag dimensions for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "description": "Whether to include deleted tag dimensions.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tag dimensions retrieved successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTagDimensions"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create tag dimension",
        "description": "Creates a new tag dimension for the business. Tag dimensions define the structure and constraints for tags.",
        "operationId": "business.tags.dimensions.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create tag dimension for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TagDimensionCreateParams"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Tag dimension created successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTagDimension"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tags/dimensions/key/{dimensionKey}": {
      "get": {
        "tags": [],
        "summary": "Get tag dimension by key",
        "description": "Returns a tag dimension by its key string. This is an alternative to fetching by UUID.",
        "operationId": "business.tags.dimensions.key.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dimensionKey",
            "in": "path",
            "description": "The key string of the tag dimension to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tag dimension retrieved successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTagDimension"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or tag dimension not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [],
        "summary": "Update tag dimension by key",
        "description": "Updates a specific tag dimension by its key string. All fields are optional.",
        "operationId": "business.tags.dimensions.key.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dimensionKey",
            "in": "path",
            "description": "The key string of the tag dimension to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TagDimensionPatchParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tag dimension updated successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTagDimension"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or tag dimension not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tags/dimensions/{dimensionId}": {
      "get": {
        "tags": [],
        "summary": "Get tag dimension",
        "description": "Returns a tag dimension by ID.",
        "operationId": "business.tags.dimensions.dimension.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dimensionId",
            "in": "path",
            "description": "The UUID of the tag dimension to fetch.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tag dimension retrieved successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTagDimension"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or tag dimension not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [],
        "summary": "Update tag dimension",
        "description": "Updates a specific tag dimension. All fields are optional.",
        "operationId": "business.tags.dimensions.dimension.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dimensionId",
            "in": "path",
            "description": "The UUID of the tag dimension to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TagDimensionPatchParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tag dimension updated successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTagDimension"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or tag dimension not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tags/dimensions/{dimensionId}/values": {
      "get": {
        "tags": [],
        "summary": "List tag values for dimension",
        "description": "Returns a list of tag values for a specific dimension.",
        "operationId": "business.tags.dimensions.dimension.values.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dimensionId",
            "in": "path",
            "description": "The UUID of the tag dimension to list values for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "description": "Whether to include deleted tag value definitions.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tag values retrieved successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiTagValueDefinition"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or tag dimension not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create tag value",
        "description": "Creates a new tag value definition for a specific tag dimension.",
        "operationId": "business.tags.dimensions.dimension.values.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dimensionId",
            "in": "path",
            "description": "The UUID of the tag dimension to create value for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiTagValueDefinitionCreateParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tag value definition already exists.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTagValueDefinition"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Tag value definition created successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTagValueDefinition"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or tag dimension not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tags/dimensions/{dimensionId}/values/{valueId}": {
      "patch": {
        "tags": [],
        "summary": "Update tag value",
        "description": "Updates an existing tag value definition, including archiving/unarchiving functionality.",
        "operationId": "business.tags.dimensions.dimension.values.value.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "dimensionId",
            "in": "path",
            "description": "The UUID of the tag dimension.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "valueId",
            "in": "path",
            "description": "The UUID of the tag value definition to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiTagValueDefinitionUpdateParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tag value definition updated successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTagValueDefinition"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters or validation error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business, tag dimension, or tag value definition not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/data-sync-validation": {
      "get": {
        "tags": [],
        "summary": "Fetch data sync validation totals",
        "description": "Returns accounting totals that you can compare with the source system after syncing or backfilling sales data. Invoice-derived totals use the accrual basis, while payment processor fees use the cash basis. All monetary values are in cents. See the [sales data backfill validation guide](/guides/validating-sales-data-backfills) for the comparison workflow.",
        "operationId": "business.reports.data-sync-validation.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business whose synced data you want to validate.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "The start of the synced period as an ISO 8601 timestamp.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "The end of the synced period as an ISO 8601 timestamp. Must be later than `start_date`.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Data sync validation totals generated successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiDataSyncValidationReport"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "A required date is missing or invalid, or `start_date` is not earlier than `end_date`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "The business was not found or is not accessible to the authenticated client.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss-summaries": {
      "get": {
        "tags": [],
        "summary": "Fetch P&L summaries",
        "description": "Returns profit and loss summaries over a specified time range. This endpoint is useful for displaying charts and comparisons, as the summaries are less detailed than the full P&L report but a range of months can be queried at the same time.",
        "operationId": "business.reports.profit-and-loss-summaries.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the profit and loss for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_year",
            "in": "query",
            "description": "The starting year for the summaries range (e.g. 2024).",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "start_month",
            "in": "query",
            "description": "The starting month for the summaries range (1\u201312).",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          },
          {
            "name": "end_year",
            "in": "query",
            "description": "The ending year for the summaries range (e.g. 2024).",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "end_month",
            "in": "query",
            "description": "The ending month for the summaries range (1\u201312).",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "structure",
            "in": "query",
            "description": "P&L structure template to use.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_key",
            "in": "query",
            "description": "Tag key to filter results by (use together with tag_values).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_values",
            "in": "query",
            "description": "Comma-separated tag values to filter results by (use together with tag_key).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiMonthlyPnlSummaries"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "P&L not yet reconciled: one or more of the requested time periods is not closed or reconciled and cannot be displayed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss-summary": {
      "get": {
        "tags": [],
        "summary": "Fetch P&L summary",
        "description": "Returns a profit and loss summary for a single arbitrary date range. Unlike the monthly summaries endpoint which returns per-month breakdowns, this endpoint aggregates the entire specified period into one summary. Both date bounds are optional: omitting start_date uses the business activation date, and omitting end_date uses the current time. Omitting both returns an all-time summary. This endpoint is useful for dashboard cards showing aggregate financial metrics like total revenue, expenses, net profit, and uncategorized transaction counts.",
        "operationId": "business.reports.profit-and-loss-summary.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the profit and loss summary for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "The start of the period (ISO 8601 instant, e.g. 2024-01-01T00:00:00Z). If omitted, defaults to the business activation date.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "The end of the period (ISO 8601 instant, e.g. 2024-12-31T23:59:59Z). If omitted, defaults to the current time.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report. Defaults to the business default or ACCRUAL if not set.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "structure",
            "in": "query",
            "description": "P&L structure template to use.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_key",
            "in": "query",
            "description": "Tag key to filter results by (use together with tag_values).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_values",
            "in": "query",
            "description": "Comma-separated tag values to filter results by (use together with tag_key).",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PnlSummary"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss-comparison": {
      "post": {
        "tags": [],
        "summary": "Create P&L comparisons",
        "description": "Compare Profit & Loss views across time periods and/or tags. This endpoint allows specifying multiple time periods (specified in months, years, or custom date ranges) and tags and will generate a comparison for every combination. Note that this endpoint is retrieval only, but uses a `POST` HTTP verb rather than `GET` because of the complexity of the parameters.",
        "operationId": "business.reports.comparison-profit-and-loss-summaries.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the profit and loss for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProfitAndLossComparisonRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ProfitAndLossComparisonResult"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "P&L not yet reconciled: one or more of the requested time periods is not closed or reconciled and cannot be displayed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss-details": {
      "get": {
        "tags": [],
        "summary": "Get P&L details",
        "description": "Retrieves detailed profit and loss information for a business, including line item breakdowns.",
        "operationId": "business.reports.profit-and-loss-details.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to retrieve P&L details for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for the P&L report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for the P&L report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "P&L details retrieved successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "P&L not yet reconciled: one or more of the requested time periods is not closed or reconciled and cannot be displayed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss": {
      "get": {
        "tags": [],
        "summary": "Fetch P&L report",
        "description": "Returns a detailed profit and loss report for a specified time period. This endpoint provides comprehensive financial data including revenue, expenses, and net income calculations.",
        "operationId": "business.reports.profit-and-loss.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the profit and loss for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for the P&L report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for the P&L report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "structure",
            "in": "query",
            "description": "P&L structure template to use.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_filter",
            "in": "query",
            "description": "Filter results by tags.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "exclude_uncategorized_transactions_with_suggested_transfer_matches",
            "in": "query",
            "description": "When true (default), uncategorized transactions that have a suggested transfer match are excluded from the uncategorized inflows and outflows totals. Set to false to include those transactions in the uncategorized totals.",
            "schema": {
              "type": "boolean",
              "default": true
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Profit and loss report data.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiProfitAndLoss"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "P&L not yet reconciled: one or more of the requested time periods is not closed or reconciled and cannot be displayed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/balance-sheet": {
      "get": {
        "tags": [],
        "summary": "Fetch balance sheet",
        "description": "Returns a balance sheet report showing assets, liabilities, and equity at a specific point in time.",
        "operationId": "business.reports.balance-sheet.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the balance sheet for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "effective_date",
            "in": "query",
            "description": "Effective date for the balance sheet (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "tag_filter",
            "in": "query",
            "description": "Filter results by tags.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Balance sheet report data.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBalanceSheet"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Balance sheet not yet reconciled for the requested date.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/cashflow-statement": {
      "get": {
        "tags": [],
        "summary": "Fetch cashflow statement",
        "description": "Returns a cashflow statement showing cash inflows and outflows over a specified time period.",
        "operationId": "business.reports.cashflow-statement.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the cashflow statement for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for the cashflow statement (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for the cashflow statement (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "structure",
            "in": "query",
            "description": "P&L structure template to use.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Cashflow statement report data.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCashflowStatement"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Cashflow statement not yet reconciled for the requested period.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss/exports/csv": {
      "get": {
        "tags": [],
        "summary": "Export P&L as CSV",
        "description": "Exports a profit and loss report as a CSV file. Returns a pre-signed URL for downloading the generated CSV file.",
        "operationId": "business.reports.profit-and-loss.exports.csv.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the P&L for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for the P&L report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for the P&L report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "money_format",
            "in": "query",
            "description": "Format for monetary values in the export.",
            "schema": {
              "type": "string",
              "enum": [
                "DOLLAR_STRING",
                "CENTS_INTEGER"
              ]
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "structure",
            "in": "query",
            "description": "P&L structure template to use.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the CSV export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "P&L not yet reconciled: one or more of the requested time periods is not closed or reconciled and cannot be displayed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Export P&L as CSV (POST)",
        "description": "Exports a profit and loss report as a CSV file using POST request with parameters in the request body. Returns a pre-signed URL for downloading the generated CSV file.",
        "operationId": "business.reports.profit-and-loss.exports.csv.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the P&L for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "startDate",
                  "endDate"
                ],
                "properties": {
                  "startDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Start date for the P&L report (ISO 8601 format)."
                  },
                  "endDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "End date for the P&L report (ISO 8601 format)."
                  },
                  "moneyFormat": {
                    "type": "string",
                    "enum": [
                      "DOLLAR_STRING",
                      "CENTS_INTEGER"
                    ],
                    "description": "Format for monetary values in the export."
                  },
                  "reportingBasis": {
                    "type": "string",
                    "enum": [
                      "ACCRUAL",
                      "CASH"
                    ],
                    "description": "Accounting basis for the report."
                  },
                  "structure": {
                    "type": "string",
                    "description": "P&L structure template to use."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the CSV export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "P&L not yet reconciled: one or more of the requested time periods is not closed or reconciled and cannot be displayed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss/exports/excel": {
      "get": {
        "tags": [],
        "summary": "Export P&L as Excel",
        "description": "Exports a profit and loss report as an Excel file. Returns a pre-signed URL for downloading the generated Excel file.",
        "operationId": "business.reports.profit-and-loss.exports.excel.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the P&L for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for the P&L report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for the P&L report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "structure",
            "in": "query",
            "description": "P&L structure template to use.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the Excel export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "P&L not yet reconciled: one or more of the requested time periods is not closed or reconciled and cannot be displayed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss/exports/comparison-csv": {
      "post": {
        "tags": [],
        "summary": "Export P&L comparison as CSV",
        "description": "Exports a profit and loss comparison report as a CSV file. Returns a pre-signed URL for downloading the generated CSV file.",
        "operationId": "business.reports.profit-and-loss.exports.comparison-csv.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the P&L comparison for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "money_format",
            "in": "query",
            "description": "Format for monetary values in the export.",
            "schema": {
              "type": "string",
              "enum": [
                "DOLLAR_STRING",
                "CENTS_INTEGER"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProfitAndLossComparisonRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the CSV export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "P&L not yet reconciled: one or more of the requested time periods is not closed or reconciled and cannot be displayed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss/exports/month-over-month": {
      "get": {
        "tags": [],
        "summary": "Export month-over-month P&L",
        "description": "Exports a month-over-month profit and loss comparison as an Excel file. Returns a pre-signed URL for downloading the generated Excel file.",
        "operationId": "business.reports.profit-and-loss.exports.month-over-month.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the month-over-month P&L for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "end_year",
            "in": "query",
            "description": "End year for the comparison.",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "end_month",
            "in": "query",
            "description": "End month for the comparison (1-12).",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 12
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the Excel export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid date parameters or P&L not yet reconciled for the requested periods.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss/lines": {
      "get": {
        "tags": [],
        "summary": "Fetch P&L line items",
        "description": "Returns detailed line item information for a specific P&L account or category over a specified time period.",
        "operationId": "business.reports.profit-and-loss.lines.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the P&L line items for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for the line item report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for the line item report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "line_item_name",
            "in": "query",
            "description": "Name of the specific line item to fetch details for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "structure",
            "in": "query",
            "description": "P&L structure template to use.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "P&L line item detail report.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiPnlLineItemDetailReport"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or P&L not yet reconciled for the requested period.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/profit-and-loss/lines/exports/excel": {
      "get": {
        "tags": [],
        "summary": "Export P&L line items as Excel",
        "description": "Exports detailed P&L line item information as an Excel file. Returns a pre-signed URL for downloading the generated Excel file.",
        "operationId": "business.reports.profit-and-loss.lines.exports.excel.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the P&L line items for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for the line item report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for the line item report (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "line_item_name",
            "in": "query",
            "description": "Name of the specific line item to export details for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "structure",
            "in": "query",
            "description": "P&L structure template to use.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the Excel export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters or P&L not yet reconciled for the requested period.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/balance-sheet/exports/csv": {
      "get": {
        "tags": [],
        "summary": "Export balance sheet as CSV",
        "description": "Exports a balance sheet report as a CSV file. Returns a pre-signed URL for downloading the generated CSV file.",
        "operationId": "business.reports.balance-sheet.exports.csv.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the balance sheet for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "effective_date",
            "in": "query",
            "description": "Effective date for the balance sheet (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "money_format",
            "in": "query",
            "description": "Format for monetary values in the export.",
            "schema": {
              "type": "string",
              "enum": [
                "DOLLAR_STRING",
                "CENTS_INTEGER"
              ]
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "tag_filter",
            "in": "query",
            "description": "Filter results by tags.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the CSV export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Balance sheet not yet reconciled for the requested date.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Export balance sheet as CSV (POST)",
        "description": "Exports a balance sheet report as a CSV file using POST request with parameters in the request body. Returns a pre-signed URL for downloading the generated CSV file.",
        "operationId": "business.reports.balance-sheet.exports.csv.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the balance sheet for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "effectiveDate"
                ],
                "properties": {
                  "effectiveDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Effective date for the balance sheet (ISO 8601 format)."
                  },
                  "moneyFormat": {
                    "type": "string",
                    "enum": [
                      "DOLLAR_STRING",
                      "CENTS_INTEGER"
                    ],
                    "description": "Format for monetary values in the export."
                  },
                  "reportingBasis": {
                    "type": "string",
                    "enum": [
                      "ACCRUAL",
                      "CASH"
                    ],
                    "description": "Accounting basis for the report."
                  },
                  "tagFilter": {
                    "type": "string",
                    "description": "Filter results by tags."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the CSV export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Balance sheet not yet reconciled for the requested date.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/balance-sheet/exports/excel": {
      "get": {
        "tags": [],
        "summary": "Export balance sheet as Excel",
        "description": "Exports a balance sheet report as an Excel file. Returns a pre-signed URL for downloading the generated Excel file.",
        "operationId": "business.reports.balance-sheet.exports.excel.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the balance sheet for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "effective_date",
            "in": "query",
            "description": "Effective date for the balance sheet (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "tag_filter",
            "in": "query",
            "description": "Filter results by tags.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the Excel export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Balance sheet not yet reconciled for the requested date.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/cashflow-statement/exports/csv": {
      "get": {
        "tags": [],
        "summary": "Export cashflow statement as CSV",
        "description": "Exports a cashflow statement as a CSV file. Returns a pre-signed URL for downloading the generated CSV file.",
        "operationId": "business.reports.cashflow-statement.exports.csv.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the cashflow statement for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for the cashflow statement (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for the cashflow statement (ISO 8601 format).",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "money_format",
            "in": "query",
            "description": "Format for monetary values in the export.",
            "schema": {
              "type": "string",
              "enum": [
                "DOLLAR_STRING",
                "CENTS_INTEGER"
              ]
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Accounting basis for the report.",
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the CSV export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Cashflow statement not yet reconciled for the requested period.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Export cashflow statement as CSV (POST)",
        "description": "Exports a cashflow statement as a CSV file using POST request with parameters in the request body. Returns a pre-signed URL for downloading the generated CSV file.",
        "operationId": "business.reports.cashflow-statement.exports.csv.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the cashflow statement for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "startDate",
                  "endDate"
                ],
                "properties": {
                  "startDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Start date for the cashflow statement (ISO 8601 format)."
                  },
                  "endDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "End date for the cashflow statement (ISO 8601 format)."
                  },
                  "moneyFormat": {
                    "type": "string",
                    "enum": [
                      "DOLLAR_STRING",
                      "CENTS_INTEGER"
                    ],
                    "description": "Format for monetary values in the export."
                  },
                  "reportingBasis": {
                    "type": "string",
                    "enum": [
                      "ACCRUAL",
                      "CASH"
                    ],
                    "description": "Accounting basis for the report."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the CSV export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Cashflow statement not yet reconciled for the requested period.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/unified/ap-aging": {
      "get": {
        "tags": [],
        "summary": "Fetch AP aging report",
        "description": "Returns an accounts payable aging report showing outstanding bills grouped by vendor and aging buckets.",
        "operationId": "business.reports.unified.ap-aging.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the AP aging report for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_filter",
            "in": "query",
            "description": "Filter results by tags.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "AP aging report retrieved successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiUnifiedReport"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/unified/ap-aging/exports/excel": {
      "get": {
        "tags": [],
        "summary": "Export AP aging report as Excel",
        "description": "Exports an accounts payable aging report as an Excel file. Returns a pre-signed URL for downloading the generated Excel file.",
        "operationId": "business.reports.unified.ap-aging.exports.excel.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export the AP aging report for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_filter",
            "in": "query",
            "description": "Filter results by tags.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the Excel export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/transactions/exports/csv": {
      "get": {
        "tags": [],
        "summary": "Export transactions as CSV",
        "description": "Exports transaction data as a CSV file. Returns a pre-signed URL for downloading the generated CSV file.",
        "operationId": "business.reports.transactions.exports.csv.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export transactions for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for transaction filtering (ISO 8601 format).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for transaction filtering (ISO 8601 format).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "external_account_ids",
            "in": "query",
            "description": "Comma-separated list of Layer external account UUIDs (Layer's internal identifier for an external account, e.g. a linked Plaid account). Filters transactions to those within the provided list of accounts. Unlike source_account_ids, these are Layer-assigned IDs rather than the external provider's account IDs. Takes precedence over account_filter if both are specified.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bank_account_ids",
            "in": "query",
            "description": "Comma-separated list of Layer bank account UUIDs. Filters transactions by their owning bank account. A bank account may back multiple external accounts (Plaid, Unit, Stripe Treasury, or custom), so this provides a higher-level filter than external_account_ids.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source_account_ids",
            "in": "query",
            "description": "Comma-separated list of external provider account IDs. Filters transactions by their source account ID from the external provider (e.g., Plaid account ID, Unit account ID, Stripe financial account ID, or custom account external ID).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "account_filter",
            "in": "query",
            "description": "Filter transactions by external account ID. This is a legacy alias for external_account_ids - prefer using external_account_ids instead. Only used when external_account_ids is not specified.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "direction",
            "in": "query",
            "description": "Filter by transaction direction.",
            "schema": {
              "type": "string",
              "enum": [
                "INFLOW",
                "OUTFLOW"
              ]
            }
          },
          {
            "name": "amount_min",
            "in": "query",
            "description": "The minimum amount of the transaction to include (in cents).",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "amount_max",
            "in": "query",
            "description": "The maximum amount of the transaction to include (in cents).",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "category",
            "in": "query",
            "description": "Filter transactions by category identifier or stable name.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categorized",
            "in": "query",
            "description": "Filter transactions by whether they are categorized (true) or not categorized (false).",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "categorization_status",
            "in": "query",
            "description": "Filter by categorization status.",
            "schema": {
              "type": "string",
              "enum": [
                "CATEGORIZED",
                "UNCATEGORIZED",
                "PENDING",
                "MATCHED"
              ]
            }
          },
          {
            "name": "is_matched",
            "in": "query",
            "description": "Filter transactions by whether they are matched (true) or not matched (false).",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "description_filter",
            "in": "query",
            "description": "Case-insensitive substring to search for in transaction descriptions (contains match, not exact equality).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "description_filter_regex",
            "in": "query",
            "description": "Regex to search for in transaction descriptions. Regex will be parsed exactly as given and an error will be returned if the regex is invalid.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "merchant_name_filter",
            "in": "query",
            "description": "Substring to search for in merchant name. Only exact matches will be returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "merchant_name_filter_regex",
            "in": "query",
            "description": "Regex to search for in merchant name. Regex will be parsed exactly as given and an error will be returned if the regex is invalid.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Search query string to filter transactions. Searches across multiple fields.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo",
            "in": "query",
            "description": "Filter transactions by exact memo match.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo_contains",
            "in": "query",
            "description": "Filter transactions where memo contains this substring.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter transactions. Only transactions with reference numbers matching any value in this list will be returned.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "UUID of the customer to filter transactions by.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customer_external_id",
            "in": "query",
            "description": "External ID of the customer to filter transactions by.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "vendor_id",
            "in": "query",
            "description": "UUID of the vendor to filter transactions by.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendor_external_id",
            "in": "query",
            "description": "External ID of the vendor to filter transactions by.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "counterparty_id",
            "in": "query",
            "description": "UUID of the counterparty to filter transactions by.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tag_key",
            "in": "query",
            "description": "Filter transactions by tag key. Must be used together with tag_values.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_values",
            "in": "query",
            "description": "Comma-separated list of tag values to filter by. Must be used together with tag_key.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the CSV export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Export transactions as CSV (POST)",
        "description": "Exports transaction data as a CSV file using POST request with parameters in the request body. Returns a pre-signed URL for downloading the generated CSV file.",
        "operationId": "business.reports.transactions.exports.csv.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export transactions for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "startDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "Start date for transaction filtering (ISO 8601 format)."
                  },
                  "endDate": {
                    "type": "string",
                    "format": "date-time",
                    "description": "End date for transaction filtering (ISO 8601 format)."
                  },
                  "accountFilter": {
                    "type": "string",
                    "description": "Filter transactions by account."
                  },
                  "categorizationStatus": {
                    "type": "string",
                    "enum": [
                      "CATEGORIZED",
                      "UNCATEGORIZED",
                      "PENDING"
                    ],
                    "description": "Filter by categorization status."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the CSV export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/transactions/exports/excel": {
      "get": {
        "tags": [],
        "summary": "Export transactions as Excel",
        "description": "Exports transaction data as an Excel file. Returns a pre-signed URL for downloading the generated Excel file.",
        "operationId": "business.reports.transactions.exports.excel.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to export transactions for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Start date for transaction filtering (ISO 8601 format).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "End date for transaction filtering (ISO 8601 format).",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "account_filter",
            "in": "query",
            "description": "Filter transactions by account.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "categorization_status",
            "in": "query",
            "description": "Filter by categorization status.",
            "schema": {
              "type": "string",
              "enum": [
                "CATEGORIZED",
                "UNCATEGORIZED",
                "PENDING"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the Excel export.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/tax-packets": {
      "post": {
        "tags": [],
        "summary": "Create tax packet",
        "description": "Creates a new tax packet request for generating comprehensive tax reporting documents including P&L reports, general ledger details, and account transactions.",
        "operationId": "business.reports.tax-packets.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the tax packet for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxPacketCreateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tax packet request created successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/TaxPacketCreateResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters. Either year or both start_date and end_date must be provided.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "get": {
        "tags": [],
        "summary": "List tax packets",
        "description": "Returns a list of tax packet requests for the business, optionally filtered by year or including archived requests.",
        "operationId": "business.reports.tax-packets.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch tax packets for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_archived",
            "in": "query",
            "description": "Whether to include archived tax packet requests.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "Filter tax packets by year.",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of tax packet requests.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/TaxPacketCreateResponse"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/tax/schedule-c": {
      "get": {
        "tags": [],
        "summary": "Fetch Schedule C report",
        "description": "Returns a Schedule C (Form 1040) report for sole proprietors, showing income and expenses mapped to IRS Schedule C line items. This endpoint requires the business's chart of accounts to have Schedule C mappings configured.",
        "operationId": "business.reports.tax.schedule-c.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the Schedule C report for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "The tax year for the Schedule C report (e.g., 2024).",
            "required": true,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "The accounting basis to use for the report. If not provided, defaults to the business's default reporting basis, or ACCRUAL if not set.",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/ReportingBasis"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Schedule C report data.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ScheduleCReport"
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "examples": {
                  "ScheduleCReportExample": {
                    "$ref": "#/components/examples/ScheduleCReportExample"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters or Schedule C is not configured for this business's chart of accounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/payments-trace-report": {
      "post": {
        "tags": [],
        "summary": "Generate payments trace report",
        "description": "Generates a payments trace report showing detailed payment and refund information over a specified time period. This endpoint uses POST due to the complexity of the request parameters.",
        "operationId": "business.reports.payments-trace-report.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to generate the payments trace report for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentsTraceReportRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payments trace report data.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PaymentsTraceReportResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/configure/stripe": {
      "get": {
        "tags": [],
        "summary": "Fetch Stripe configuration",
        "description": "Fetch the current platform Stripe configuration. Platform configuration includes the stripe secret used for API access, while business-level configuration includes specific Stripe entity IDs such as a Stripe connect account.",
        "operationId": "configure.stripe.get",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/StripeConfigurationResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Stripe configuration has not been set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update Stripe configuration",
        "description": "Update the current platform Stripe configuration. Platform configuration includes the stripe secret used for API access, while business-level configuration includes specific Stripe entity IDs such as a Stripe connect account.",
        "operationId": "configure.stripe.put",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StripeConfigurationInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/StripeConfigurationResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/plaid/connection-events": {
      "get": {
        "summary": "List Plaid connection events",
        "operationId": "business.plaid.listConnectionEvents",
        "description": "List recorded Plaid connection events for a business, newest first by default.",
        "parameters": [
          {
            "name": "businessId", "in": "path", "required": true,
            "description": "Layer business UUID. Platform credentials can access businesses belonging to their client; business credentials can access their own business.",
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "connection_type", "in": "query",
            "description": "Filter by connection kind. Filters combine with AND; events with no connection kind will not match.",
            "schema": { "type": "string", "enum": ["ITEM", "PROCESSOR_TOKEN"] }
          },
          {
            "name": "connection_id", "in": "query",
            "description": "Layer UUID of the Plaid item or processor-token record, not Plaid's item ID or a token value.",
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "account_id", "in": "query",
            "description": "Layer UUID of the Plaid account. Matches events explicitly associated with that account, not all events for its connection.",
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "event_types", "in": "query",
            "description": "Filter by case-sensitive event types, comma-separated or repeated. See [Event types](#event-types) for diagnostic guidance.",
            "style": "form", "explode": false,
            "schema": { "type": "array", "items": { "$ref": "#/components/schemas/PlaidConnectionEventType" } }
          },
          {
            "name": "limit", "in": "query",
            "description": "Maximum number of events per page.",
            "schema": { "type": "integer", "minimum": 1, "maximum": 1000, "default": 100 }
          },
          {
            "name": "cursor", "in": "query",
            "description": "Pass meta.pagination.cursor from the previous page while has_more is true. Keep filters and sort parameters unchanged.",
            "schema": { "type": "string" }
          },
          {
            "name": "sort_by", "in": "query",
            "schema": { "type": "string", "enum": ["created_at"], "default": "created_at" }
          },
          {
            "name": "sort_order", "in": "query",
            "description": "Order by created_at. Ties are ordered by event UUID ascending in either direction.",
            "schema": { "type": "string", "enum": ["ASC", "DESC"], "default": "DESC" }
          },
          {
            "name": "show_total_count", "in": "query",
            "description": "Include the total number of matching events across all pages in meta.pagination.total_count.",
            "schema": { "type": "boolean", "default": false }
          }
        ],
        "responses": {
          "200": {
            "description": "Recorded events and pagination metadata. Returns an empty data array when no events match.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["data", "meta"],
                  "properties": {
                    "data": { "type": "array", "items": { "$ref": "#/components/schemas/ApiPlaidConnectionEvent" } },
                    "meta": {
                      "type": "object",
                      "required": ["pagination"],
                      "properties": { "pagination": { "$ref": "#/components/schemas/PaginationMetadata" } }
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "type": "Plaid_Connection_Event",
                      "id": "9340d882-75cc-4224-9820-cc8634856d84",
                      "event_type": "LINK_EXCHANGE_FAILED",
                      "source": "USER",
                      "actor": "USER",
                      "connection_type": null,
                      "connection_id": null,
                      "plaid_account_id": null,
                      "webhook_type": null,
                      "webhook_code": null,
                      "details": "PlaidExchangePublicTokenError",
                      "created_at": "2026-11-01T12:00:00Z"
                    }
                  ],
                  "meta": {
                    "pagination": { "sort_by": "created_at", "sort_order": "DESC", "cursor": "opaque-cursor", "has_more": false, "total_count": 1 }
                  }
                }
              }
            }
          },
          "400": { "description": "Invalid filter, sort, limit, or cursor." },
          "401": { "description": "Missing or invalid credentials, including a business token that does not authenticate for the requested business." },
          "404": { "description": "Business not found or not accessible to the authenticated platform client." }
        }
      }
    },
    "/v1/businesses/{businessId}/plaid/items/{plaidItemId}/statements": {
      "get": {
        "summary": "List Plaid statements",
        "operationId": "business.plaid.statements.list",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "plaidItemId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": { "$ref": "#/components/schemas/ApiPlaidStatements" }
                  },
                  "required": ["data"]
                },
                "example": {
                  "data": {
                    "type": "Plaid_Statements",
                    "accounts": [
                      {
                        "account_id": "plaid-account-id",
                        "statements": [
                          { "statement_id": "plaid-statement-id", "month": 9, "year": 2026, "date_posted": "2026-10-01" }
                        ]
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": { "description": "Bad Request" },
          "403": { "description": "Forbidden" },
          "404": { "description": "Not Found" },
          "429": { "description": "Too Many Requests" },
          "500": { "description": "Internal Server Error" }
        }
      }
    },
    "/v1/businesses/{businessId}/plaid/items/{plaidItemId}/statements/{statementId}": {
      "post": {
        "summary": "Download bank statement",
        "operationId": "business.plaid.statements.download",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "plaidItemId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          },
          {
            "name": "statementId",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": { "$ref": "#/components/schemas/S3PresignedUrl" }
                  },
                  "required": ["data"]
                },
                "example": {
                  "data": {
                    "type": "S3_Presigned_Url",
                    "presignedUrl": "https://example-bucket.s3.amazonaws.com/statement.pdf?signature=example",
                    "fileType": "application/pdf",
                    "fileName": "plaid-statement-plaid-statement-id.pdf",
                    "createdAt": "2026-10-16T12:00:00Z",
                    "documentId": "a8c40b04-d074-41db-8de5-801d4846ea6b",
                    "document_type": "BANK_STATEMENT"
                  }
                }
              }
            }
          },
          "400": { "description": "Bad Request" },
          "403": { "description": "Forbidden" },
          "404": { "description": "Not Found" },
          "429": { "description": "Too Many Requests" },
          "500": { "description": "Internal Server Error" }
        }
      }
    },
    "/v1/configure/plaid": {
      "get": {
        "tags": [],
        "summary": "Fetch Plaid configuration",
        "description": "Fetch the current platform Plaid configuration. Platform configuration includes the Plaid client ID and secret used for API access.",
        "operationId": "configure.plaid.get",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PlaidConfigurationResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Plaid configuration has not been set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update Plaid configuration",
        "description": "Update the current platform Plaid configuration. Platform configuration includes the Plaid client ID and secret used for API access.",
        "operationId": "configure.plaid.put",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlaidConfigurationInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PlaidConfigurationResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/configure/sms": {
      "get": {
        "tags": [],
        "summary": "Fetch SMS configuration",
        "description": "Fetch the current platform SMS configuration. This returns whether SMS messaging is enabled at the platform level.",
        "operationId": "configure.sms.get",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SmsConfigurationResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update SMS configuration",
        "description": "Update the current platform SMS configuration. This controls whether SMS messaging is enabled at the platform level.",
        "operationId": "configure.sms.put",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SmsConfigurationResponse"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/SmsConfigurationResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/configure/quickbooks": {
      "get": {
        "tags": [],
        "summary": "Fetch Quickbooks configuration",
        "description": "Fetch the current platform Quickbooks configuration.",
        "operationId": "configure.quickbooks.get",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/QuickbooksConfigurationResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Quickbooks configuration has not been set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update Quickbooks configuration",
        "description": "Update the current platform Quickbooks configuration.",
        "operationId": "configure.quickbooks.put",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuickbooksConfigurationInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/QuickbooksConfigurationResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid Quickbooks configuration parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/configure/{clientId}/accounting": {
      "get": {
        "tags": [],
        "summary": "Fetch client accounting configuration",
        "description": "Returns the accounting configuration for the specified client. This includes settings such as the default reporting basis and books closure information at the client level.",
        "operationId": "configure.client.accounting.get",
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "description": "The UUID of the client to fetch the accounting configuration for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAccountingConfiguration"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Client not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [],
        "summary": "Update client accounting configuration",
        "description": "Updates the accounting configuration for the specified client. This allows you to modify settings such as the default reporting basis and mark books as closed at the client level.",
        "operationId": "configure.client.accounting.patch",
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "description": "Your platform's client ID (the UUID used to authenticate with Layer). This can be found in the Layer [dashboard](https://dashboard.layerfi.com/).",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountingConfigurationUpdateParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAccountingConfiguration"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Client not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/ledger/journal-entries": {
      "post": {
        "tags": [],
        "summary": "Create journal entry",
        "description": "Creates a manual entry within a business's general ledger.",
        "operationId": "business.ledger.journal-entries.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the journal entry for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateManualLedgerEntry"
              },
              "example": {
                "external_id": "example-external-id",
                "entry_at": "2023-11-07T05:31:56Z",
                "created_by": "jsmith",
                "memo": "Example debit/credit entry",
                "line_items": [
                  {
                    "account_identifier": {
                      "type": "AccountId",
                      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
                    },
                    "amount": 123,
                    "direction": "CREDIT",
                    "customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                    "customer_external_id": null,
                    "tags": [
                      {
                        "key": "Location",
                        "value": "MainStreet"
                      }
                    ]
                  },
                  {
                    "account_identifier": {
                      "type": "AccountId",
                      "id": "db7fb036-5691-4354-a057-cba1836c042a"
                    },
                    "amount": 123,
                    "direction": "DEBIT",
                    "customer_id": null,
                    "customer_external_id": null,
                    "tags": []
                  }
                ],
                "customer_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
                "customer_external_id": "customer-1",
                "tags": [
                  {
                    "key": "Location",
                    "value": "MainStreet"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiManualLedgerEntry"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid journal entry creation parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bills": {
      "get": {
        "tags": [],
        "summary": "List bills",
        "description": "Returns a list of bills for the specified business. Bills can be filtered by status and date range. Results will be paginated.",
        "operationId": "business.bills.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch bills for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter bills by. Only bills with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Filter bills by status.",
            "schema": {
              "$ref": "#/components/schemas/BillStatus"
            }
          },
          {
            "name": "due_at_start",
            "in": "query",
            "description": "Filter bills by due date. Bills with a due date on or after this date will be included. Bills without a set due date will not be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "due_at_end",
            "in": "query",
            "description": "Filter bills by due date. Bills with a due date on or before this date will be included. Bills without a set due date will not be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "received_at_start",
            "in": "query",
            "description": "Filter bills by received date. Bills received on or after this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "received_at_end",
            "in": "query",
            "description": "Filter bills by received date. Bills received on or before this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "vendor_id",
            "in": "query",
            "description": "Filter bills by Layer vendor id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendor_external_id",
            "in": "query",
            "description": "Filter bills by vendor external id. Either the vendor_id or the vendor_external_id can be provided.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_amount",
            "in": "query",
            "description": "Filter bills by minimum total amount (in positive cents).",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "max_amount",
            "in": "query",
            "description": "Filter bills by maximum total amount (in positive cents).",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "memo_contains",
            "in": "query",
            "description": "Filter bills by memo text. Returns bills where the memo contains this value.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_expense",
            "in": "query",
            "description": "Filter to expenses (`true`) or standard bills (`false`).",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "description": "Field to sort by. Eligible sort keys include imported_at and updated_at.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "description": "Sort direction.",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ]
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Pagination cursor returned from the previous page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of bills to return.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "show_total_count",
            "in": "query",
            "description": "Whether to include total count in pagination metadata.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBill"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create bill",
        "description": "Creates a new bill for a business.",
        "operationId": "business.bills.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the bill for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewBillPostParams"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Bill created successfully.",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
                    "business_id": "188eb399-f171-4849-861c-5c02d91f800b",
                    "external_id": "vendor-bill-123",
                    "status": "PARTIALLY_PAID",
                    "terms": "NET_30",
                    "received_at": "2024-06-01T10:11:57.184157Z",
                    "due_at": "2024-07-01T10:11:57.184158Z",
                    "paid_at": null,
                    "voided_at": null,
                    "reference_number": "VB-123",
                    "vendor": {
                      "id": "a4c38874-8c01-4986-b8d0-4f159a52dd39",
                      "external_id": "vendor-1",
                      "company_name": "Acme Supplies Inc.",
                      "email": "billing@acmesupplies.com",
                      "office_phone": "555-123-4567",
                      "address_string": "123 Vendor St, Supply City, CA 90210",
                      "notes": "Primary office supplies vendor",
                      "status": "ACTIVE"
                    },
                    "line_items": [
                      {
                        "id": "733de30f-db72-4d52-98c5-fe070d4433f7",
                        "external_id": "bill-line-item-1",
                        "bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
                        "account_identifier": {
                          "type": "AccountId",
                          "id": "80b708b5-7b27-456c-9fb1-b8b918241908"
                        },
                        "ledger_account": {
                          "id": "80b708b5-7b27-456c-9fb1-b8b918241908",
                          "name": "Office Supplies",
                          "stable_name": "OFFICE_SUPPLIES",
                          "normality": "DEBIT",
                          "account_type": {
                            "value": "EXPENSE",
                            "display_name": "Expenses"
                          },
                          "account_subtype": {
                            "value": "OPERATING_EXPENSES",
                            "display_name": "Operating Expenses"
                          }
                        },
                        "description": "Monthly office supplies",
                        "product_name": "Paper reams",
                        "unit_price": 1500,
                        "quantity": "10.00",
                        "subtotal": 15000,
                        "discount_amount": 1000,
                        "sales_taxes_total": 1120,
                        "sales_taxes": [
                          {
                            "tax_account": {
                              "type": "Tax_Name",
                              "name": "CA_SALES_TAX"
                            },
                            "tax_ledger_account": {
                              "id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
                              "name": "Sales tax: CA",
                              "stable_name": "SALES_TAXES:CA",
                              "normality": "DEBIT",
                              "account_type": {
                                "value": "EXPENSE",
                                "display_name": "Expenses"
                              },
                              "account_subtype": {
                                "value": "SALES_TAXES",
                                "display_name": "Sales Taxes"
                              }
                            },
                            "amount": 1120
                          }
                        ],
                        "total_amount": 15120,
                        "transaction_tags": [
                          {
                            "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
                            "key": "department",
                            "value": "operations",
                            "dimension_display_name": "Department",
                            "value_display_name": "Operations",
                            "dimension_id": "d1e2f3a4-b5c6-7890-abcd-ef1234567890",
                            "definition_id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
                            "created_at": "2024-02-27T02:16:40.389772Z",
                            "updated_at": "2024-02-27T02:16:40.389772Z",
                            "deleted_at": null,
                            "archived_at": null
                          }
                        ]
                      }
                    ],
                    "subtotal": 15000,
                    "additional_sales_taxes": [],
                    "additional_sales_taxes_total": 0,
                    "total_amount": 15120,
                    "outstanding_balance": 5120,
                    "memo": "Memo for the office supplies purchase",
                    "payment_allocations": [
                      {
                        "id": "8901abcd-ef23-4567-8901-abcd12345678",
                        "bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
                        "payment_id": "590ed436-c2bd-4e39-8047-f913a852f99c",
                        "amount": 10000,
                        "payment": {
                          "id": "590ed436-c2bd-4e39-8047-f913a852f99c",
                          "external_id": "bill-payment-1",
                          "paid_at": "2024-06-15T00:00:00Z",
                          "method": "ACH",
                          "amount": 10000,
                          "processor": "BANK_TRANSFER",
                          "imported_at": "2024-06-15T18:11:57.339076Z",
                          "allocations": [
                            {
                              "id": "8901abcd-ef23-4567-8901-abcd12345678",
                              "bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
                              "payment_id": "590ed436-c2bd-4e39-8047-f913a852f99c",
                              "amount": 10000,
                              "transaction_tags": []
                            }
                          ],
                          "transaction_tags": [],
                          "memo": "First partial payment",
                          "metadata": {},
                          "reference_number": "PAY-1001"
                        },
                        "transaction_tags": [],
                        "memo": "Allocated to June office supplies bill",
                        "metadata": {},
                        "reference_number": "ALLOC-1001"
                      }
                    ],
                    "vendor_credits": [],
                    "imported_at": "2024-06-01T10:11:57.184157Z",
                    "updated_at": "2024-06-15T18:11:57.339076Z",
                    "transaction_tags": [],
                    "metadata": {}
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBill"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/bulk": {
      "post": {
        "tags": [],
        "summary": "Batch create bills",
        "description": "Creates multiple bills in a single request.",
        "operationId": "business.bills.bulk.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the bills for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/NewBillPostParams"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Bills created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBill"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/{billId}": {
      "get": {
        "tags": [],
        "summary": "Fetch bill",
        "description": "Returns the bill associated with the provided bill id. A bill represents an invoice or purchase order a business has received from a vendor for goods or services, and is used to track purchases and accounts payable in Layer.",
        "operationId": "business.bills.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the bill for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "billId",
            "in": "path",
            "description": "The UUID of the bill to fetch.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
                    "business_id": "188eb399-f171-4849-861c-5c02d91f800b",
                    "external_id": "vendor-bill-123",
                    "status": "PARTIALLY_PAID",
                    "terms": "NET_30",
                    "received_at": "2024-06-01T10:11:57.184157Z",
                    "due_at": "2024-07-01T10:11:57.184158Z",
                    "paid_at": null,
                    "voided_at": null,
                    "reference_number": "VB-123",
                    "vendor": {
                      "id": "a4c38874-8c01-4986-b8d0-4f159a52dd39",
                      "external_id": "vendor-1",
                      "company_name": "Acme Supplies Inc.",
                      "email": "billing@acmesupplies.com",
                      "office_phone": "555-123-4567",
                      "address_string": "123 Vendor St, Supply City, CA 90210",
                      "notes": "Primary office supplies vendor",
                      "status": "ACTIVE"
                    },
                    "line_items": [
                      {
                        "id": "733de30f-db72-4d52-98c5-fe070d4433f7",
                        "external_id": "bill-line-item-1",
                        "bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
                        "account_identifier": {
                          "type": "AccountId",
                          "id": "80b708b5-7b27-456c-9fb1-b8b918241908"
                        },
                        "ledger_account": {
                          "id": "80b708b5-7b27-456c-9fb1-b8b918241908",
                          "name": "Office Supplies",
                          "stable_name": "OFFICE_SUPPLIES",
                          "normality": "DEBIT",
                          "account_type": {
                            "value": "EXPENSE",
                            "display_name": "Expenses"
                          },
                          "account_subtype": {
                            "value": "OPERATING_EXPENSES",
                            "display_name": "Operating Expenses"
                          }
                        },
                        "description": "Monthly office supplies",
                        "product_name": "Paper reams",
                        "unit_price": 1500,
                        "quantity": "10.00",
                        "subtotal": 15000,
                        "discount_amount": 1000,
                        "sales_taxes_total": 1120,
                        "sales_taxes": [
                          {
                            "tax_account": {
                              "type": "Tax_Name",
                              "name": "CA_SALES_TAX"
                            },
                            "tax_ledger_account": {
                              "id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
                              "name": "Sales tax: CA",
                              "stable_name": "SALES_TAXES:CA",
                              "normality": "DEBIT",
                              "account_type": {
                                "value": "EXPENSE",
                                "display_name": "Expenses"
                              },
                              "account_subtype": {
                                "value": "SALES_TAXES",
                                "display_name": "Sales Taxes"
                              }
                            },
                            "amount": 1120
                          }
                        ],
                        "total_amount": 15120,
                        "transaction_tags": [
                          {
                            "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
                            "key": "department",
                            "value": "operations",
                            "dimension_display_name": "Department",
                            "value_display_name": "Operations",
                            "dimension_id": "d1e2f3a4-b5c6-7890-abcd-ef1234567890",
                            "definition_id": "f1e2d3c4-b5a6-7890-abcd-ef1234567890",
                            "created_at": "2024-02-27T02:16:40.389772Z",
                            "updated_at": "2024-02-27T02:16:40.389772Z",
                            "deleted_at": null,
                            "archived_at": null
                          }
                        ]
                      }
                    ],
                    "subtotal": 15000,
                    "additional_sales_taxes": [],
                    "additional_sales_taxes_total": 0,
                    "total_amount": 15120,
                    "outstanding_balance": 5120,
                    "memo": "Memo for the office supplies purchase",
                    "payment_allocations": [
                      {
                        "id": "8901abcd-ef23-4567-8901-abcd12345678",
                        "bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
                        "payment_id": "590ed436-c2bd-4e39-8047-f913a852f99c",
                        "amount": 10000,
                        "payment": {
                          "id": "590ed436-c2bd-4e39-8047-f913a852f99c",
                          "external_id": "bill-payment-1",
                          "paid_at": "2024-06-15T00:00:00Z",
                          "method": "ACH",
                          "amount": 10000,
                          "processor": "BANK_TRANSFER",
                          "imported_at": "2024-06-15T18:11:57.339076Z",
                          "allocations": [
                            {
                              "id": "8901abcd-ef23-4567-8901-abcd12345678",
                              "bill_id": "b745c116-cd28-41a1-b4ea-84a2768b6e14",
                              "payment_id": "590ed436-c2bd-4e39-8047-f913a852f99c",
                              "amount": 10000,
                              "transaction_tags": []
                            }
                          ],
                          "transaction_tags": [],
                          "memo": "First partial payment",
                          "metadata": {},
                          "reference_number": "PAY-1001"
                        },
                        "transaction_tags": [],
                        "memo": "Allocated to June office supplies bill",
                        "metadata": {},
                        "reference_number": "ALLOC-1001"
                      }
                    ],
                    "vendor_credits": [],
                    "imported_at": "2024-06-01T10:11:57.184157Z",
                    "updated_at": "2024-06-15T18:11:57.339076Z",
                    "transaction_tags": [],
                    "metadata": {}
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBill"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/{billId}/update": {
      "post": {
        "tags": [],
        "summary": "Update bill",
        "description": "Updates an existing bill.",
        "operationId": "business.bills.update",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the bill belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "billId",
            "in": "path",
            "description": "The UUID of the bill to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillUpdatePayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bill updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBill"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/{billId}/void": {
      "post": {
        "tags": [],
        "summary": "Void bill",
        "description": "Voids an existing bill.",
        "operationId": "business.bills.void",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the bill belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "billId",
            "in": "path",
            "description": "The UUID of the bill to void.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bill voided successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBill"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/{billId}/delete": {
      "post": {
        "tags": [],
        "summary": "Delete bill",
        "description": "Deletes an existing bill.",
        "operationId": "business.bills.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the bill belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "billId",
            "in": "path",
            "description": "The UUID of the bill to delete.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bill deleted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBill"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/bill-payments": {
      "get": {
        "tags": [],
        "summary": "List bill payments",
        "description": "Returns a list of bill payments for the specified business. Payments can be filtered by method and date range.",
        "operationId": "business.bills.payments.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch bill payments for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter bill payments by. Only bill payments with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "method",
            "in": "query",
            "description": "Filter payments by method.",
            "schema": {
              "$ref": "#/components/schemas/PaymentMethod"
            }
          },
          {
            "name": "paid_at_start",
            "in": "query",
            "description": "Filter payments by payment date. Payments made on or after this date will be included.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "paid_at_end",
            "in": "query",
            "description": "Filter payments by payment date. Payments made on or before this date will be included.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "Filter payments by external ID (unique idempotency key). This will always yield zero or one result.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_matched",
            "in": "query",
            "description": "Filter bill payments by match status. If true, only matched payments will be returned. If false, only unmatched payments will be returned. Bill payments are considered matched if they are matched directly, or if they are included in a vendor payout that is matched.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "tag_key",
            "in": "query",
            "description": "Tag key to filter bill payments by. Must be used together with tag_values.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_values",
            "in": "query",
            "description": "Comma-separated list of tag values to filter by. Must be used together with tag_key. Returns 404 if the tag key/value combination does not exist.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "vendor_id",
            "in": "query",
            "description": "Filter bill payments by vendor UUID. Returns payments tagged directly with this vendor, as well as payments allocated to bills associated with this vendor.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendor_external_id",
            "in": "query",
            "description": "Filter bill payments by vendor external ID. Returns payments tagged directly with the vendor matching this external ID, as well as payments allocated to bills associated with that vendor.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_amount",
            "in": "query",
            "description": "Filter bill payments by minimum gross amount, in positive cents. Inclusive: only payments with a gross amount greater than or equal to this value are returned. Negative values are rejected.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "max_amount",
            "in": "query",
            "description": "Filter bill payments by maximum gross amount, in positive cents. Inclusive: only payments with a gross amount less than or equal to this value are returned. Negative values are rejected.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBillPayment"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create bill payment",
        "description": "Creates a new payment for one or more bills.",
        "operationId": "business.bills.payments.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the payment for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateStandaloneBillPayment"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Payment created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBillPayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. This can occur if the payment's vendor does not match the vendor on every allocated bill (`Payment vendor must match all allocated bill vendors`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/bill-payments/{paymentId}": {
      "get": {
        "tags": [],
        "summary": "Fetch bill payment",
        "description": "Returns the bill payment associated with the provided payment id.",
        "operationId": "business.bills.payments.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the payment for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the payment to fetch.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBillPayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/bill-payments/{paymentId}/update": {
      "post": {
        "tags": [],
        "summary": "Update bill payment",
        "description": "Updates an existing bill payment.",
        "operationId": "business.bills.payments.update",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the payment belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the payment to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillPaymentUpdatePayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payment updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBillPayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. This can occur if the payment's vendor does not match the vendor on every allocated bill (`Payment vendor must match all allocated bill vendors`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/bill-payments/{paymentId}/delete": {
      "post": {
        "tags": [],
        "summary": "Delete bill payment",
        "description": "Deletes an existing bill payment.",
        "operationId": "business.bills.payments.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the payment belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the payment to delete.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Payment deleted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBillPayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/vendor-credits": {
      "get": {
        "tags": [],
        "summary": "List vendor credits",
        "description": "Returns a list of vendor credits for the specified business. Vendor credits can be filtered by date range and vendor. Results will be paginated.",
        "operationId": "business.bills.vendor-credits.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch vendor credits for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendor_id",
            "in": "query",
            "description": "Filter vendor credits by vendor ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "received_at_start",
            "in": "query",
            "description": "Filter vendor credits by received date. Vendor credits received on or after this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "received_at_end",
            "in": "query",
            "description": "Filter vendor credits by received date. Vendor credits received on or before this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter vendor credits by. Only vendor credits with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo",
            "in": "query",
            "description": "Filter vendor credits by exact memo match.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo_contains",
            "in": "query",
            "description": "Filter vendor credits where memo contains this substring.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiVendorCredit"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create vendor credit",
        "description": "Creates a new vendor credit for a business.",
        "operationId": "business.bills.vendor-credits.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the vendor credit for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VendorCreditCreateParams"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Vendor credit created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorCredit"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "200": {
            "description": "Existing vendor credit found or updated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorCredit"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/vendor-credits/{vendorCreditId}": {
      "get": {
        "tags": [],
        "summary": "Fetch vendor credit",
        "description": "Returns the vendor credit associated with the provided vendor credit ID.",
        "operationId": "business.bills.vendor-credits.get_one",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the vendor credit for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendorCreditId",
            "in": "path",
            "description": "The UUID of the vendor credit to fetch.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorCredit"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Update vendor credit",
        "description": "Updates an existing vendor credit.",
        "operationId": "business.bills.vendor-credits.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the vendor credit belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendorCreditId",
            "in": "path",
            "description": "The UUID of the vendor credit to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VendorCreditUpdateParams"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Vendor credit updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorCredit"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [],
        "summary": "Delete vendor credit",
        "description": "Marks a vendor credit as deleted (soft delete).",
        "operationId": "business.bills.vendor-credits.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the vendor credit belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendorCreditId",
            "in": "path",
            "description": "The UUID of the vendor credit to delete.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Vendor credit deleted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorCredit"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/customer-credits": {
      "get": {
        "tags": [],
        "summary": "List customer credits",
        "description": "Returns a list of customer credits for the specified business. Customer credits can be filtered by date range and customer. Results will be paginated.",
        "operationId": "business.invoices.customer-credits.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch customer credits for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "Filter customer credits by customer ID.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sent_at_start",
            "in": "query",
            "description": "Filter customer credits by sent date. Customer credits received on or after this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sent_at_end",
            "in": "query",
            "description": "Filter customer credits by sent date. Customer credits received before this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "memo",
            "in": "query",
            "description": "Filter customer credits by exact memo match.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo_contains",
            "in": "query",
            "description": "Filter customer credits where memo contains this substring.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter customer credits by. Only customer credits with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiCustomerCredit"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create customer credit",
        "description": "Creates a new customer credit for a business.",
        "operationId": "business.invoices.customer-credits.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the customer credit for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCreditCreateParams"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Customer credit created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomerCredit"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "200": {
            "description": "Existing customer credit found or updated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomerCredit"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/customer-credits/{customerCreditId}": {
      "get": {
        "tags": [],
        "summary": "Fetch customer credit",
        "description": "Returns the customer credit associated with the provided customer credit ID.",
        "operationId": "business.invoices.customer-credits.get_one",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the customer credit for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerCreditId",
            "in": "path",
            "description": "The UUID of the customer credit to fetch.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomerCredit"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Update customer credit",
        "description": "Updates an existing customer credit.",
        "operationId": "business.invoices.customer-credits.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the customer credit belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerCreditId",
            "in": "path",
            "description": "The UUID of the customer credit to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerCreditUpdateParams"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Customer credit updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomerCredit"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [],
        "summary": "Delete customer credit",
        "description": "Marks a customer credit as deleted (soft delete).",
        "operationId": "business.invoices.customer-credits.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the customer credit belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerCreditId",
            "in": "path",
            "description": "The UUID of the customer credit to delete.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer credit deleted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomerCredit"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bookkeeping/activate": {
      "post": {
        "tags": [],
        "summary": "Activate bookkeeping",
        "description": "Activates bookkeeping for the specified business.",
        "operationId": "business.bookkeeping.activate.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to activate bookkeeping for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bookkeeping activated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBookkeepingStatus"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bookkeeping/deactivate": {
      "post": {
        "tags": [],
        "summary": "Deactivate bookkeeping",
        "description": "Deactivates bookkeeping for the specified business.",
        "operationId": "business.bookkeeping.deactivate.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to deactivate bookkeeping for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bookkeeping deactivated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBookkeepingStatus"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bookkeeping/start-date": {
      "post": {
        "tags": [],
        "summary": "Set bookkeeping start date",
        "description": "Set the first month of bookkeeping. This can be a historical month when a customer wants catchup bookkeeping or a future month when a customer wants to begin bookkeeping.",
        "operationId": "business.bookkeeping.startDate.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to set the bookkeeping start date for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetBookkeepingStartDateParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Bookkeeping start date updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBookkeepingStartDate"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The year or month is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing authentication.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or bookkeeping configuration not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bookkeeping/status": {
      "get": {
        "tags": [],
        "summary": "Fetch bookkeeping status",
        "description": "Returns the effective bookkeeping enrollment status for the specified business, including onboarding completion metadata.",
        "operationId": "business.bookkeeping.status.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the bookkeeping status for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bookkeeping status detail.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBookkeepingStatusDetail"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing authentication.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found or not accessible to the caller.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/vendors": {
      "get": {
        "tags": [],
        "summary": "List vendors",
        "description": "Returns a list of vendors for the specified business.",
        "operationId": "business.vendors.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch vendors for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "include_archived",
            "in": "query",
            "description": "Whether to include archived vendors in the response.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "The external ID of the vendor to fetch.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_id_contains",
            "in": "query",
            "description": "A case-insensitive substring used to filter vendors whose external ID contains the specified value.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "query",
            "description": "The name of the vendors to fetch.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name_contains",
            "in": "query",
            "description": "A case-insensitive substring used to filter vendors whose name contains the specified value.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter vendors by. Only vendors with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiVendorData"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create vendor",
        "description": "Creates a new vendor for a business.",
        "operationId": "business.vendors.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the vendor for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVendorInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Vendor created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/vendors/{vendorId}": {
      "get": {
        "tags": [],
        "summary": "Fetch vendor",
        "description": "Returns the vendor associated with the provided vendor id.",
        "operationId": "business.vendors.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the vendor for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendorId",
            "in": "path",
            "description": "The UUID of the vendor to fetch.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [],
        "summary": "Update vendor",
        "description": "Replaces an existing vendor.",
        "operationId": "business.vendors.update",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the vendor belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendorId",
            "in": "path",
            "description": "The UUID of the vendor to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVendorInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Vendor updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Patch update vendor",
        "description": "Patches (partially updates) an existing vendor.",
        "operationId": "business.vendors.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the vendor belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendorId",
            "in": "path",
            "description": "The UUID of the vendor to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateVendorParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Vendor updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/vendors/{vendorId}/archive": {
      "post": {
        "tags": [],
        "summary": "Archive vendor",
        "description": "Archives an existing vendor.",
        "operationId": "business.vendors.archive",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the vendor belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendorId",
            "in": "path",
            "description": "The UUID of the vendor to archive.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Vendor archived successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/vendors/{vendorId}/unarchive": {
      "post": {
        "tags": [],
        "summary": "Unarchive vendor",
        "description": "Unarchives an existing vendor.",
        "operationId": "business.vendors.unarchive",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the vendor belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendorId",
            "in": "path",
            "description": "The UUID of the vendor to unarchive.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Vendor unarchived successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/customers": {
      "get": {
        "tags": [],
        "summary": "List customers",
        "description": "Returns a list of customers for the specified business.",
        "operationId": "business.customers.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch customers for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "include_archived",
            "in": "query",
            "description": "Whether to include archived customers in the response.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "The external ID of the customer to fetch.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_id_contains",
            "in": "query",
            "description": "A case-insensitive substring used to filter customers whose external ID contains the specified value.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "query",
            "description": "The name of the customers to fetch.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name_contains",
            "in": "query",
            "description": "A case-insensitive substring used to filter customers whose name contains the specified value.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter customers by. Only customers with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiCustomerData"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create customer",
        "description": "Creates a new customer for a business.",
        "operationId": "business.customers.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the customer for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomerInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Customer created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomerData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/customers/bulk": {
      "post": {
        "tags": [],
        "summary": "Bulk create customers",
        "description": "Creates multiple customers for a business in a single request.",
        "operationId": "business.customers.bulk.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create customers for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CreateCustomerInput"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Customers created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiCustomerData"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/customers/{customerId}": {
      "get": {
        "tags": [],
        "summary": "Fetch customer",
        "description": "Returns the customer associated with the provided customer id.",
        "operationId": "business.customers.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the customer for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "description": "The UUID of the customer to fetch.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomerData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [],
        "summary": "Update customer",
        "description": "Replaces an existing customer.",
        "operationId": "business.customers.update",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the customer belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "description": "The UUID of the customer to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomerInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomerData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Patch update customer",
        "description": "Patch (partially) updates an existing customer.",
        "operationId": "business.customers.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the customer belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "description": "The UUID of the customer to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCustomerParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Customer updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomerData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/customers/{customerId}/archive": {
      "post": {
        "tags": [],
        "summary": "Archive customer",
        "description": "Archives an existing customer.",
        "operationId": "business.customers.archive",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the customer belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "description": "The UUID of the customer to archive.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer archived successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomerData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/customers/{customerId}/unarchive": {
      "post": {
        "tags": [],
        "summary": "Unarchive customer",
        "description": "Unarchives an existing customer.",
        "operationId": "business.customers.unarchive",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the customer belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "description": "The UUID of the customer to unarchive.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Customer unarchived successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomerData"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices": {
      "get": {
        "tags": [],
        "summary": "List invoices",
        "description": "Returns a list of invoices for the specified business. Invoices can be filtered by status and date range. Results will be paginated, see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.invoices.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch invoices for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Filter invoices by status. Supports filtering by multiple statuses using two formats: 1) Comma-separated values: `?status=PAID,PARTIALLY_PAID` 2) Multiple query parameters: `?status=PAID&status=PARTIALLY_PAID`. Both formats return invoices matching any of the specified statuses.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "due_at_start",
            "in": "query",
            "description": "Filter invoices by due date. Invoices with a due date on or after this date will be included. Invoices without a set due date will not be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "due_at_end",
            "in": "query",
            "description": "Filter invoices by due date. Invoices with a due date on or before this date will be included. Invoices without a set due date will not be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sent_at_start",
            "in": "query",
            "description": "Filter invoices by sent date. Invoices with a sent date on or after this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sent_at_end",
            "in": "query",
            "description": "Filter invoices by sent date. Invoices with a sent date on or before this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "Filter invoices by Layer customer id.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customer_external_id",
            "in": "query",
            "description": "Filter invoices by customer external id. Either the customer_id or the customer_external_id can be provided, but must match if both are provided.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter invoices by. Only invoices with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_amount",
            "in": "query",
            "description": "Filter invoices by minimum total amount (in positive cents).",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "max_amount",
            "in": "query",
            "description": "Filter invoices by maximum total amount (in positive cents).",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "memo",
            "in": "query",
            "description": "Filter invoices by exact memo match.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo_contains",
            "in": "query",
            "description": "Filter invoices where memo contains this substring.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiInvoice"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create invoice",
        "description": "Create a new invoice for the specified business. This endpoint imports an invoice into Layer and can optionally include payment information in the same request to create an immediately paid or partially paid invoice.",
        "operationId": "business.invoices.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the invoice for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Invoice to create. You can create an unpaid invoice or include `payments` to create an immediately paid or partially paid invoice in a single API call.",
          "required": true,
          "content": {
            "application/json": {
              "examples": {
                "unpaid_invoice": {
                  "summary": "Create an unpaid invoice",
                  "value": {
                    "external_id": "019234",
                    "sent_at": "2024-04-02T09:02:00Z",
                    "due_at": "2024-05-02T09:02:00Z",
                    "invoice_number": "1",
                    "customer_external_id": "customer-john-doe",
                    "line_items": [
                      {
                        "product": "Cleaner Solution Pro",
                        "unit_price": 1299,
                        "quantity": 2,
                        "sales_taxes": [
                          {
                            "tax_account": {
                              "type": "Tax_Name",
                              "name": "CALIFORNIA_VAT"
                            },
                            "amount": 218
                          }
                        ]
                      },
                      {
                        "product": "Full drain cleaning service",
                        "unit_price": 25000,
                        "quantity": 1
                      }
                    ],
                    "additional_discount": 250
                  }
                },
                "invoice_with_payments": {
                  "summary": "Create an invoice with an immediate payment",
                  "value": {
                    "external_id": "234988",
                    "sent_at": "2024-05-12T14:13:07Z",
                    "due_at": "2024-06-12T14:13:07Z",
                    "invoice_number": "2",
                    "customer_external_id": "customer-john-doe",
                    "line_items": [
                      {
                        "product": "Cleaner Solution Pro",
                        "unit_price": 1299,
                        "quantity": 1,
                        "sales_taxes": [
                          {
                            "amount": 114
                          }
                        ]
                      },
                      {
                        "product": "Cleanout snake",
                        "unit_price": 18000,
                        "quantity": 1
                      }
                    ],
                    "additional_sales_taxes": [
                      {
                        "amount": 1291
                      }
                    ],
                    "payments": [
                      {
                        "external_id": "239872",
                        "method": "CREDIT_CARD",
                        "amount": 20704,
                        "processor": "MY_PROCESSOR"
                      }
                    ]
                  }
                }
              },
              "schema": {
                "$ref": "#/components/schemas/NewInvoicePostParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Invoice already exists and matches provided data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoice"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Invoice created successfully.",
            "content": {
              "application/json": {
                "example": {
                  "data": {
                    "type": "Invoice",
                    "id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
                    "business_id": "83d8fb80-31ee-4d57-b684-44b4aaa5e01f",
                    "external_id": "019234",
                    "status": "SENT",
                    "sent_at": "2024-04-02T09:02:00Z",
                    "due_at": "2024-05-02T09:02:00Z",
                    "paid_at": null,
                    "voided_at": null,
                    "invoice_number": "1",
                    "customer": {
                      "id": "a4c38874-8c01-4986-b8d0-4f159a52dd39",
                      "external_id": "customer-john-doe",
                      "status": "ACTIVE"
                    },
                    "line_items": [
                      {
                        "id": "e6a491dd-9c22-4403-a54f-32d741a7ec67",
                        "invoice_id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
                        "product": "Cleaner Solution Pro",
                        "unit_price": 1299,
                        "quantity": "2.00",
                        "subtotal": 2598,
                        "discount_amount": 0,
                        "sales_taxes_total": 218,
                        "sales_taxes": [
                          {
                            "tax_account": {
                              "type": "Tax_Name",
                              "name": "CALIFORNIA_VAT"
                            },
                            "tax_ledger_account": {
                              "id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
                              "name": "Sales tax: CALIFORNIA",
                              "stable_name": "SALES_TAXES_PAYABLE:CALIFORNIA"
                            },
                            "amount": 218
                          }
                        ],
                        "total_amount": 2816
                      }
                    ],
                    "subtotal": 27598,
                    "additional_discount": 250,
                    "additional_sales_taxes_total": 0,
                    "tips": 0,
                    "total_amount": 27566,
                    "outstanding_balance": 27566,
                    "payment_allocations": [],
                    "transaction_tags": []
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoice"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}": {
      "get": {
        "tags": [],
        "summary": "Fetch invoice",
        "description": "Returns the invoice associated with the provided invoice id.",
        "operationId": "business.invoices.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the invoice for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoice"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or invoice id is not found. This indicates the business id is invalid or the business has been archived, or the invoice id is invalid or the invoice has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update invoice",
        "description": "Updates an existing invoice. Payments, refunds and writeoffs are not changed, but updates to invoice cannot put the invoice into an overpaid state.",
        "operationId": "business.invoices.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update the invoice for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateInvoiceParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Invoice updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoice"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Patch invoice",
        "description": "Partially updates an existing invoice. Provide only the fields you want to change. At least one field is required. Payments, refunds, and write-offs are not changed, but updates cannot put the invoice into an overpaid state.",
        "operationId": "business.invoices.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update the invoice for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchInvoiceParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Invoice updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoice"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/pdf": {
      "get": {
        "tags": [],
        "summary": "Generate invoice PDF",
        "description": "Generates a PDF document for the specified invoice and returns a presigned URL to download the PDF.",
        "operationId": "business.invoices.pdf.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business that owns the invoice.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice to generate a PDF for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PDF generated successfully. Returns a presigned URL to download the PDF document.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrlForPDF"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business ID or invoice ID not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error occurred during PDF generation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/void": {
      "post": {
        "tags": [],
        "summary": "Void invoice",
        "description": "Voids an invoice. Voiding excludes the invoice entirely from accounting. An invoice can only be voided if it has no payments or write-offs associated with it.",
        "operationId": "business.invoices.void.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the invoice belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice to void.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invoice voided successfully or was already voided.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoice"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invoice cannot be voided. This occurs if the invoice has payments or write-offs associated with it. Delete the payments and/or write-offs first if they were made in error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business ID or invoice ID not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/bulk": {
      "post": {
        "tags": [],
        "summary": "Bulk create invoices",
        "description": "Create multiple invoices in a batch operation. This endpoint is useful for backfill use cases when creating a business with an extended invoice history.",
        "operationId": "business.invoices.bulk.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create invoices for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/NewInvoicePostParams"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiInvoice"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Entity conflict: an object referenced in this request conflicts with an existing object. This can occur if you specify invoice payments that share the `id` or `external_id` (idempotency keys) with an existing payment, but the data does not match. If you wish to update a payment, you must do so explicitly through the payments endpoint before referencing the updated object in the invoices endpoint.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found or a ledger account specified by a given line item does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": true
      }
    },
    "/v1/businesses/{businessId}/invoices/batch": {
      "post": {
        "tags": [],
        "summary": "Batch create invoices",
        "description": "Create multiple invoices in a single request. Supports an optional `allow_partial_success` mode that commits each invoice independently, returning `207 Multi-Status` when results are mixed.",
        "operationId": "business.invoices.batch.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create invoices for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "allow_partial_success",
            "in": "query",
            "description": "When `true`, invoices are committed individually so that a failure on one invoice does not roll back the others. Defaults to `false` (all-or-nothing).",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/NewInvoicePostParams"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "All invoices were created successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BatchCreateInvoicesResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "207": {
            "description": "Partial success. At least one invoice succeeded and at least one failed. Only returned when `allow_partial_success=true`. Check `failed_invoices` for details on which invoices did not persist.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BatchCreateInvoicesResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request. This is returned when the payload contains duplicate `external_id` values, or (when `allow_partial_success=false`) when an invoice conflicts with an existing entity.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found, or (when `allow_partial_success=false`) a ledger account specified by a line item does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/invoices/payments": {
      "get": {
        "tags": [],
        "summary": "List payments",
        "description": "Returns a list of invoice payments for the specified business. Payments can be filtered by method and date range. Results will be paginated, see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.invoices.payments.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch invoice payments for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "method",
            "in": "query",
            "description": "Filter payments by payment method. Supported values are `CASH`, `CHECK`, `CREDIT_CARD`, `ACH`, `CREDIT_BALANCE`, `OTHER`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "processor",
            "in": "query",
            "description": "Filter payments by payment processor (e.g., `stripe`). Returns only payments processed through the specified processor.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "paid_at_start",
            "in": "query",
            "description": "Filter payments by payment date. Payments made on or after this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "paid_at_end",
            "in": "query",
            "description": "Filter payments by payment date. Payments made on or before this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "Filter payments by external ID (unique idempotency key). This will always yield zero or one result.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter invoice payments by. Only invoice payments with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "included_in_payout",
            "in": "query",
            "description": "Filter payments by whether they are included in a payout. Set to `true` to show only payments that are part of a payout, `false` to show only payments not in any payout.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "is_matched",
            "in": "query",
            "description": "Filter invoice payments by match status. If true, only matched payments will be returned. If false, only unmatched payments will be returned. Invoice payments are considered matched if they are matched directly, or if they are included in a payout that is matched.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "memo",
            "in": "query",
            "description": "Filter payments by exact memo match.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo_contains",
            "in": "query",
            "description": "Filter payments where memo contains this substring.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_key",
            "in": "query",
            "description": "Tag key to filter invoice payments by. Must be used together with tag_values.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "tag_values",
            "in": "query",
            "description": "Comma-separated list of tag values to filter by. Must be used together with tag_key. Returns 404 if the tag key/value combination does not exist.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "Filter invoice payments by customer UUID. Returns payments tagged directly with this customer, as well as payments allocated to invoices associated with this customer.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customer_external_id",
            "in": "query",
            "description": "Filter invoice payments by customer external ID. Returns payments tagged directly with the customer matching this external ID, as well as payments allocated to invoices associated with that customer.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_amount",
            "in": "query",
            "description": "Filter invoice payments by minimum gross amount, in positive cents. Inclusive: only payments with a gross amount greater than or equal to this value are returned. Negative values are rejected.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "max_amount",
            "in": "query",
            "description": "Filter invoice payments by maximum gross amount, in positive cents. Inclusive: only payments with a gross amount less than or equal to this value are returned. Negative values are rejected.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiInvoicePayment"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Record a payment",
        "description": "Records a payment that can be allocated to one or more invoices and/or ledger accounts.",
        "operationId": "business.invoices.payments.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the payment for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Payment to create with its allocations.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateStandaloneInvoicePayment"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payment exists and matches provided data or was successfully updated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoicePayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Payment created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoicePayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. This can occur if:\n- The request payload is malformed\n- Payment allocations do not match payment amount\n- Refund allocations target invalid entities\n- Processor is specified for a payment method that should not have one\n- Redemption account is specified for non-redemption payment\n- The payment's customer does not match the customer on every allocated invoice (`Payment customer must match all allocated invoice customers`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business ID not found or referenced invoice does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Payment with the same external ID exists but does not match provided data.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/payments/{paymentId}": {
      "get": {
        "tags": [],
        "summary": "Fetch invoice payment",
        "description": "Returns the invoice payment associated with the provided payment id.",
        "operationId": "business.invoices.payments.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the invoice payment for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the invoice payment to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoicePayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or payment id is not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Update payment",
        "description": "Update an invoice payment. Updates to information such as the amount or time will cause reversal of previous journal entries and creation of new entries.",
        "operationId": "business.invoices.payments.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update the invoice payment for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the invoice payment to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PaymentPatchUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoicePayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. This can occur if the payment's customer does not match the customer on every allocated invoice (`Payment customer must match all allocated invoice customers`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id or payment id is not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/write-off": {
      "post": {
        "tags": [],
        "summary": "Record write-off",
        "description": "This endpoint records a write-off of an invoice in Layer.",
        "operationId": "business.invoices.write-off.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the invoice is associated with.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice the write-off is applied to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvoiceWriteOff"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoiceWriteOff"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid write-off creation parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id or invoice id is not found. This indicates the business id is invalid or the business has been archived, or the invoice id is invalid or the invoice has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/write-offs/{writeOffId}": {
      "get": {
        "tags": [],
        "summary": "Fetch write-off",
        "description": "Fetches a write-off for a business.",
        "operationId": "business.invoices.write-offs.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the invoice is associated with.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice the write-off is applied to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "writeOffId",
            "in": "path",
            "description": "The UUID of the write-off to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoiceWriteOff"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or invoice id is not found. This indicates the business id is invalid or the business has been archived, or the invoice id is invalid or the invoice has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [],
        "summary": "Delete write-off",
        "description": "Deletes a write-off for a business.",
        "operationId": "business.invoices.write-offs.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the invoice is associated with.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice the write-off is applied to.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "writeOffId",
            "in": "path",
            "description": "The UUID of the write-off to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoiceWriteOff"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or invoice id is not found. This indicates the business id is invalid or the business has been archived, or the invoice id is invalid or the invoice has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tags": {
      "post": {
        "tags": [],
        "summary": "Tag entities",
        "description": "Tag entities of a specified type with custom tags. This generic endpoint allows tagging of any supported entity type. When tagging a BANK_ACCOUNT, the tags are automatically applied to all transactions and opening balances associated with that bank account.",
        "operationId": "business.tags.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to tag entities for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewTagsPostParamsWithEntity"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tags successfully created.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTags"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or any of the specified entity ids are not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tags/delete": {
      "post": {
        "tags": [],
        "summary": "Delete tags from entity",
        "description": "Remove tags from entities of a specified type. This generic endpoint allows removing tags from any supported entity type.",
        "operationId": "business.tags.delete.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to remove tags for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TagsDeleteParamsWithEntity"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tags successfully removed.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or any of the specified tag ids are not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/activity": {
      "get": {
        "tags": [],
        "summary": "[Deprecated] Fetch platform activity summary",
        "description": "Generates an activity summary across all businesses on the platform.",
        "operationId": "activity.get",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ClientActivitySummary"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/activity/businesses/{businessId}": {
      "get": {
        "tags": [],
        "summary": "[Deprecated] Fetch business activity summary",
        "description": "Generates an activity summary for a specific businessfocused on recent categorization and SMS activity.",
        "operationId": "activity.business.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/BusinessActivitySummary"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/activity/businesses/{businessId}/activities": {
      "get": {
        "tags": [],
        "summary": "[Deprecated] Fetch business activities",
        "description": "Generates a list of activities for a specific business. Activities include categorization, SMS, and other business-specific events. This endpoint is paginated, see [Pagination](/api-details/pagination) for details.",
        "operationId": "activity.business.activities.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch activities for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Filter activities by start date. Activities with a start date on or after this date will be included. ISO 8601 date format.",
            "example": "2024-07-01T00:00:00Z",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "Filter activities by end date. Activities with an end date on or before this date will be included. ISO 8601 date format.",
            "example": "2024-08-01T00:00:00Z",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "description": "Sort order for the activities. Defaults to ascending order.",
            "schema": {
              "$ref": "#/components/schemas/LayerApiSortOrder"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiTypedActivity"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v2/activity": {
      "get": {
        "tags": [],
        "summary": "Fetch platform activity summary",
        "description": "Generates a platform activity summary with monthly breakdowns across all businesses. This is the v2 version that provides more detailed monthly analytics.",
        "operationId": "activity.v2.get",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/PlatformActivitySummary"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v2/activity/businesses/{businessId}": {
      "get": {
        "tags": [],
        "summary": "Fetch business activity metrics",
        "description": "Generates a monthly activity summary for a specific business, including SMS, categorization, and external account connection metrics. This v2 endpoint supports an optional date range and returns a monthly breakdown format.",
        "operationId": "activity.v2.business.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch metrics for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Optional filter for the start of the activity window. Metrics will include data on or after this date. Accepts either an ISO 8601 date (YYYY-MM-DD) or date-time.",
            "example": "2024-02-01",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "Optional filter for the end of the activity window. Metrics will include data up to and including this date. Accepts either an ISO 8601 date (YYYY-MM-DD) or date-time.",
            "example": "2024-03-31",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BusinessActivitySummaryV2"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v2/activity/businesses/{businessId}/activities": {
      "get": {
        "tags": [],
        "summary": "Fetch business activities",
        "description": "Generates a list of activities for a specific business. Activities include categorization, SMS, and other business-specific events. This endpoint is paginated, see [Pagination](/api-details/pagination) for details. This v2 endpoint uses the same response format as v1.",
        "operationId": "activity.v2.business.activities.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch activities for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Filter activities by start date. Activities with a start date on or after this date will be included. ISO 8601 date format.",
            "example": "2024-07-01T00:00:00Z",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "Filter activities by end date. Activities with a start date on or before this date will be included. ISO 8601 date format.",
            "example": "2024-07-31T23:59:59Z",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "The page number to fetch. Defaults to 1.",
            "example": 1,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "per_page",
            "in": "query",
            "description": "The number of items per page. Defaults to 25, maximum is 100.",
            "example": 25,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiTypedActivity"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/payouts": {
      "get": {
        "tags": [],
        "summary": "List payouts",
        "description": "Fetches a list of payouts for a business. Payouts can be filtered by external ID, memo content, completion date range, and amount range. Results will be paginated, see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.payouts.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch payouts for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "Filter payouts by external ID (unique idempotency key). This will always yield zero or one result.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo_contains",
            "in": "query",
            "description": "Filter payouts by memo content. Returns payouts where the memo contains this string (case-sensitive).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo_exact",
            "in": "query",
            "description": "Filter payouts by exact memo match. Returns payouts where the memo exactly matches this string.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "completed_at_start",
            "in": "query",
            "description": "Filter payouts by completion date. Payouts completed on or after this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "completed_at_end",
            "in": "query",
            "description": "Filter payouts by completion date. Payouts completed on or before this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "amount_min",
            "in": "query",
            "description": "Filter payouts by minimum amount. Only payouts with amounts greater than or equal to this value will be included.",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "amount_max",
            "in": "query",
            "description": "Filter payouts by maximum amount. Only payouts with amounts less than or equal to this value will be included.",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter payouts by. Only payouts with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_matched",
            "in": "query",
            "description": "Filter payout by match status. If true, only matched payouts will be returned. If false, only unmatched payouts will be returned.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiPayout"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create payout",
        "description": "Creates a new payout for a business or updates existing payout. This endpoint is idempotent using the `external_id` field as the idempotency key, so subsequent requests with the same `external_id` will update or no-op.",
        "operationId": "business.payouts.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create a payout for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePayoutParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payout has been successfully updated or unchanged.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiPayout"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Payout successfully created.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiPayout"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "A payout may be invalid if the payments and refunds do not total the payout amount, if the referenced payment or refund ids have different values than those in the payout creation parameters, or if a negative net value payload is specified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/payouts/bulk": {
      "post": {
        "tags": [],
        "summary": "Bulk create payouts",
        "description": "Creates or updates multiple payouts for a business in a single request. This endpoint uses upsert semantics: if a payout with the same `external_id` already exists, it will be updated; otherwise, a new payout is created. The request will be rejected with a 400 error if any duplicate `external_id` values are present within the same request.",
        "operationId": "business.payouts.bulk.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create payouts for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CreatePayoutParams"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "All payouts were successfully created or updated.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiPayout"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request. This is returned when the request contains duplicate `external_id` values, or when a payout is invalid (e.g., payments and refunds do not total the payout amount, referenced payment or refund ids have different values than those in the creation parameters, or a negative net value payload is specified).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/payouts/{payoutId}": {
      "get": {
        "tags": [],
        "summary": "Fetch payout",
        "description": "Fetches a payout for a business.",
        "operationId": "business.payouts.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the payout for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "payoutId",
            "in": "path",
            "description": "The UUID of the payout to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "description": "If this flag is false or not included, requests will 404 if the payout with the given ID was deleted.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiPayout"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or payout id is not found. This indicates the business id is invalid or the business has been archived, or the payout id is invalid or the payout has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [],
        "summary": "Delete payout",
        "description": "Deletes a payout for a business. Ledger entries will be reversed but referenced payments and refunds will not be removed. To keep ledger entries most understandable, we recommend updating payouts rather than deleting and recreating when the intent is to fix or update information from the same payout.",
        "operationId": "business.payouts.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "payoutId",
            "in": "path",
            "description": "The UUID of the payout to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or payout id is not found. This indicates the business id is invalid or the business has been archived, or the payout id is invalid or the payout has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/payouts/{payoutId}/update": {
      "post": {
        "tags": [],
        "summary": "Update payout",
        "description": "Updates a payout for a business. Ledger entries will be reversed and new entries created for the updated payout. To keep ledger entries most understandable, we recommend updating payouts rather than deleting and recreating when the intent is to fix or update information from the same payout.",
        "operationId": "business.payouts.update",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update the payout for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "payoutId",
            "in": "path",
            "description": "The UUID of the payout to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdatePayoutParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiPayout"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or payout id is not found. This indicates the business id is invalid or the business has been archived, or the payout id is invalid or the payout has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/vendor-payouts": {
      "get": {
        "tags": [],
        "summary": "List vendor payouts",
        "description": "Fetches a list of vendor payouts for a business. Results will be paginated, see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.vendor-payouts.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch vendor payouts for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "Filter vendor payouts by external ID (unique idempotency key). This will always yield zero or one result.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo_contains",
            "in": "query",
            "description": "Filter vendor payouts by memo content. Returns vendor payouts where the memo contains this string (case-sensitive).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo_exact",
            "in": "query",
            "description": "Filter vendor payouts by exact memo match. Returns vendor payouts where the memo exactly matches this string.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "completed_at_start",
            "in": "query",
            "description": "Filter vendor payouts by completion date. Vendor payouts completed on or after this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "completed_at_end",
            "in": "query",
            "description": "Filter vendor payouts by completion date. Vendor payouts completed on or before this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "amount_min",
            "in": "query",
            "description": "Filter vendor payouts by minimum amount. Only vendor payouts with amounts greater than or equal to this value will be included.",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "amount_max",
            "in": "query",
            "description": "Filter vendor payouts by maximum amount. Only vendor payouts with amounts less than or equal to this value will be included.",
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter vendor payouts by. Only vendor payouts with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_matched",
            "in": "query",
            "description": "Filter vendor payouts by match status. If true, only matched vendor payouts will be returned. If false, only unmatched vendor payouts will be returned.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiVendorPayout"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create vendor payout",
        "description": "Creates a new vendor payout for a business or updates existing vendor payout. This endpoint is idempotent using the `external_id` field as the idempotency key, so subsequent requests with the same `external_id` will update or no-op.",
        "operationId": "business.vendor-payouts.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create a vendor payout for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVendorPayoutParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Vendor payout has been successfully updated or unchanged.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorPayout"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Vendor payout successfully created.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorPayout"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "A vendor payout may be invalid if the bill payments, vendor refund payments, and other transactions do not total the payout amount, if the referenced payment or refund ids have different values than those in the payout creation parameters, or if duplicate payments or refunds are specified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/vendor-payouts/{payoutId}": {
      "get": {
        "tags": [],
        "summary": "Fetch vendor payout",
        "description": "Fetches a vendor payout for a business.",
        "operationId": "business.vendor-payouts.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the vendor payout for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "payoutId",
            "in": "path",
            "description": "The UUID of the vendor payout to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorPayout"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update vendor payout",
        "description": "Updates a vendor payout for a business.",
        "operationId": "business.vendor-payouts.update",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update the vendor payout for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "payoutId",
            "in": "path",
            "description": "The UUID of the vendor payout to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateVendorPayoutParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorPayout"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [],
        "summary": "Delete vendor payout",
        "description": "Deletes a vendor payout for a business.",
        "operationId": "business.vendor-payouts.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "payoutId",
            "in": "path",
            "description": "The UUID of the vendor payout to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-journal-entries/": {
      "get": {
        "tags": [
          "Custom Journal Entries"
        ],
        "summary": "List custom journal entries",
        "description": "Returns a list of custom journal entries for the specified business. Entries can be filtered by date ranges and other parameters.",
        "operationId": "business.custom-journal-entries.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch custom journal entries for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "created_at_start_date",
            "in": "query",
            "description": "Filter entries by creation date. Entries created on or after this date will be included.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "created_at_end_date",
            "in": "query",
            "description": "Filter entries by creation date. Entries created on or before this date will be included.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "entry_at_start_date",
            "in": "query",
            "description": "Filter entries by entry date. Entries with an entry date on or after this date will be included.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "entry_at_end_date",
            "in": "query",
            "description": "Filter entries by entry date. Entries with an entry date on or before this date will be included.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "include_reversed",
            "in": "query",
            "description": "Whether to include reversed entries in the results.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "external_ids",
            "in": "query",
            "description": "Comma-separated list of external IDs to filter by.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter custom journal entries by. Only custom journal entries with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo",
            "in": "query",
            "description": "The exact memo text of the entries to fetch.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo_contains",
            "in": "query",
            "description": "A case-insensitive substring used to filter entries whose memo contains the specified value.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_matched",
            "in": "query",
            "description": "Filter custom journal entries by match status. If true, only matched entries will be returned. If false, only unmatched entries will be returned.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of custom journal entries.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiCustomJournalEntryWithEntry"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Custom Journal Entries"
        ],
        "summary": "Create custom journal entry",
        "description": "Creates a new custom journal entry for the specified business. The credits and debits must balance.",
        "operationId": "business.custom-journal-entries.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the custom journal entry for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomJournalEntry"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Entry already exists and matches provided data.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomJournalEntryWithEntry"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Custom journal entry created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomJournalEntryWithEntry"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/custom-journal-entries/bulk": {
      "post": {
        "tags": [
          "Custom Journal Entries"
        ],
        "summary": "Create multiple custom journal entries",
        "description": "Creates multiple custom journal entries in a single request.",
        "operationId": "business.custom-journal-entries.bulk.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the custom journal entries for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomJournalEntries"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Custom journal entries created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomJournalEntries"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/custom-journal-entries/{customJournalEntryId}": {
      "get": {
        "tags": [
          "Custom Journal Entries"
        ],
        "summary": "Fetch custom journal entry",
        "description": "Returns the custom journal entry associated with the provided ID.",
        "operationId": "business.custom-journal-entries.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the custom journal entry from.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customJournalEntryId",
            "in": "path",
            "description": "The UUID of the custom journal entry to fetch.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The custom journal entry.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomJournalEntryWithEntry"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Custom Journal Entries"
        ],
        "summary": "Update custom journal entry",
        "description": "Updates an existing custom journal entry. The credits and debits must balance.",
        "operationId": "business.custom-journal-entries.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the custom journal entry belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customJournalEntryId",
            "in": "path",
            "description": "The UUID of the custom journal entry to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomJournalEntry"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Custom journal entry updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomJournalEntryWithEntry"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Custom Journal Entries"
        ],
        "summary": "Reverse custom journal entry",
        "description": "Creates a reversal entry for a custom journal entry, cancelling it out and setting its `reversed_at` date.",
        "operationId": "business.custom-journal-entries.reverse",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business the custom journal entry belongs to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customJournalEntryId",
            "in": "path",
            "description": "The UUID of the custom journal entry to reverse.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Custom journal entry reversed successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomJournalEntryWithEntry"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/tasks": {
      "get": {
        "tags": [],
        "summary": "List tasks",
        "description": "Fetches a list of tasks for a business. Tasks only exist for businesses enrolled in bookkeeping services, and task lifecycle management is handled by Layer's bookkeeping team.",
        "operationId": "business.tasks.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch tasks for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_archived",
            "in": "query",
            "description": "Include archived tasks in the response.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBusinessTask"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tasks/{taskId}": {
      "get": {
        "tags": [],
        "summary": "Fetch task",
        "description": "Fetches a task for a business. Tasks only exist for businesses enrolled in bookkeeping services, and task lifecycle management is handled by Layer's bookkeeping team.",
        "operationId": "business.tasks.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch tasks for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "taskId",
            "in": "path",
            "description": "The UUID of the task to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusinessTask"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or task id is not found. This indicates the business id is invalid or the business has been archived, or the task id is invalid or the task has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tasks/{taskId}/user-response": {
      "post": {
        "tags": [],
        "summary": "Submit task response",
        "description": "Submits or updates a task user response for a business. Tasks only exist for businesses enrolled in bookkeeping services, and task lifecycle management is handled by Layer's bookkeeping team. This endpoint is used by Layer's `<Tasks>` component to submit user responses, and if you use embedded components, you should not need to call this endpoint directly.",
        "operationId": "business.tasks.user-response.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "taskId",
            "in": "path",
            "description": "The UUID of the task to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiBusinessTaskUserResponse"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusinessTask"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid task response type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id or task id is not found. This indicates the business id is invalid or the business has been archived, or the task id is invalid or the task has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tasks/{taskId}/mark-user-completed": {
      "post": {
        "tags": [],
        "summary": "Mark task completed",
        "description": "Marks a task as completed by the user. Tasks only exist for businesses enrolled in bookkeeping services, and task lifecycle management is handled by Layer's bookkeeping team. This endpoint is used by Layer's `<Tasks>` component to mark tasks as user completed, and if you use embedded components, you should not need to call this endpoint directly.",
        "operationId": "business.tasks.mark-user-completed.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "taskId",
            "in": "path",
            "description": "The UUID of the task to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusinessTask"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or task id is not found. This indicates the business id is invalid or the business has been archived, or the task id is invalid or the task has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/auth-token": {
      "get": {
        "tags": [],
        "summary": "Fetch business auth token",
        "description": "Fetches a new auth token scoped to the specified business. The business auth token is used to authenticate Layer API requests from client-side applications. Note the return type is an AuthToken object rather than a standard Layer API response object.",
        "operationId": "business.auth-token.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch a business-scoped auth token for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthToken"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create business auth token",
        "description": "Creates a new auth token scoped to the specified business. The business auth token is used to authenticate Layer API requests from client-side applications. Note the return type is an AuthToken object rather than a standard Layer API response object.",
        "operationId": "business.auth-token.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create a business-scoped auth token for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewBusinessAuthTokenParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthToken"
                }
              }
            }
          },
          "400": {
            "description": "Invalid auth token creation parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/invoices/refunds": {
      "get": {
        "tags": [],
        "summary": "List refunds",
        "description": "Fetches a list of refunds for a business. Refunds can be filtered by external ID, status, completion date range, amount range, customer, and payout inclusion. Results will be paginated, see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.invoices.refunds.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch refunds for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "Filter refunds by external ID (unique idempotency key). This will always yield zero or one result.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Filter refunds by status.",
            "schema": {
              "type": "string",
              "enum": [
                "SENT",
                "PARTIALLY_PAID",
                "PAID"
              ]
            }
          },
          {
            "name": "completed_at_start",
            "in": "query",
            "description": "Filter refunds by completion date. Refunds completed on or after this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "completed_at_end",
            "in": "query",
            "description": "Filter refunds by completion date. Refunds completed on or before this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "is_dedicated",
            "in": "query",
            "description": "Filter refunds by whether they are dedicated to a single target.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "included_in_payout",
            "in": "query",
            "description": "Filter refunds by whether they are included in a payout. Set to `true` to show only refunds that are part of a payout, `false` to show only refunds not in any payout.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "min_amount",
            "in": "query",
            "description": "Filter refunds by minimum amount. Only refunds with amounts greater than or equal to this value will be included. Must be a positive integer.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "max_amount",
            "in": "query",
            "description": "Filter refunds by maximum amount. Only refunds with amounts less than or equal to this value will be included. Must be a positive integer.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter refunds by. Only refunds with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "UUID of the customer to filter refunds by. Returns refunds with at least one allocation to this customer.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customer_external_id",
            "in": "query",
            "description": "External ID of the customer to filter refunds by. Returns refunds with at least one allocation to this customer.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiRefund"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create refund",
        "description": "Creates a new refund for a business or updates existing refund. This endpoint is idempotent using the `external_id` field as the idempotency key, so subsequent requests with the same `external_id` will update or no-op.",
        "operationId": "business.invoices.refunds.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create a refund for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SimpleCustomerRefundCreateParams",
                    "title": "Simple Refund"
                  },
                  {
                    "$ref": "#/components/schemas/ItemizedCustomerRefundCreateParams",
                    "title": "Itemized Refund"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Refund has been successfully updated or unchanged.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Refund successfully created.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "A refund may be invalid if the payment does not exist, if the refund amount is greater than the payment amount, if the referenced payment id has a different value than that in the refund creation parameters, or if a negative net value payload is specified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/refunds/bulk": {
      "post": {
        "tags": [],
        "summary": "Bulk create refunds",
        "description": "Creates multiple refunds for a business in a single request. This endpoint is idempotent using the `external_id` field as the idempotency key for each refund.",
        "operationId": "business.invoices.refunds.bulk.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create refunds for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/SimpleCustomerRefundCreateParams",
                      "title": "Simple Refund"
                    },
                    {
                      "$ref": "#/components/schemas/ItemizedCustomerRefundCreateParams",
                      "title": "Itemized Refund"
                    }
                  ]
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Refunds created or updated successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiRefund"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "One or more refunds are invalid. The entire batch will be rolled back if any refund fails validation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/refunds/{refundId}": {
      "get": {
        "tags": [],
        "summary": "Fetch refund",
        "description": "Fetches a refund for a business.",
        "operationId": "business.invoices.refunds.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch refunds for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the refund to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or refund id is not found. This indicates the business id is invalid or the business has been archived, or the refund id is invalid or the refund has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update refund",
        "description": "Fully replaces an existing refund. All allocations and payments will be replaced with the new values provided. This will reverse any existing ledger entries and create new ones based on the updated refund data.",
        "operationId": "business.invoices.refunds.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update the refund for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the refund to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ItemizedCustomerRefundCreateParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Refund updated successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid refund parameters. This may occur if allocations reference invalid targets, amounts don't balance, or other validation errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id or refund id is not found. This indicates the business id is invalid or the business has been archived, or the refund id is invalid or the refund has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [],
        "summary": "Patch refund",
        "description": "Partially updates an existing refund. Only the fields provided will be updated. If allocations or payments are provided, they will fully replace the existing allocations or payments respectively, and ledger entries will be reversed and recreated.",
        "operationId": "business.invoices.refunds.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update the refund for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the refund to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchCustomerRefundParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Refund updated successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid refund parameters. This may occur if allocations reference invalid targets, amounts don't balance, or other validation errors.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id or refund id is not found. This indicates the business id is invalid or the business has been archived, or the refund id is invalid or the refund has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [],
        "summary": "Delete refund",
        "description": "Deletes a refund for a business.",
        "operationId": "business.invoices.refunds.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to delete refund for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the refund to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Refund successfully deleted.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bills/refunds": {
      "get": {
        "tags": [
          "Vendor Refunds"
        ],
        "summary": "List vendor refunds",
        "description": "Fetches a list of vendor refunds for a business. Vendor refunds can be filtered by external ID, status, completion date range, amount range, and vendor. Results will be paginated, see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.bills.refunds.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch vendor refunds for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "Filter vendor refunds by external ID (unique idempotency key). This will always yield zero or one result.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Filter vendor refunds by status.",
            "schema": {
              "type": "string",
              "enum": [
                "SENT",
                "PARTIALLY_PAID",
                "PAID"
              ]
            }
          },
          {
            "name": "completed_at_start",
            "in": "query",
            "description": "Filter vendor refunds by completion date. Vendor refunds completed on or after this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "completed_at_end",
            "in": "query",
            "description": "Filter vendor refunds by completion date. Vendor refunds completed on or before this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "min_amount",
            "in": "query",
            "description": "Filter vendor refunds by minimum amount. Only vendor refunds with amounts greater than or equal to this value will be included. Must be a positive integer.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "max_amount",
            "in": "query",
            "description": "Filter vendor refunds by maximum amount. Only vendor refunds with amounts less than or equal to this value will be included. Must be a positive integer.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter vendor refunds by. Only vendor refunds with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "vendor_id",
            "in": "query",
            "description": "UUID of the vendor to filter vendor refunds by. Returns vendor refunds with at least one allocation to this vendor.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vendor_external_id",
            "in": "query",
            "description": "External ID of the vendor to filter vendor refunds by. Returns vendor refunds with at least one allocation to this vendor.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of vendor refunds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiVendorRefund"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "Vendor Refunds"
        ],
        "summary": "Create vendor refund",
        "description": "Creates a new vendor refund for a business or updates existing vendor refund. This endpoint is idempotent using the `external_id` field as the idempotency key, so subsequent requests with the same `external_id` will update or no-op.",
        "operationId": "business.bills.refunds.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create a vendor refund for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/SimpleVendorRefundCreateParams"
                  },
                  {
                    "$ref": "#/components/schemas/ItemizedVendorRefundCreateParams"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Vendor refund has been successfully updated or unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Vendor refund successfully created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "A vendor refund may be invalid if the bill does not exist, if the refund amount is greater than the bill amount, if the referenced bill id has a different value than that in the vendor refund creation parameters, or if a negative net value payload is specified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/refunds/{refundId}": {
      "get": {
        "tags": [
          "Vendor Refunds"
        ],
        "summary": "Fetch vendor refund",
        "description": "Fetches a vendor refund for a business.",
        "operationId": "business.bills.refunds.refund.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch vendor refunds for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the vendor refund to fetch.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Vendor refund details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or vendor refund id is not found. This indicates the business id is invalid or the business has been archived, or the vendor refund id is invalid or the vendor refund has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Vendor Refunds"
        ],
        "summary": "Update vendor refund",
        "description": "Fully replaces an existing vendor refund. All allocations and payments will be replaced with the new values provided. This will reverse any existing ledger entries and create new ones based on the updated refund data.",
        "operationId": "business.bills.refunds.refund.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update the vendor refund for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the vendor refund to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ItemizedVendorRefundCreateParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Vendor refund updated successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [
          "Vendor Refunds"
        ],
        "summary": "Patch vendor refund",
        "description": "Partially updates an existing vendor refund. Only the fields provided will be updated. If allocations or payments are provided, they will fully replace the existing allocations or payments respectively, and ledger entries will be reversed and recreated.",
        "operationId": "business.bills.refunds.refund.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update the vendor refund for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the vendor refund to update.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchVendorRefundParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Vendor refund updated successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [
          "Vendor Refunds"
        ],
        "summary": "Delete vendor refund",
        "description": "Deletes a vendor refund for a business.",
        "operationId": "business.bills.refunds.refund.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to delete vendor refund for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the vendor refund to delete.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Vendor refund successfully deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or vendor refund id is not found. This indicates the business id is invalid or the business has been archived, or the vendor refund id is invalid or the vendor refund has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/refunds/payments": {
      "get": {
        "tags": [],
        "summary": "List refund payments",
        "description": "Fetches a list of customer refund payments for a business. Results can be filtered by various criteria and will be paginated, see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.invoices.refunds.payments.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch refund payments for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "Filter refund payments by external ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "completed_at_start",
            "in": "query",
            "description": "Filter refund payments by completion date. Payments completed on or after this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "completed_at_end",
            "in": "query",
            "description": "Filter refund payments by completion date. Payments completed on or before this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "method",
            "in": "query",
            "description": "Filter refund payments by payment method.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "processor",
            "in": "query",
            "description": "Filter refund payments by processor.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_amount",
            "in": "query",
            "description": "Filter refund payments by minimum amount. Only payments with amounts greater than or equal to this value will be included.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "max_amount",
            "in": "query",
            "description": "Filter refund payments by maximum amount. Only payments with amounts less than or equal to this value will be included.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "included_in_payout",
            "in": "query",
            "description": "Filter refund payments by whether they are included in a payout.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "is_matched",
            "in": "query",
            "description": "Filter refund payments by whether they are matched to a bank transaction.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter refund payments by.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of refund payments.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiRefundPayment"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/refunds/{refundId}/payments": {
      "post": {
        "tags": [],
        "summary": "Create refund payment",
        "description": "Creates a new payment for a customer refund. This endpoint is idempotent using the `external_id` field as the idempotency key, so subsequent requests with the same `external_id` will no-op.",
        "operationId": "business.invoices.refunds.payments.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create a refund payment for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the refund to create a payment for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCustomerRefundPaymentParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Refund payment has been successfully updated or unchanged.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiRefundPayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Refund payment successfully created.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiRefundPayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/refunds/payments/{paymentId}": {
      "get": {
        "tags": [],
        "summary": "Fetch refund payment",
        "description": "Fetches a specific refund payment by ID.",
        "operationId": "business.invoices.refunds.payments.payment.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the refund payment for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the refund payment to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Refund payment details.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiRefundPayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or refund payment not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [],
        "summary": "Delete refund payment",
        "description": "Deletes a refund payment by ID.",
        "operationId": "business.invoices.refunds.payments.payment.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to delete the refund payment for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the refund payment to delete.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Refund payment successfully deleted.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or refund payment not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/ar-aging": {
      "get": {
        "tags": [],
        "summary": "Fetch AR aging report",
        "description": "Returns an accounts receivable aging report showing outstanding invoices grouped by customer and aging buckets. This report helps track overdue payments and manage cash flow.",
        "operationId": "business.invoices.ar-aging.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the AR aging report for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "AR aging report retrieved successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ARAgingReport"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/invoices/ar-aging/customer/{customerId}": {
      "get": {
        "tags": [],
        "summary": "Fetch AR aging detail for a customer",
        "description": "Returns detailed accounts receivable aging information for a specific customer, including outstanding balances broken down by aging buckets (current, 1-30 days, 31-60 days, 61-90 days, 91+ days).",
        "operationId": "business.invoices.ar-aging.customer.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch the AR aging detail for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customerId",
            "in": "path",
            "description": "The UUID of the customer to fetch AR aging detail for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "AR aging customer detail retrieved successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ARAgingCustomerDetailResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or customer not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bills/refunds/payments": {
      "get": {
        "tags": [
          "Vendor Refunds"
        ],
        "summary": "List vendor refund payments",
        "description": "Fetches a list of vendor refund payments for a business. Results will be paginated, see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.bills.refunds.payments.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch vendor refund payments for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "external_id",
            "in": "query",
            "description": "Filter vendor refund payments by external ID (unique idempotency key). This will always yield zero or one result.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "completed_at_start",
            "in": "query",
            "description": "Filter vendor refund payments by completion date. Payments completed on or after this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "completed_at_end",
            "in": "query",
            "description": "Filter vendor refund payments by completion date. Payments completed on or before this date will be included. ISO 8601 date format.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "method",
            "in": "query",
            "description": "Filter vendor refund payments by payment method. Supported values are `CASH`, `CHECK`, `CREDIT_CARD`, `ACH`, `CREDIT_BALANCE`, `OTHER`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "processor",
            "in": "query",
            "description": "Filter vendor refund payments by payment processor (e.g. STRIPE, etc.).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_amount",
            "in": "query",
            "description": "Filter vendor refund payments by minimum amount. Only payments with amounts greater than or equal to this value will be included. Must be a positive integer.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "max_amount",
            "in": "query",
            "description": "Filter vendor refund payments by maximum amount. Only payments with amounts less than or equal to this value will be included. Must be a positive integer.",
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "memo_contains",
            "in": "query",
            "description": "Filter vendor refund payments by memo content. Returns payments where the memo contains this string (case-sensitive).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "memo",
            "in": "query",
            "description": "Filter vendor refund payments by exact memo match. Returns payments where the memo exactly matches this string.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_number",
            "in": "query",
            "description": "Filter by exact reference number match. Returns only records with this exact reference number.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference_numbers",
            "in": "query",
            "description": "Comma-separated list of reference numbers to filter vendor refund payments by. Only vendor refund payments with reference numbers matching any value in this list will be returned.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "included_in_payout",
            "in": "query",
            "description": "Filter vendor refund payments by whether they are included in a vendor payout. Set to `true` to show only payments that are part of a payout, `false` to show only payments not in any payout.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "is_matched",
            "in": "query",
            "description": "Filter vendor refund payments by match status. If true, only matched payments will be returned. If false, only unmatched payments will be returned. Vendor refund payments are considered matched if they are matched directly, or if they are included in a vendor payout that is matched.",
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of vendor refund payments.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiVendorRefundPayment"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/refunds/{refundId}/payments": {
      "get": {
        "tags": [
          "Vendor Refunds"
        ],
        "summary": "List payments for vendor refund",
        "description": "Fetches a list of payments for a specific vendor refund.",
        "operationId": "business.bills.refunds.refund.payments.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the vendor refund to fetch payments for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of payments for the vendor refund.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiVendorRefundPayment"
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Business or vendor refund not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [
          "Vendor Refunds"
        ],
        "summary": "Create vendor refund payment",
        "description": "Creates a new payment for a vendor refund. This endpoint is idempotent using the `external_id` field as the idempotency key, so subsequent requests with the same `external_id` will no-op.",
        "operationId": "business.bills.refunds.payments.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create a vendor refund payment for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the vendor refund to create a payment for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVendorRefundPaymentParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Vendor refund payment has been successfully updated or unchanged.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorRefundPayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Vendor refund payment successfully created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorRefundPayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bills/refunds/{refundId}/payments/{paymentId}": {
      "get": {
        "tags": [
          "Vendor Refunds"
        ],
        "summary": "Fetch vendor refund payment",
        "description": "Fetches a specific payment for a vendor refund.",
        "operationId": "business.bills.refunds.payments.payment.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch vendor refund payment for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the vendor refund to fetch payment for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the payment to fetch.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Vendor refund payment details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVendorRefundPayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Vendor Refunds"
        ],
        "summary": "Delete vendor refund payment",
        "description": "Deletes a payment for a vendor refund.",
        "operationId": "business.bills.refunds.payments.payment.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to delete vendor refund payment for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "refundId",
            "in": "path",
            "description": "The UUID of the vendor refund to delete payment for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the payment to delete.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Vendor refund payment successfully deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/external-accounts": {
      "get": {
        "tags": [],
        "summary": "List external accounts",
        "description": "Fetches a list of external accounts for a business. External accounts represent all connected financial accounts, including bank accounts, credit cards, loans, etc.",
        "operationId": "business.external-accounts.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch external accounts for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiExternalAccount"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/external-accounts/{externalAccountId}": {
      "get": {
        "tags": [],
        "summary": "Fetch external account",
        "description": "Fetches an external account for a business. External accounts represent all connected financial accounts, including bank accounts, credit cards, loans, etc.",
        "operationId": "business.external-accounts.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch external accounts for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "externalAccountId",
            "in": "path",
            "description": "The UUID of the external account to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiExternalAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or external account id is not found. This indicates the business id is invalid or the business has been archived, or the external account id is invalid or the external account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/external-accounts/{externalAccountId}/transactions": {
      "get": {
        "tags": [],
        "summary": "List transactions",
        "description": "Fetches a list of transactions for an external account.",
        "operationId": "business.external-accounts.transactions.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch transactions for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "externalAccountId",
            "in": "path",
            "description": "The UUID of the external account to fetch transactions for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "The start date of the transaction range to fetch.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "The end date of the transaction range to fetch.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTransactions"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or external account id is not found. This indicates the business id is invalid or the business has been archived, or the external account id is invalid or the external account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/external-accounts/{externalAccountId}/opening-balance": {
      "get": {
        "tags": [],
        "summary": "Fetch opening balance",
        "description": "Fetches the opening balance for an external account. This is useful when verifying or reconciling the historical balance sheet.",
        "operationId": "business.external-accounts.opening-balance.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch opening balance for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "externalAccountId",
            "in": "path",
            "description": "The UUID of the external account to fetch opening balance for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiOpeningBalance"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or external account id is not found. This indicates the business id is invalid or the business has been archived, or the external account id is invalid or the external account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create or update opening balance",
        "description": "Creates or updates the opening balance for an external account. This is useful for setting the initial balance when starting to track an account.",
        "operationId": "business.external-accounts.opening-balance.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create opening balance for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "externalAccountId",
            "in": "path",
            "description": "The UUID of the external account to create opening balance for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OpeningBalanceInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Opening balance created or updated successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiOpeningBalance"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters or opening balance data.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id or external account id is not found. This indicates the business id is invalid or the business has been archived, or the external account id is invalid or the external account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [],
        "summary": "Delete opening balance",
        "description": "Deletes the opening balance for an external account.",
        "operationId": "business.external-accounts.opening-balance.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "externalAccountId",
            "in": "path",
            "description": "The UUID of the external account to delete opening balance for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Opening balance deleted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business, external account, or opening balance not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/external-accounts/{externalAccountId}/archive": {
      "post": {
        "tags": [],
        "summary": "Archive external account",
        "description": "Archives an external account for a business. This action will prevent the account from syncing new transactions and will remove the account from the Layer dashboard. Past synced transactions will remain.",
        "operationId": "business.external-accounts.archive.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to archive external account for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "externalAccountId",
            "in": "path",
            "description": "The UUID of the external account to archive.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "External account archived successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or external account id is not found. This indicates the business id is invalid or the business has been archived, or the external account id is invalid or the external account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/external-accounts/{externalAccountId}/transaction-date-range": {
      "put": {
        "tags": [],
        "summary": "Update transaction date range",
        "description": "Updates the visible transaction date range for an external account. Use this endpoint to limit which transactions are shown from this account based on their date.\n\nWhen the date range is tightened (start date moved forward or end date moved backward), any categorized transactions that now fall outside the new bounds are automatically uncategorized. This ensures that hidden transactions don't contribute to financial reports.\n\nSet either field to `null` to remove that bound. For example, setting `show_transactions_on_or_after` to `null` will show all transactions after the business's activation_at date.",
        "operationId": "business.external-accounts.transaction-date-range.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business that owns the external account.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "externalAccountId",
            "in": "path",
            "description": "The UUID of the external account to update the date range for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateTransactionDateRangeParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Transaction date range updated successfully. Returns the updated external account.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiExternalAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or external account not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/external-accounts/{externalAccountId}/uncategorize-and-archive": {
      "post": {
        "tags": [],
        "summary": "Uncategorize and archive external account",
        "description": "Uncategorizes all transactions and archives an external account. This purges the account by reverting all transaction categorizations and then archiving the account. The account will no longer sync new transactions and will be removed from the Layer dashboard.",
        "operationId": "business.external-accounts.uncategorize-and-archive.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "externalAccountId",
            "in": "path",
            "description": "The UUID of the external account to uncategorize and archive.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "External account uncategorized and archived successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/external-accounts/{externalAccountId}/confirm": {
      "post": {
        "tags": [],
        "summary": "Confirm external account",
        "description": "Confirms an external account as relevant and/or unique. This is used to resolve account confirmation notifications.",
        "operationId": "business.external-accounts.confirm.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to confirm external account for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "externalAccountId",
            "in": "path",
            "description": "The UUID of the external account to confirm.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalAccountConfirmOptions"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "External account confirmed successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid confirmation options. An account must be marked relevant and/or unique.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id or external account id is not found. This indicates the business id is invalid or the business has been archived, or the external account id is invalid or the external account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/external-accounts/{externalAccountId}/exclude": {
      "post": {
        "tags": [],
        "summary": "Exclude external account",
        "description": "Excludes an external account as irrelevant and/or duplicate. This is used to resolve account exclusion notifications.",
        "operationId": "business.external-accounts.exclude.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to exclude external account for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "externalAccountId",
            "in": "path",
            "description": "The UUID of the external account to exclude.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExternalAccountExcludeOptions"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "External account excluded successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid exclusion options. An account must be marked irrelevant and/or duplicate.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id or external account id is not found. This indicates the business id is invalid or the business has been archived, or the external account id is invalid or the external account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/": {
      "get": {
        "tags": [],
        "summary": "List custom accounts",
        "description": "Fetches a list of custom accounts for a business. Custom accounts offer platforms direct control over bank account data and should be used for accounts operated directly by the platform.",
        "operationId": "business.custom-accounts.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch custom accounts for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiCustomAccount"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create custom account",
        "description": "Creates a custom account for a business. Custom accounts offer platforms direct control over bank account data and should be used for accounts operated directly by the platform.",
        "operationId": "business.custom-accounts.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create custom account for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewCustomAccountParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "409": {
            "description": "Custom account already exists for the business.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "Account creation failure, which should only occur if bank account support is not enabled for your platform. Reach out to Layer support for assistance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/{customAccountId}": {
      "get": {
        "tags": [],
        "summary": "Fetch custom account",
        "description": "Fetches a custom account for a business. Custom accounts offer platforms direct control over bank account data and should be used for accounts operated directly by the platform.",
        "operationId": "business.custom-accounts.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch custom account for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or custom account id is not found. This indicates the business id is invalid or the business has been archived, or the custom account id is invalid or the custom account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [],
        "summary": "Patch custom account",
        "description": "Updates a custom account for a business. Patch style update will only change specified fields.",
        "operationId": "business.custom-accounts.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update custom account for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateCustomAccountParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or custom account id is not found. This indicates the business id is invalid or the business has been archived, or the custom account id is invalid or the custom account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Update custom account",
        "description": "Updates a custom account for a business. Put style update will replace all fields.",
        "operationId": "business.custom-accounts.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update custom account for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account to update.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewCustomAccountParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or custom account id is not found. This indicates the business id is invalid or the business has been archived, or the custom account id is invalid or the custom account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/{customAccountId}/archive": {
      "post": {
        "tags": [],
        "summary": "Archive custom account",
        "description": "Archives a custom account for a business. This action will prevent the account from syncing new transactions and will remove the account from the Layer dashboard. Previously imported transactions will remain. Archiving can be reversed with the `reactivate` endpoint.",
        "operationId": "business.custom-accounts.archive.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to archive custom account for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account to archive.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or custom account id is not found. This indicates the business id is invalid or the business has been archived, or the custom account id is invalid or the custom account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/{customAccountId}/reactivate": {
      "post": {
        "tags": [],
        "summary": "Reactivate custom account",
        "description": "Reactivates a custom account for a business. This action will allow the account to sync new transactions and will add the account back to the Layer dashboard.",
        "operationId": "business.custom-accounts.reactivate.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to reactivate custom account for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account to reactivate.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCustomAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or custom account id is not found. This indicates the business id is invalid or the business has been archived, or the custom account id is invalid or the custom account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/{customAccountId}/transactions": {
      "post": {
        "tags": [],
        "summary": "Import transactions",
        "description": "Imports transactions for a custom account. This action will import transactions from the specified start date to the present. If the account has already been imported, this action will overwrite the existing transactions.",
        "operationId": "business.custom-accounts.transactions.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to import transactions for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account to import transactions for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewCustomTransactions"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Transaction creation failure. This is most commonly due to invalid transaction data, such incorrect enum values or negative transaction amounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id or custom account id is not found. This indicates the business id is invalid or the business has been archived, or the custom account id is invalid or the custom account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/{customAccountId}/transactions/record": {
      "post": {
        "tags": [],
        "summary": "Record custom account transaction",
        "description": "Record a one-off expense from a personal account or another transaction not recorded in an existing bank feed. Receipts can be included.",
        "operationId": "business.custom-accounts.transactions.record.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account to record the transaction on.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["transaction"],
                "properties": {
                  "transaction": {
                    "type": "object",
                    "description": "Transaction details sent as JSON in the transaction multipart field.",
                    "required": ["amount", "direction", "date", "description"],
                    "properties": {
                      "external_id": {
                        "type": "string",
                        "description": "Unique external identifier for the transaction."
                      },
                      "amount": {
                        "type": "integer",
                        "format": "int64",
                        "description": "Transaction amount in cents."
                      },
                      "direction": { "$ref": "#/components/schemas/BankTransactionDirection" },
                      "date": {
                        "type": "string",
                        "description": "Transaction date as YYYY-MM-DD or an ISO 8601 timestamp."
                      },
                      "description": {
                        "type": "string",
                        "description": "Description of the transaction."
                      },
                      "merchant_name": { "type": "string", "nullable": true },
                      "customer_id": { "type": "string", "format": "uuid", "nullable": true },
                      "customer_external_id": { "type": "string", "nullable": true },
                      "vendor_id": { "type": "string", "format": "uuid", "nullable": true },
                      "vendor_external_id": { "type": "string", "nullable": true },
                      "categorization": { "$ref": "#/components/schemas/Category" },
                      "memo": { "type": "string", "nullable": true },
                      "metadata": { "$ref": "#/components/schemas/PlatformDefinedJson" },
                      "reference_number": { "type": "string", "nullable": true },
                      "tags": {
                        "type": "array",
                        "items": { "$ref": "#/components/schemas/TagKeyValue" }
                      }
                    }
                  },
                  "files": {
                    "type": "array",
                    "description": "Optional receipt files (up to five); each file must have a unique filename.",
                    "items": { "type": "string", "format": "binary" }
                  }
                }
              },
              "encoding": {
                "transaction": { "contentType": "application/json" }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Transaction created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "data": { "$ref": "#/components/schemas/ApiBankTransaction" } },
                  "required": ["data"]
                }
              }
            }
          },
          "200": {
            "description": "An existing transaction with the same external_id was returned.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "data": { "$ref": "#/components/schemas/ApiBankTransaction" } },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid transaction or multipart request.",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } }
            }
          },
          "404": {
            "description": "Business or custom account not found.",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/{customAccountId}/transactions/{transactionId}": {
      "patch": {
        "tags": [],
        "summary": "Update custom account transaction",
        "description": "Update a transaction on a custom account. To manage receipts, use the recorded-transaction PATCH endpoint.",
        "operationId": "business.custom-accounts.transactions.transaction.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account containing the transaction.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the transaction to update.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "amount": { "type": "integer", "format": "int64", "description": "Transaction amount in cents." },
                  "direction": { "$ref": "#/components/schemas/BankTransactionDirection" },
                  "date": { "type": "string", "description": "Transaction date as YYYY-MM-DD or an ISO 8601 timestamp." },
                  "description": { "type": "string" },
                  "merchant_name": { "type": "string", "nullable": true },
                  "memo": { "type": "string", "nullable": true },
                  "metadata": { "$ref": "#/components/schemas/PlatformDefinedJson" },
                  "reference_number": { "type": "string", "nullable": true },
                  "customer_id": { "type": "string", "format": "uuid", "nullable": true },
                  "customer_external_id": { "type": "string", "nullable": true },
                  "vendor_id": { "type": "string", "format": "uuid", "nullable": true },
                  "vendor_external_id": { "type": "string", "nullable": true },
                  "categorization": { "$ref": "#/components/schemas/Category" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated transaction.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "data": { "$ref": "#/components/schemas/ApiBankTransactionDataOnly" } },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid transaction update.",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } }
            }
          },
          "404": {
            "description": "Business, custom account, or transaction not found.",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/{customAccountId}/transactions/{transactionId}/record": {
      "patch": {
        "tags": [],
        "summary": "Update recorded transaction",
        "description": "Update a one-off expense or another transaction not recorded in an existing bank feed. Receipts can be included.",
        "operationId": "business.custom-accounts.transactions.transaction.record.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account containing the transaction.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "The UUID of the recorded transaction to update.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Provide at least one transaction field, document_ids, tags, or receipt file.",
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "minProperties": 1,
                "properties": {
                  "transaction": {
                    "type": "object",
                    "minProperties": 1,
                    "description": "Fields to update, sent as JSON in the transaction multipart field. Omitted fields are unchanged.",
                    "properties": {
                      "amount": { "type": "integer", "format": "int64", "description": "Transaction amount in cents." },
                      "direction": { "$ref": "#/components/schemas/BankTransactionDirection" },
                      "date": { "type": "string", "description": "Transaction date as YYYY-MM-DD or an ISO 8601 timestamp." },
                      "description": { "type": "string" },
                      "merchant_name": { "type": "string", "nullable": true },
                      "memo": { "type": "string", "nullable": true },
                      "metadata": { "$ref": "#/components/schemas/PlatformDefinedJson" },
                      "reference_number": { "type": "string", "nullable": true },
                      "customer_id": { "type": "string", "format": "uuid", "nullable": true },
                      "customer_external_id": { "type": "string", "nullable": true },
                      "vendor_id": { "type": "string", "format": "uuid", "nullable": true },
                      "vendor_external_id": { "type": "string", "nullable": true },
                      "categorization": { "$ref": "#/components/schemas/Category" },
                      "document_ids": {
                        "type": "array",
                        "description": "Existing receipt document IDs to keep; existing documents not listed are archived.",
                        "items": { "type": "string", "format": "uuid" }
                      },
                      "tags": {
                        "type": "array",
                        "items": { "$ref": "#/components/schemas/TagKeyValue" }
                      }
                    }
                  },
                  "files": {
                    "type": "array",
                    "minItems": 1,
                    "description": "Optional new receipt files (up to five); each file must have a unique filename.",
                    "items": { "type": "string", "format": "binary" }
                  }
                }
              },
              "encoding": {
                "transaction": { "contentType": "application/json" }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated transaction.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "data": { "$ref": "#/components/schemas/ApiBankTransaction" } },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid transaction or multipart request.",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } }
            }
          },
          "404": {
            "description": "Business, custom account, or recorded transaction not found.",
            "content": {
              "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/{customAccountId}/csv-upload": {
      "post": {
        "tags": [],
        "summary": "Import transactions from CSV",
        "description": "Imports transactions for a custom account via CSV.",
        "operationId": "business.custom-accounts.csv-upload.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to import transactions for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account to import transactions for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to multipart/form-data.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The document file."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Transaction creation failure. This is most commonly due to invalid transaction data, such incorrect enum values or negative transaction amounts.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id or custom account id is not found. This indicates the business id is invalid or the business has been archived, or the custom account id is invalid or the custom account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/{customAccountId}/bank-statement-import": {
      "post": {
        "tags": [],
        "summary": "Import bank statement",
        "description": "Upload one PDF bank statement. The bookkeeping period must be monthly. Only posted transactions are imported after statement validation succeeds.",
        "operationId": "business.custom-accounts.bank-statement-import.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account.",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "One PDF bank statement (up to 10 MB). Send it in the `file` field."
                  },
                  "import": {
                    "type": "object",
                    "description": "Import details sent as JSON in the `import` multipart field.",
                    "properties": {
                      "bookkeeping_period_id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "The UUID of a monthly bookkeeping period."
                      }
                    },
                    "required": ["bookkeeping_period_id"]
                  }
                },
                "required": ["file", "import"]
              },
              "encoding": {
                "import": { "contentType": "application/json" }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Statement imported and posted transactions created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": { "$ref": "#/components/schemas/BankStatementImportResult" }
                  },
                  "required": ["data"]
                }
              }
            }
          },
          "400": {
            "description": "Invalid multipart request, PDF parsing failure, duplicate statement, or failed statement validation. Validation errors include the parsed statement and checks in error metadata.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ApiError" }
              }
            }
          },
          "404": {
            "description": "Business, custom account, or bookkeeping period not found.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ApiError" }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/{customAccountId}/opening-balance": {
      "post": {
        "tags": [],
        "summary": "Recalculate opening balance",
        "description": "Overwrite the opening balance of the account based on the current balance and the transaction history. This is useful when configuring the account for the first time or when accounting features are enabled starting at a time after the account was created and should be done after explicitly setting the account balance via the **set opening balance** endpoint.",
        "operationId": "business.custom-accounts.opening-balance.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to set opening balance for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account to set opening balance for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiOpeningBalance"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or custom account id is not found. This indicates the business id is invalid or the business has been archived, or the custom account id is invalid or the custom account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/custom-accounts/{customAccountId}/balance": {
      "post": {
        "tags": [],
        "summary": "Set opening balance",
        "description": "Sets the balance of the account at a specific time, which is necessary for showing both a current balance and a correct opening balance. This is useful when configuring the account for the first time or when accounting features are enabled starting at a time after the account was created.",
        "operationId": "business.custom-accounts.balance.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to set opening balance for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customAccountId",
            "in": "path",
            "description": "The UUID of the custom account to set opening balance for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewCustomAccountBalance"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or custom account id is not found. This indicates the business id is invalid or the business has been archived, or the custom account id is invalid or the custom account has been deleted.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/transaction-uploads": {
      "get": {
        "tags": [],
        "summary": "List transaction uploads",
        "description": "Returns a list of transaction uploads for the business. Transaction uploads represent batches of transactions that were imported into custom accounts via CSV or JSON upload.",
        "operationId": "business.transaction-uploads.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to list transaction uploads for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "custom_account_id",
            "in": "query",
            "description": "Filter uploads by custom account ID.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Filter uploads created on or after this date (ISO-8601).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "Filter uploads created on or before this date (ISO-8601).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "include_archived",
            "in": "query",
            "description": "Include archived uploads in the response.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CustomTransactionUploads"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/transaction-uploads/{uploadId}/archive": {
      "post": {
        "tags": [],
        "summary": "Archive bank statement upload",
        "description": "Archives a transaction upload and its imported transactions, reversing their categorization. This endpoint also supports other custom-account transaction uploads.",
        "operationId": "business.transaction-uploads.archive.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "uploadId",
            "in": "path",
            "description": "The UUID of the transaction upload to archive.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CustomTransactionUpload"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or upload not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/quickbooks/ledger/accounts": {
      "get": {
        "tags": [],
        "summary": "List Quickbooks accounts",
        "description": "This API call lists all Quickbooks accounts for a business.",
        "operationId": "business.quickbooks.ledger.accounts.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to list Quickbooks accounts for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "is_nested",
            "in": "query",
            "description": "Specify whether to flatten the accout structure into a single list or reflect the ledger's default nested structure.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiQuickbooksLedger"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/quickbooks/ledger/accounts/{accountId}": {
      "get": {
        "tags": [],
        "summary": "Fetch Quickbooks account",
        "description": "This API call fetches a specific Quickbooks account for a business.",
        "operationId": "business.quickbooks.ledger.accounts.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch Quickbooks account for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountId",
            "in": "path",
            "description": "The UUID of the Quickbooks account to fetch.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiQuickbooksLedgerAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or Quickbooks account id is not found. This indicates the business id is invalid or the business has been archived, or the Quickbooks account id is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/quickbooks/ledger/accounts/{accountId}/update-mapping": {
      "post": {
        "tags": [],
        "summary": "Update Quickbooks account mapping",
        "description": "This API call updates the mapping of a Quickbooks account to a Layer ledger account.",
        "operationId": "business.quickbooks.ledger.accounts.update-mapping.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to update Quickbooks account mapping for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountId",
            "in": "path",
            "description": "The UUID of the Quickbooks account to update mapping for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateQuickbooksLocalLedgerAccountMappingRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiQuickbooksLedgerAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id or Quickbooks account id is not found. This indicates the business id is invalid or the business has been archived, or the Quickbooks account id is invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/quickbooks/authorize": {
      "post": {
        "tags": [],
        "summary": "Authorize Quickbooks OAuth flow",
        "description": "This API call begins an OAuth flow to connect a Quickbooks account to a business. It will manage the CSRF token state internally and this API call will return the redirect URL for the OAuth flow.",
        "operationId": "business.quickbooks.authorize.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to authorize Quickbooks for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/QuickbooksAuthorizationParams"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/quickbooks/unlink": {
      "post": {
        "tags": [],
        "summary": "Unlink Quickbooks",
        "description": "This API call unlinks a Quickbooks account from a business. This will remove all Quickbooks data from the business and stop any future syncs.",
        "operationId": "business.quickbooks.unlink.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to unlink Quickbooks from.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/quickbooks/connection-status": {
      "get": {
        "tags": [],
        "summary": "Get connection status",
        "description": "Returns the connection status of Quickbooks for a business. To create new connections, use Quickbooks connection component. Businesses who have not connected a Quickbooks account will have a response with `is_connected` set to false.",
        "operationId": "business.quickbooks.connection-status.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to get Quickbooks connection status for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/QuickbooksConnectionStatus"
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "example": {
                  "is_connected": true,
                  "last_synced_at": "2025-07-14T09:00:00Z",
                  "last_sync_status": "SYNC_SUCCESS",
                  "is_syncing": false
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/quickbooks/sync-from": {
      "post": {
        "tags": [],
        "summary": "Sync from Quickbooks",
        "description": "Syncs Quickbooks data for a business. This endpoint can be used to manually trigger a sync from Quickbooks.",
        "operationId": "business.quickbooks.sync-from.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to sync Quickbooks data for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuickbooksSyncFromParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found or quickbooks is not connected for the business.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/mileage/vehicles": {
      "get": {
        "tags": [],
        "summary": "List vehicles",
        "description": "Returns a list of all vehicles for the specified business. Vehicles can be filtered by archived and deleted status.",
        "operationId": "business.mileage.vehicles.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "allow_archived",
            "in": "query",
            "description": "Include archived vehicles in the response.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "allow_deleted",
            "in": "query",
            "description": "Include deleted vehicles in the response.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of vehicles.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiVehicle"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create vehicle",
        "description": "Creates a new vehicle for the specified business. This endpoint is idempotent using the `external_id` field as the idempotency key.",
        "operationId": "business.mileage.vehicles.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateVehicleParams"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Vehicle created successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVehicle"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "200": {
            "description": "Existing vehicle with matching external_id was updated.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVehicle"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/mileage/vehicles/bulk": {
      "post": {
        "tags": [],
        "summary": "Bulk create vehicles",
        "description": "Creates multiple vehicles for the specified business in a single request. Maximum of 100 vehicles per request. This endpoint is idempotent using the `external_id` field as the idempotency key for each vehicle.",
        "operationId": "business.mileage.vehicles.bulk.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkCreateVehiclesRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Vehicles created successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiVehicle"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters or exceeded maximum of 100 vehicles.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/mileage/vehicles/{vehicleId}": {
      "get": {
        "tags": [],
        "summary": "Get vehicle",
        "description": "Returns a single vehicle by ID.",
        "operationId": "business.mileage.vehicles.vehicleId.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vehicleId",
            "in": "path",
            "description": "The UUID of the vehicle.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "allow_archived",
            "in": "query",
            "description": "Allow fetching archived vehicles.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "allow_deleted",
            "in": "query",
            "description": "Allow fetching deleted vehicles.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The vehicle.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVehicle"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or vehicle not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [],
        "summary": "Update vehicle",
        "description": "Partially updates a vehicle. Only provided fields will be updated.",
        "operationId": "business.mileage.vehicles.vehicleId.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vehicleId",
            "in": "path",
            "description": "The UUID of the vehicle.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchVehicleParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated vehicle.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVehicle"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or vehicle not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [],
        "summary": "Delete vehicle",
        "description": "Deletes a vehicle. The vehicle must not have any trips associated with it and must not be archived.",
        "operationId": "business.mileage.vehicles.vehicleId.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vehicleId",
            "in": "path",
            "description": "The UUID of the vehicle.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted vehicle.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVehicle"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Vehicle cannot be deleted (has trips or is archived).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or vehicle not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/mileage/vehicles/{vehicleId}/archive": {
      "post": {
        "tags": [],
        "summary": "Archive vehicle",
        "description": "Archives a vehicle. Archived vehicles are hidden from the default list but can still be retrieved with the allow_archived parameter.",
        "operationId": "business.mileage.vehicles.vehicleId.archive.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vehicleId",
            "in": "path",
            "description": "The UUID of the vehicle.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The archived vehicle.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVehicle"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or vehicle not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/mileage/vehicles/{vehicleId}/reactivate": {
      "post": {
        "tags": [],
        "summary": "Reactivate vehicle",
        "description": "Reactivates an archived vehicle, making it visible in the default vehicle list again.",
        "operationId": "business.mileage.vehicles.vehicleId.reactivate.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "vehicleId",
            "in": "path",
            "description": "The UUID of the vehicle.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The reactivated vehicle.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiVehicle"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or vehicle not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/mileage/trips": {
      "get": {
        "tags": [],
        "summary": "List trips",
        "description": "Returns a paginated list of trips for the specified business. Trips can be filtered by date range, purpose, vehicle, and search query.",
        "operationId": "business.mileage.trips.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "description": "Include deleted trips in the response.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "purpose",
            "in": "query",
            "description": "Filter by trip purpose. Can be specified multiple times for multiple purposes.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "UNREVIEWED",
                "BUSINESS",
                "PERSONAL"
              ]
            }
          },
          {
            "name": "vehicle_ids",
            "in": "query",
            "description": "Comma-separated list of vehicle UUIDs to filter by.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Filter trips on or after this date (YYYY-MM-DD).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "Filter trips on or before this date (YYYY-MM-DD).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "Filter trips by year.",
            "required": false,
            "schema": {
              "type": "integer"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Search query to filter trips by description, start address, end address, or vehicle make/model.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of trips.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiTrip"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found or invalid vehicle_ids.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create trip",
        "description": "Creates a new trip for the specified business. This endpoint is idempotent using the `external_id` field as the idempotency key.",
        "operationId": "business.mileage.trips.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTripParams"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Trip created successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTrip"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "200": {
            "description": "Existing trip with matching external_id was updated.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTrip"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or vehicle not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/mileage/trips/bulk": {
      "post": {
        "tags": [],
        "summary": "Bulk create trips",
        "description": "Creates multiple trips for the specified business in a single request. Maximum of 100 trips per request. This endpoint is idempotent using the `external_id` field as the idempotency key for each trip.",
        "operationId": "business.mileage.trips.bulk.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkCreateTripsRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Trips created successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiTrip"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters or exceeded maximum of 100 trips.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or vehicle not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/mileage/trips/{tripId}": {
      "get": {
        "tags": [],
        "summary": "Get trip",
        "description": "Returns a single trip by ID.",
        "operationId": "business.mileage.trips.tripId.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tripId",
            "in": "path",
            "description": "The UUID of the trip.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The trip.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTrip"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or trip not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [],
        "summary": "Update trip",
        "description": "Partially updates a trip. Only provided fields will be updated.",
        "operationId": "business.mileage.trips.tripId.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tripId",
            "in": "path",
            "description": "The UUID of the trip.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchTripParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated trip.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTrip"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or trip not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "delete": {
        "tags": [],
        "summary": "Delete trip",
        "description": "Deletes a trip by marking it as deleted.",
        "operationId": "business.mileage.trips.tripId.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "tripId",
            "in": "path",
            "description": "The UUID of the trip.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The deleted trip.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTrip"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or trip not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/mileage/summary": {
      "get": {
        "tags": [],
        "summary": "Get mileage summary",
        "description": "Returns a summary of mileage statistics grouped by year and month, including total miles, business miles, personal miles, uncategorized miles, trip counts, and estimated deductions.",
        "operationId": "business.mileage.summary.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "description": "Include deleted trips in the summary.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "purpose",
            "in": "query",
            "description": "Filter by trip purpose. Can be specified multiple times for multiple purposes.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "UNREVIEWED",
                "BUSINESS",
                "PERSONAL"
              ]
            }
          },
          {
            "name": "vehicle_ids",
            "in": "query",
            "description": "Comma-separated list of vehicle UUIDs to filter by.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Filter trips on or after this date (YYYY-MM-DD).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "Filter trips on or before this date (YYYY-MM-DD).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "Filter trips by year.",
            "required": false,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Mileage summary statistics.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiMileageSummary"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found or invalid vehicle_ids.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tax-estimates/overview": {
      "get": {
        "tags": [
          "Tax Estimates"
        ],
        "summary": "Get tax overview",
        "description": "Returns high-level tax summary for dashboard display. Each summary field includes a corresponding URL for retrieving itemized breakdowns.",
        "operationId": "business.tax-estimates.overview.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "The tax year (e.g., 2025). Supported years: 2024-2026.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "The accounting basis for reporting. Defaults to the business's default reporting basis, or CASH if not set.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ],
              "default": "CASH"
            }
          },
          {
            "name": "full_year_projection",
            "in": "query",
            "description": "Whether to project income/expenses for the full year based on year-to-date data. Only applicable for the current year. Defaults to false.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tax overview for the specified year.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTaxOverview"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tax-estimates/details": {
      "get": {
        "tags": [
          "Tax Estimates"
        ],
        "summary": "Get tax details",
        "description": "Returns detailed breakdown of tax calculations including adjusted gross income, deductions, and federal taxes.",
        "operationId": "business.tax-estimates.details.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "The tax year (e.g., 2025). Supported years: 2024-2026.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "The accounting basis for reporting. Defaults to the business's default reporting basis, or CASH if not set.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ],
              "default": "CASH"
            }
          },
          {
            "name": "full_year_projection",
            "in": "query",
            "description": "Whether to project income/expenses for the full year based on year-to-date data. Only applicable for the current year. Defaults to false.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Detailed tax breakdown.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTaxDetails"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tax-estimates/checklist": {
      "get": {
        "tags": [
          "Tax Estimates"
        ],
        "summary": "Get tax checklist",
        "description": "Returns actionable items that need user attention for tax preparation.",
        "operationId": "business.tax-estimates.checklist.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "The tax year (e.g., 2025).",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tax checklist for the specified year.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTaxChecklist"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tax-estimates/payments": {
      "get": {
        "tags": [
          "Tax Estimates"
        ],
        "summary": "Get tax payments",
        "description": "Returns quarterly tax payment history and tracking.",
        "operationId": "business.tax-estimates.payments.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "The tax year (e.g., 2025). Supported years: 2024-2026.",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "The accounting basis for reporting. Defaults to the business's default reporting basis, or CASH if not set.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ],
              "default": "CASH"
            }
          },
          {
            "name": "full_year_projection",
            "in": "query",
            "description": "Whether to project income/expenses for the full year based on year-to-date data. Only applicable for the current year. Defaults to false.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tax payments for the specified year.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTaxPayments"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tax-estimates/profile": {
      "get": {
        "tags": [
          "Tax Estimates"
        ],
        "summary": "Get tax profile",
        "description": "Returns the current tax profile configuration. Does NOT create or modify data.",
        "operationId": "business.tax-estimates.profile.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tax profile for the business.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTaxProfile"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [
          "Tax Estimates"
        ],
        "summary": "Create tax profile",
        "description": "Creates a new tax profile for the business.",
        "operationId": "business.tax-estimates.profile.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiTaxProfile"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Tax profile created successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTaxProfile"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or tax profile already exists.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [
          "Tax Estimates"
        ],
        "summary": "Update tax profile",
        "description": "Updates an existing tax profile for the business.",
        "operationId": "business.tax-estimates.profile.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiTaxProfile"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tax profile updated successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTaxProfile"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or tax profile not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [
          "Tax Estimates"
        ],
        "summary": "Replace tax profile",
        "description": "Replaces an existing tax profile for the business. Unlike PATCH, this replaces the entire profile with the provided data.",
        "operationId": "business.tax-estimates.profile.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ApiTaxProfile"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tax profile replaced successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTaxProfile"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or tax profile not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tax-estimates/summary": {
      "get": {
        "tags": [
          "Tax Estimates"
        ],
        "summary": "Get tax summary",
        "description": "Returns a summary of projected taxes owed with breakdown by federal and state tax components. This provides a high-level overview of total taxes due, what has been paid, and what remains owed.",
        "operationId": "business.tax-estimates.summary.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "Tax year to calculate summary for.",
            "required": true,
            "schema": {
              "type": "integer",
              "example": 2024
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "description": "Reporting basis for calculations (ACCRUAL or CASH). Defaults to the business's default reporting basis.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          },
          {
            "name": "full_year_projection",
            "in": "query",
            "description": "Whether to project the full year based on year-to-date data. Only applicable for current year calculations. Defaults to false.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Tax summary with federal and state breakdown.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTaxSummary"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/tax-estimates/export": {
      "post": {
        "tags": [
          "Tax Estimates"
        ],
        "summary": "Export tax documents",
        "description": "Generates tax documents for download. Returns a pre-signed S3 URL.",
        "operationId": "business.tax-estimates.export.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "type",
            "in": "query",
            "description": "The type of tax document to export.",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/TaxExportType"
            }
          },
          {
            "name": "year",
            "in": "query",
            "description": "The tax year (e.g., 2025).",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Pre-signed URL for downloading the tax document.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/S3PresignedUrl"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/payment": {
      "post": {
        "tags": [],
        "summary": "Create dedicated invoice payment",
        "description": "Creates a payment that is dedicated to a specific invoice. The full payment amount will be allocated to this invoice.",
        "operationId": "business.invoices.dedicated-payment.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice to apply the payment to.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DedicatedInvoicePaymentInput"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Payment created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoicePayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "200": {
            "description": "Payment already exists (idempotent).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoicePayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid payment parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or invoice not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/payment/{paymentId}": {
      "get": {
        "tags": [],
        "summary": "Get dedicated invoice payment",
        "description": "Returns a payment that is dedicated to a specific invoice.",
        "operationId": "business.invoices.dedicated-payment.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the payment.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoicePayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business, invoice, or payment not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [],
        "summary": "Update dedicated invoice payment",
        "description": "Updates a payment that is dedicated to a specific invoice.",
        "operationId": "business.invoices.dedicated-payment.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the payment.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DedicatedInvoicePaymentInput"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payment updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoicePayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid payment parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business, invoice, or payment not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [],
        "summary": "Delete dedicated invoice payment",
        "description": "Deletes a payment that is dedicated to a specific invoice.",
        "operationId": "business.invoices.dedicated-payment.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the payment.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Payment deleted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoicePayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business, invoice, or payment not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/delete": {
      "post": {
        "tags": [],
        "summary": "Delete invoice",
        "description": "Marks an invoice as deleted. The invoice must not have any valid payments or refunds associated with it.",
        "operationId": "business.invoices.delete.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice to delete.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invoice deleted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoice"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invoice cannot be deleted (has payments or refunds).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or invoice not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/{invoiceId}/refund": {
      "post": {
        "tags": [],
        "summary": "Create dedicated refund on invoice",
        "description": "Creates a refund that is dedicated to a specific invoice.",
        "operationId": "business.invoices.refund.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "invoiceId",
            "in": "path",
            "description": "The UUID of the invoice to refund.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateDedicatedRefundParams"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Refund created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "200": {
            "description": "Refund already exists (idempotent).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiRefund"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid refund parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or invoice not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/bulk-delete": {
      "post": {
        "tags": [],
        "summary": "Bulk delete invoices",
        "description": "Deletes multiple invoices at once. Maximum 100 invoices per request. All specified invoices must exist and have no payment allocations.",
        "operationId": "business.invoices.bulk-delete.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkDeleteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Invoices deleted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BulkDeleteResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or invoice has payment allocations.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or one or more invoices not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/payments/bulk-delete": {
      "post": {
        "tags": [],
        "summary": "Bulk delete invoice payments",
        "description": "Deletes multiple invoice payments at once. Maximum 100 payments per request.",
        "operationId": "business.invoices.payments.bulk-delete.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkDeleteRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payments deleted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/BulkDeleteResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or one or more payments not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/payments/bulk": {
      "post": {
        "tags": [],
        "summary": "Bulk create invoice payments",
        "description": "Creates multiple invoice payments in a single request. Each payment in the array uses the same parameters as the single payment endpoint. If a payment includes an `external_id` that matches an existing payment, the existing payment will be updated instead of creating a new one (upsert behavior).",
        "operationId": "business.invoices.payments.bulk.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create payments for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Array of payments to create. Each payment follows the same schema as the single payment creation endpoint.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/CreateStandaloneInvoicePayment"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Payments created or updated successfully. Returns the created/updated payment objects in the same order as the request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiInvoicePayment"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request. This can occur if:\n- The request payload is malformed\n- Duplicate `external_id` values are present in the same request\n- Payment allocations do not match payment amount\n- Any other validation error on individual payments.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business ID not found or referenced invoice does not exist.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/invoices/payments/{paymentId}/delete": {
      "post": {
        "tags": [],
        "summary": "Delete invoice payment",
        "description": "Marks an invoice payment as deleted.",
        "operationId": "business.invoices.payments.delete.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "description": "The UUID of the payment to delete.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Payment deleted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoicePayment"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or payment not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/catalog/services": {
      "get": {
        "tags": [],
        "summary": "List services",
        "description": "Returns a list of services in the service catalog for the specified business.",
        "operationId": "business.catalog.services.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "allow_deleted",
            "in": "query",
            "description": "Whether to include deleted services in the response.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiService"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create service",
        "description": "Creates a new service in the catalog. If a service with the same external_id already exists, it will be updated instead.",
        "operationId": "business.catalog.services.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateServiceParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Service already exists and was updated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiService"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Service created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiService"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/catalog/services/{serviceId}": {
      "get": {
        "tags": [],
        "summary": "Get service",
        "description": "Retrieves a single service by ID.",
        "operationId": "business.catalog.services.service.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "serviceId",
            "in": "path",
            "description": "The UUID of the service.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "allow_deleted",
            "in": "query",
            "description": "Whether to return the service if it is archived.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiService"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Service not found."
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Update service",
        "description": "Partially updates a service. Only the fields provided in the request body will be updated.",
        "operationId": "business.catalog.services.service.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "serviceId",
            "in": "path",
            "description": "The UUID of the service.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchServiceParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Service updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiService"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Service not found."
          }
        }
      },
      "delete": {
        "tags": [],
        "summary": "Delete service",
        "description": "Soft deletes a service. Deleted services are excluded from listings by default but can still be retrieved with allow_deleted=true.",
        "operationId": "business.catalog.services.service.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "serviceId",
            "in": "path",
            "description": "The UUID of the service.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Service deleted successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiService"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Service not found."
          }
        }
      }
    },
    "/v1/businesses/{businessId}/time-tracking/time-entries": {
      "get": {
        "tags": [],
        "summary": "List time entries",
        "description": "Returns a paginated list of time entries for the specified business with optional filters.",
        "operationId": "business.timeTracking.timeEntries.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Pagination cursor for fetching the next page of results.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of results to return.",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "description": "Sort order for results.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ],
              "default": "DESC"
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "description": "Whether to include deleted time entries.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "Filter by customer UUID.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "has_customer",
            "in": "query",
            "description": "Filter entries that have (true) or do not have (false) a customer assigned.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "service_id",
            "in": "query",
            "description": "Filter by service UUID.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Filter entries on or after this date (YYYY-MM-DD).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "Filter entries on or before this date (YYYY-MM-DD).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "billable",
            "in": "query",
            "description": "Filter by billable status.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiTimeEntry"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create time entry",
        "description": "Creates a new time entry. If a time entry with the same external_id already exists, it will be updated instead.",
        "operationId": "business.timeTracking.timeEntries.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateTimeEntryParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Time entry already exists and was updated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTimeEntry"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "201": {
            "description": "Time entry created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTimeEntry"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/time-tracking/time-entries/bulk": {
      "post": {
        "tags": [],
        "summary": "Bulk create time entries",
        "description": "Creates multiple time entries in a single request (maximum 100). Each entry follows the same create-or-update logic based on external_id.",
        "operationId": "business.timeTracking.timeEntries.bulk.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkCreateTimeEntriesRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Time entries created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiTimeEntry"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (e.g., more than 100 entries)."
          }
        }
      }
    },
    "/v1/businesses/{businessId}/time-tracking/time-entries/summary": {
      "get": {
        "tags": [],
        "summary": "Get time entry summary",
        "description": "Returns aggregated summary statistics for time entries, including totals and breakdowns by customer and service.",
        "operationId": "business.timeTracking.timeEntries.summary.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "include_deleted",
            "in": "query",
            "description": "Whether to include deleted time entries in the summary.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "Filter by customer UUID.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "has_customer",
            "in": "query",
            "description": "Filter entries that have (true) or do not have (false) a customer assigned.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "service_id",
            "in": "query",
            "description": "Filter by service UUID.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Filter entries on or after this date (YYYY-MM-DD).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "Filter entries on or before this date (YYYY-MM-DD).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "billable",
            "in": "query",
            "description": "Filter by billable status.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTimeEntrySummary"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/time-tracking/time-entries/{timeEntryId}": {
      "get": {
        "tags": [],
        "summary": "Get time entry",
        "description": "Retrieves a single time entry by ID.",
        "operationId": "business.timeTracking.timeEntries.timeEntry.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "timeEntryId",
            "in": "path",
            "description": "The UUID of the time entry.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "allow_deleted",
            "in": "query",
            "description": "Whether to return the time entry if it is deleted.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTimeEntry"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Time entry not found."
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Update time entry",
        "description": "Partially updates a time entry. Only the fields provided in the request body will be updated.",
        "operationId": "business.timeTracking.timeEntries.timeEntry.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "timeEntryId",
            "in": "path",
            "description": "The UUID of the time entry.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchTimeEntryParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Time entry updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiTimeEntry"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Time entry not found."
          }
        }
      }
    },
    "/v1/businesses/{businessId}/time-tracking/invoice-preview": {
      "get": {
        "tags": [],
        "summary": "Preview invoice from time entries",
        "description": "Generates an invoice preview from unbilled billable time entries for a specific customer. Returns invoice parameters that can be used to create an invoice.",
        "operationId": "business.timeTracking.invoicePreview.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customer_id",
            "in": "query",
            "description": "The UUID of the customer. Either customer_id or customer_external_id must be provided.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "customer_external_id",
            "in": "query",
            "description": "The external ID of the customer. Either customer_id or customer_external_id must be provided.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invoice preview generated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiInvoice"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Neither customer_id nor customer_external_id was provided."
          },
          "404": {
            "description": "Customer not found."
          }
        }
      }
    },
    "/v1/businesses/{businessId}/payroll/check/configs": {
      "get": {
        "tags": [],
        "summary": "List Check payroll configs",
        "description": "Returns all Check payroll configurations for the given business.",
        "operationId": "business.payroll.check.configs.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of Check payroll configs for the business.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiCheckPayrollConfig"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "put": {
        "tags": [],
        "summary": "Create Check payroll config",
        "description": "Creates a new Check payroll configuration for the given business. If a config with the same `check_company_id` already exists, this is a no-op and returns 200.",
        "operationId": "business.payroll.check.configs.put",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCheckPayrollConfigParams"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "A new Check payroll config was created.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCheckPayrollConfig"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "200": {
            "description": "A config with the given `check_company_id` already exists; no change was made.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiCheckPayrollConfig"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/payroll/check/configs/{checkPayrollConfigId}": {
      "delete": {
        "tags": [],
        "summary": "Delete Check payroll config",
        "description": "Archives the specified Check payroll configuration, removing it from active use.",
        "operationId": "business.payroll.check.configs.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "checkPayrollConfigId",
            "in": "path",
            "description": "The UUID of the Check payroll config to archive.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The Check payroll config was successfully archived."
          },
          "404": {
            "description": "Check payroll config not found."
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bookkeeping/periods": {
      "get": {
        "summary": "List bookkeeping periods for a business",
        "operationId": "listBookkeepingPeriods",
        "tags": [
          "Bookkeeping"
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "scale",
            "in": "query",
            "schema": {
              "type": "array",
              "items": {
                "enum": [
                  "MONTHLY",
                  "ANNUAL",
                  "ONGOING"
                ]
              }
            },
            "description": "Filter by period scale (MONTHLY, ANNUAL, ONGOING)."
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "List of bookkeeping periods.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBookkeepingPeriods"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bookkeeping/periods/{periodId}": {
      "get": {
        "summary": "Get a single bookkeeping period",
        "operationId": "getBookkeepingPeriod",
        "tags": [
          "Bookkeeping"
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "periodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "serialization_mode",
            "in": "query",
            "schema": {
              "enum": [
                "BASE",
                "WITH_TASKS",
                "WITH_TEMPLATE_CLOSING_ACTIONS"
              ]
            },
            "description": "Serialization mode for the response."
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "schema": {
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            },
            "description": "Reporting basis for the response."
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Bookkeeping period details.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBookkeepingPeriod"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bookkeeping/periods/{periodId}/update": {
      "post": {
        "summary": "Update a bookkeeping period",
        "operationId": "updateBookkeepingPeriod",
        "tags": [
          "Bookkeeping"
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "periodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchBookkeepingPeriodParams"
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Updated period.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBookkeepingPeriod"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bookkeeping/periods/{periodId}/checklist": {
      "get": {
        "summary": "Get checklist for a bookkeeping period",
        "operationId": "getBookkeepingPeriodChecklist",
        "tags": [
          "Bookkeeping"
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "periodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "include_ongoing_steps",
            "in": "query",
            "schema": {
              "type": "boolean"
            },
            "description": "Whether to include ongoing period steps."
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Period checklist.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBookkeepingChecklist"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/closing/retained-earnings": {
      "post": {
        "summary": "Retained earnings",
        "description": "Create a retained earnings adjustment.",
        "operationId": "createRetainedEarningsClosingAction",
        "tags": ["Retained earnings"],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "security": [{ "BearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateRetainedEarningsClosingAction" },
              "example": { "year": 2024, "memo": "Close 2024 earnings" }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Retained earnings closing actions created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "closing_actions": {
                          "type": "array",
                          "items": { "$ref": "#/components/schemas/ApiRetainedEarningsClosingAction" }
                        }
                      },
                      "required": ["closing_actions"]
                    }
                  },
                  "required": ["data"]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/closing/retained-earnings/preview": {
      "post": {
        "summary": "Preview retained earnings",
        "description": "Dry-run a retained earnings adjustment without creating it.",
        "operationId": "previewRetainedEarningsClosingAction",
        "tags": ["Retained earnings"],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": { "type": "string", "format": "uuid" }
          }
        ],
        "security": [{ "BearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateRetainedEarningsClosingAction" },
              "example": { "year": 2024, "memo": "Close 2024 earnings" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Preview closing actions and their proposed journal entries.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "template_closing_action_id": { "type": "string", "format": "uuid", "nullable": true },
                          "closing_action": { "$ref": "#/components/schemas/CreateRetainedEarningsClosingAction" },
                          "primary_entry": { "$ref": "#/components/schemas/ApiLedgerEntry" },
                          "secondary_entries": {
                            "type": "array",
                            "items": { "$ref": "#/components/schemas/ApiLedgerEntry" }
                          }
                        },
                        "required": ["template_closing_action_id", "closing_action", "primary_entry", "secondary_entries"]
                      }
                    }
                  },
                  "required": ["data"]
                },
                "example": {
                  "data": [
                    {
                      "template_closing_action_id": null,
                      "closing_action": { "year": 2024, "memo": "Close 2024 earnings" },
                      "primary_entry": { "entry_type": "CLOSING_ACTION_RETAINED_EARNINGS" },
                      "secondary_entries": []
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bookkeeping/periods/{periodId}/run-closing-actions": {
      "post": {
        "summary": "Run closing actions for a period",
        "operationId": "runClosingActions",
        "tags": [
          "Bookkeeping"
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "periodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Closing actions run result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiClosingActionsRunResult"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bookkeeping/periods/{periodId}/run-closing-actions/preview": {
      "post": {
        "summary": "Preview closing actions for a period",
        "operationId": "previewRunClosingActions",
        "tags": [
          "Bookkeeping"
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "periodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "reporting_basis",
            "in": "query",
            "schema": {
              "enum": [
                "ACCRUAL",
                "CASH"
              ]
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Closing actions preview.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiClosingActionsRunResult"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bookkeeping/periods/{periodId}/undo-closing-actions": {
      "post": {
        "summary": "Undo closing actions for a period",
        "operationId": "undoClosingActions",
        "tags": [
          "Bookkeeping"
        ],
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "periodId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Undo result.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiClosingActionsRunResult"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/bank-accounts": {
      "get": {
        "tags": [],
        "summary": "List bank accounts",
        "description": "Returns a list of bank accounts for the specified business.",
        "operationId": "bank-accounts.list",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The UUID of the business."
          },
          {
            "name": "include_archived",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            },
            "description": "When true, archived bank accounts are included in the response. Defaults to false."
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBankAccount"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create bank account",
        "description": "Creates a new bank account for the specified business.",
        "operationId": "bank-accounts.create",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The UUID of the business."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateBankAccountParams"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Bank account successfully created.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBankAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-accounts/{bankAccountId}": {
      "get": {
        "tags": [],
        "summary": "Get bank account",
        "description": "Returns a single bank account by ID.",
        "operationId": "bank-accounts.get",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The UUID of the business."
          },
          {
            "name": "bankAccountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The UUID of the bank account."
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBankAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "patch": {
        "tags": [],
        "summary": "Update bank account",
        "description": "Updates the specified bank account. Only provided fields are updated; omitted fields are left unchanged.",
        "operationId": "bank-accounts.patch",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The UUID of the business."
          },
          {
            "name": "bankAccountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The UUID of the bank account."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchBankAccountParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBankAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/bank-accounts/{bankAccountId}/archive": {
      "post": {
        "tags": [],
        "summary": "Archive bank account",
        "description": "Archives the specified bank account. Archived accounts are hidden from default list responses unless `include_archived=true` is passed.",
        "operationId": "bank-accounts.archive",
        "parameters": [
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The UUID of the business."
          },
          {
            "name": "bankAccountId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The UUID of the bank account."
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBankAccount"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/tight/migrate": {
      "post": {
        "tags": [],
        "summary": "Migrate Tight user",
        "description": "Migrates a Tight user into Layer by creating a Layer business and importing supported accounting data from Tight. This endpoint is intended for coordinated Tight migration flows.",
        "operationId": "tight.migrate.post",
        "x-hidden": true,
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MigrateTightUserParams"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The Tight user was accepted for migration and a Layer business was created.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBusiness"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The request was invalid, the Tight user ID was invalid, or migration validation failed while synchronous verification was requested.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500": {
            "description": "The Tight sync or report verification failed. When webhook delivery is configured, Layer sends a `tight_migration.finished` webhook with the final state.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/documents": {
      "get": {
        "tags": [],
        "summary": "List documents",
        "description": "Returns a list of completed documents for the specified business, sorted newest first. Archived documents and documents whose upload has not completed are excluded. Documents can be filtered by document type and file type. Results will be paginated, see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.documents.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to fetch documents for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "document_type",
            "in": "query",
            "description": "Filter documents by type.",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/DocumentType"
            }
          },
          {
            "name": "file_type",
            "in": "query",
            "description": "Filter documents by file MIME type (for example `application/pdf` or `image/png`).",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiS3Document"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid query or pagination parameters (for example an unsupported `document_type` or `sort_by`).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      },
      "post": {
        "tags": [],
        "summary": "Create document upload",
        "description": "Creates a new document record and initiates a multipart upload to S3. Returns presigned URLs for uploading file parts directly to S3. This endpoint is designed for uploading large files that may exceed standard upload limits. After uploading all parts to the presigned URLs, call the complete endpoint to finalize the upload.",
        "operationId": "business.documents.create",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the document for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateS3DocumentParams"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Document record created and multipart upload initiated. The response includes presigned URLs for uploading file parts.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiS3MultipartUpload"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}/complete": {
      "post": {
        "tags": [],
        "summary": "Complete document upload",
        "description": "Completes a multipart upload after all parts have been uploaded to S3. You must provide the upload_id from the create response and the ETag returned by S3 for each uploaded part. The ETag is returned in the response headers when you PUT to each presigned URL.",
        "operationId": "business.documents.complete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "description": "The UUID of the document returned from the create endpoint.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CompleteS3DocumentUploadParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Upload completed successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiS3Document"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters or parts do not match the upload.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business or document not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/documents/{documentId}/abort": {
      "post": {
        "tags": [],
        "summary": "Abort document upload",
        "description": "Aborts a multipart upload and archives the document record. Use this endpoint if you need to cancel an upload that is in progress or if an error occurs during upload. Any uploaded parts will be cleaned up from S3.",
        "operationId": "business.documents.abort",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "documentId",
            "in": "path",
            "description": "The UUID of the document returned from the create endpoint.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to application/json.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AbortS3DocumentUploadParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Upload aborted successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/EmptyResponse"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or document not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/loans": {
      "get": {
        "tags": [],
        "summary": "List loans",
        "description": "Returns a list of loans for the specified business. Results are paginated; see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.loans.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "required": false,
            "description": "Field to sort by. Defaults to `created_at`.",
            "schema": {
              "type": "string",
              "default": "created_at"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "required": false,
            "description": "Sort direction. Defaults to `ASC`.",
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ],
              "default": "ASC"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Pagination cursor returned by the previous list request. Omit for the first page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of results to return. Defaults to 100.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "show_total_count",
            "in": "query",
            "required": false,
            "description": "If true, include `total_count` in the pagination metadata. Has a performance cost; defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of loans.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiLoan"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create a loan",
        "description": "Creates a new loan for the specified business, or updates an existing one. If a loan with the same `external_id` already exists it is upserted: the loan fields are updated and, when `proceeds` is provided, its proceeds are reconciled by proceed `external_id`. A dedicated ledger account is created for new loans. The request shape depends on `loan_type`.",
        "operationId": "business.loans.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The loan to create.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLoanParams"
              },
              "examples": {
                "term_loan_with_disbursement": {
                  "summary": "Term loan with a cash disbursement",
                  "value": {
                    "loan_type": "TERM_LOAN",
                    "external_id": "loan-001",
                    "display_name": "Equipment term loan",
                    "origination_date": "2024-01-15",
                    "original_principal": 5000000,
                    "loan_term_months": 36,
                    "proceeds": [
                      {
                        "loan_proceed_type": "DISBURSEMENT",
                        "amount": 5000000,
                        "date": "2024-01-15",
                        "method": "ACH"
                      }
                    ]
                  }
                },
                "merchant_cash_advance": {
                  "summary": "Merchant cash advance",
                  "value": {
                    "loan_type": "MCA",
                    "display_name": "Working capital advance",
                    "origination_date": "2024-03-01",
                    "original_principal": 2000000,
                    "fee_percentage": "15"
                  }
                },
                "line_of_credit": {
                  "summary": "Line of credit",
                  "value": {
                    "loan_type": "LINE_OF_CREDIT",
                    "display_name": "Revolving credit line",
                    "origination_date": "2024-02-01",
                    "credit_limit": 10000000
                  }
                },
                "flex_loan": {
                  "summary": "Flex loan",
                  "value": {
                    "loan_type": "FLEX_LOAN",
                    "display_name": "Flex advance",
                    "origination_date": "2024-03-01",
                    "original_principal": 2000000,
                    "fee_percentage": "15"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Loan created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoan"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/loans/{loanId}": {
      "get": {
        "tags": [],
        "summary": "Fetch a loan",
        "description": "Returns a single loan by ID.",
        "operationId": "business.loans.loanId.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested loan.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoan"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Update a loan",
        "description": "Updates a loan. Only the fields you include are changed. The request shape depends on `loan_type`.",
        "operationId": "business.loans.loanId.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The loan fields to update.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchLoanParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated loan.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoan"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [],
        "summary": "Archive a loan",
        "description": "Archives a loan. Archived loans are excluded from list responses.",
        "operationId": "business.loans.loanId.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The archived loan.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoan"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/loans/payments": {
      "get": {
        "tags": [],
        "summary": "List loan payments",
        "description": "Returns a list of loan payments across all loans for the specified business. Results are paginated; see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.loans.payments.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "required": false,
            "description": "Field to sort by. Defaults to `date`.",
            "schema": {
              "type": "string",
              "default": "date"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "required": false,
            "description": "Sort direction. Defaults to `ASC`.",
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ],
              "default": "ASC"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Pagination cursor returned by the previous list request. Omit for the first page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of results to return. Defaults to 100.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "show_total_count",
            "in": "query",
            "required": false,
            "description": "If true, include `total_count` in the pagination metadata. Has a performance cost; defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of loan payments.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiLoanPayment"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create a loan payment",
        "description": "Records a payment against a loan, split into principal, interest, and fee portions. Identify the loan with either `loan_id` or `loan_external_id`.",
        "operationId": "business.loans.payments.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The loan payment to create.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLoanPaymentParams"
              },
              "examples": {
                "principal_interest_payment": {
                  "summary": "Payment split into principal and interest",
                  "value": {
                    "loan_id": "6d0c298f-3e4e-4538-9a71-1d5359c22f71",
                    "external_id": "loan-pmt-001",
                    "amount": 150000,
                    "date": "2024-02-15",
                    "splits": [
                      {
                        "split_type": "PRINCIPAL",
                        "amount": 120000
                      },
                      {
                        "split_type": "INTEREST",
                        "amount": 30000
                      }
                    ],
                    "method": "ACH"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Loan payment created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoanPayment"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/loans/payments/{paymentId}": {
      "get": {
        "tags": [],
        "summary": "Fetch a loan payment",
        "description": "Returns a single loan payment by ID.",
        "operationId": "business.loans.payments.paymentId.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan payment.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested loan payment.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoanPayment"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Update a loan payment",
        "description": "Updates a loan payment. Only the fields you include are changed. A payment that is part of a customer payout cannot be updated.",
        "operationId": "business.loans.payments.paymentId.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan payment.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The loan payment fields to update.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchLoanPaymentParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated loan payment.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoanPayment"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [],
        "summary": "Archive a loan payment",
        "description": "Archives a loan payment. A payment that is part of a customer payout cannot be archived.",
        "operationId": "business.loans.payments.paymentId.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "paymentId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan payment.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The archived loan payment.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoanPayment"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/loans/{loanId}/payments": {
      "get": {
        "tags": [],
        "summary": "List payments for a loan",
        "description": "Returns all payments recorded against a specific loan.",
        "operationId": "business.loans.loanId.payments.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of loan payments for the loan.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiLoanPayment"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/loans/{loanId}/payments/bulk": {
      "post": {
        "tags": [],
        "summary": "Bulk create loan payments",
        "description": "Creates or updates payments for a loan in a single atomic request. Items are upserted by `external_id`: payments matching an existing `external_id` are updated, all others are created. The response returns payments in request order. If any item is invalid, the entire batch is rejected. Items may omit `loan_id` and `loan_external_id`; if provided, they must match the loan in the request path.",
        "operationId": "business.loans.loanId.payments.bulk.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The loan payments to create or update.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkCreateLoanPaymentsParams"
              },
              "examples": {
                "bulk_payments": {
                  "summary": "Two payments created in one request",
                  "value": {
                    "payments": [
                      {
                        "external_id": "loan-pmt-001",
                        "amount": 150000,
                        "date": "2024-02-15",
                        "splits": [
                          {
                            "split_type": "PRINCIPAL",
                            "amount": 120000
                          },
                          {
                            "split_type": "INTEREST",
                            "amount": 30000
                          }
                        ],
                        "method": "ACH"
                      },
                      {
                        "external_id": "loan-pmt-002",
                        "amount": 150000,
                        "date": "2024-03-15",
                        "splits": [
                          {
                            "split_type": "PRINCIPAL",
                            "amount": 121000
                          },
                          {
                            "split_type": "INTEREST",
                            "amount": 29000
                          }
                        ],
                        "method": "ACH"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Loan payments created or updated successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiLoanPayment"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/assets": {
      "get": {
        "tags": [],
        "summary": "List assets",
        "description": "Returns a list of active fixed assets for the specified business. Results are paginated; see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.assets.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "required": false,
            "description": "Field to sort by. Defaults to `created_at`.",
            "schema": {
              "type": "string",
              "default": "created_at"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "required": false,
            "description": "Sort direction. Defaults to `ASC`.",
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ],
              "default": "ASC"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Pagination cursor returned by the previous list request. Omit for the first page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of results to return. Defaults to 100.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "show_total_count",
            "in": "query",
            "required": false,
            "description": "If true, include `total_count` in the pagination metadata. Has a performance cost; defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of assets.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiAsset"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create an asset",
        "description": "Creates a fixed asset for the specified business, or upserts an existing one: if an asset with the same `external_id` already exists it is updated in place. A dedicated ledger account is created for new assets.",
        "operationId": "business.assets.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The asset to create.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAssetParams"
              },
              "examples": {
                "equipment": {
                  "summary": "Create a piece of equipment",
                  "value": {
                    "name": "Forklift",
                    "asset_type": "EQUIPMENT",
                    "original_value": 100000,
                    "useful_life_months": 60,
                    "accumulated_depreciation_account": "ACCUMULATED_DEPRECIATION"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Asset created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAsset"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/assets/{assetId}": {
      "get": {
        "tags": [],
        "summary": "Fetch an asset",
        "description": "Returns a single asset by ID.",
        "operationId": "business.assets.assetId.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "description": "The UUID of the asset.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested asset.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAsset"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Update an asset",
        "description": "Updates an asset. Only the fields you include are changed.",
        "operationId": "business.assets.assetId.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "description": "The UUID of the asset.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The asset fields to update.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchAssetParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated asset.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAsset"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [],
        "summary": "Archive an asset",
        "description": "Archives an asset. This also archives the asset's value updates and reverses their ledger entries.",
        "operationId": "business.assets.assetId.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "description": "The UUID of the asset.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The archived asset.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAsset"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/assets/value-updates": {
      "get": {
        "tags": [],
        "summary": "List asset value updates",
        "description": "Returns a list of value updates across all assets for the specified business. Results are paginated; see [Pagination](/api-details/pagination) for details.",
        "operationId": "business.assets.valueUpdates.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "sort_by",
            "in": "query",
            "required": false,
            "description": "Field to sort by. Defaults to `date`.",
            "schema": {
              "type": "string",
              "default": "date"
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "required": false,
            "description": "Sort direction. Defaults to `ASC`.",
            "schema": {
              "type": "string",
              "enum": [
                "ASC",
                "DESC"
              ],
              "default": "ASC"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Pagination cursor returned by the previous list request. Omit for the first page.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of results to return. Defaults to 100.",
            "schema": {
              "type": "integer",
              "default": 100
            }
          },
          {
            "name": "show_total_count",
            "in": "query",
            "required": false,
            "description": "If true, include `total_count` in the pagination metadata. Has a performance cost; defaults to false.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of asset value updates.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiAssetValueUpdate"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create an asset value update",
        "description": "Records a change to an asset's value (depreciation, improvement, impairment, or revaluation) and posts the corresponding journal entry. Identify the asset with either `asset_id` or `asset_external_id`.",
        "operationId": "business.assets.valueUpdates.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The value update to create.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAssetValueUpdateParams"
              },
              "examples": {
                "depreciation": {
                  "summary": "Record monthly depreciation",
                  "value": {
                    "asset_id": "550e8400-e29b-41d4-a716-446655440000",
                    "amount": 1666,
                    "update_type": "DEPRECIATION_AMORTIZATION",
                    "counter_account": "DEPRECIATION",
                    "date": "2024-02-29T00:00:00Z"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Asset value update created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAssetValueUpdate"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/assets/value-updates/{valueUpdateId}": {
      "get": {
        "tags": [],
        "summary": "Fetch an asset value update",
        "description": "Returns a single asset value update by ID.",
        "operationId": "business.assets.valueUpdates.valueUpdateId.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "valueUpdateId",
            "in": "path",
            "required": true,
            "description": "The UUID of the value update.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested asset value update.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAssetValueUpdate"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Update an asset value update",
        "description": "Updates an asset value update. Changing the amount, type, account, or date re-posts the underlying journal entry.",
        "operationId": "business.assets.valueUpdates.valueUpdateId.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "valueUpdateId",
            "in": "path",
            "required": true,
            "description": "The UUID of the value update.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The value update fields to update.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchAssetValueUpdateParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated asset value update.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAssetValueUpdate"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [],
        "summary": "Archive an asset value update",
        "description": "Archives an asset value update and reverses its ledger entry.",
        "operationId": "business.assets.valueUpdates.valueUpdateId.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "valueUpdateId",
            "in": "path",
            "required": true,
            "description": "The UUID of the value update.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The archived asset value update.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiAssetValueUpdate"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/assets/{assetId}/value-updates": {
      "get": {
        "tags": [],
        "summary": "List value updates for an asset",
        "description": "Returns all value updates recorded for a specific asset.",
        "operationId": "business.assets.assetId.valueUpdates.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "description": "The UUID of the asset.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of value updates for the asset.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiAssetValueUpdate"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/loans/{loanId}/proceeds": {
      "get": {
        "tags": [],
        "summary": "List loan proceeds",
        "description": "Returns all proceeds for a specific loan.",
        "operationId": "business.loans.loanId.proceeds.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A list of loan proceeds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiLoanProceed"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [],
        "summary": "Create a loan proceed",
        "description": "Adds a proceed to a loan. A proceed is either a cash `DISBURSEMENT` or an `ASSET` the loan financed.",
        "operationId": "business.loans.loanId.proceeds.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The proceed to create.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLoanProceedParams"
              },
              "examples": {
                "disbursement": {
                  "summary": "Cash disbursement proceed",
                  "value": {
                    "loan_proceed_type": "DISBURSEMENT",
                    "external_id": "mca-001-proceed-1",
                    "amount": 2000000,
                    "date": "2024-03-01",
                    "method": "ACH"
                  }
                },
                "asset_existing": {
                  "summary": "Asset-funded proceed (existing asset)",
                  "value": {
                    "loan_proceed_type": "ASSET",
                    "amount": 5000000,
                    "date": "2024-01-15",
                    "asset": {
                      "id": "550e8400-e29b-41d4-a716-446655440000"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Loan proceed created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoanProceed"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/loans/{loanId}/proceeds/{proceedId}": {
      "get": {
        "tags": [],
        "summary": "Fetch a loan proceed",
        "description": "Returns a single loan proceed by ID.",
        "operationId": "business.loans.loanId.proceeds.proceedId.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "proceedId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan proceed.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The requested loan proceed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoanProceed"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [],
        "summary": "Update a loan proceed",
        "description": "Updates a loan proceed. Only the fields you include are changed; the underlying ledger entries are reversed and re-posted to reflect the change. Reducing a proceed below the principal that has already been repaid is rejected.",
        "operationId": "business.loans.loanId.proceeds.proceedId.patch",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "proceedId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan proceed.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "The proceed fields to update.",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchLoanProceedParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The updated loan proceed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoanProceed"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [],
        "summary": "Archive a loan proceed",
        "description": "Archives a loan proceed and reverses its ledger entries. The loan's total disbursed proceeds must still cover the principal that has been repaid, otherwise the request is rejected.",
        "operationId": "business.loans.loanId.proceeds.proceedId.delete",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "required": true,
            "description": "The UUID of the business.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "loanId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "proceedId",
            "in": "path",
            "required": true,
            "description": "The UUID of the loan proceed.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The archived loan proceed.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiLoanProceed"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/expenses": {
      "post": {
        "tags": [],
        "summary": "Create expense",
        "description": "Creates an expense for a business. An expense is a type of bill for a purchase paid at the time of the transaction. Use this endpoint to provide purchase, vendor, line item, and payment details in one request. The response is a bill with `is_expense: true` and `status: PAID`.",
        "operationId": "business.expenses.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to create the expense for.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewExpensePostParams"
              },
              "example": {
                "external_id": "exp-001",
                "paid_at": "2025-01-01T01:46:59.309329Z",
                "vendor_external_id": "Office Depot",
                "reference_number": "EXP-001",
                "memo": "Office supplies",
                "line_items": [
                  {
                    "account_identifier": {
                      "type": "StableName",
                      "stable_name": "OTHER_OFFICE_EXPENSES"
                    },
                    "description": "Paper",
                    "product_name": "Copy paper",
                    "unit_price": 1001,
                    "quantity": 1.5
                  }
                ],
                "payment": {
                  "method": "CHECK"
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Expense created successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBill"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "c845d116-cd28-41a1-b4ea-84a2768b6e15",
                    "business_id": "188eb399-f171-4849-861c-5c02d91f800b",
                    "external_id": "exp-001",
                    "status": "PAID",
                    "terms": "DUE_ON_RECEIPT",
                    "received_at": "2025-01-01T01:46:59.309329Z",
                    "due_at": "2025-01-01T01:46:59.309329Z",
                    "paid_at": "2025-01-01T01:46:59.309329Z",
                    "voided_at": null,
                    "reference_number": "EXP-001",
                    "is_expense": true,
                    "vendor": {
                      "id": "a4c38874-8c01-4986-b8d0-4f159a52dd39",
                      "external_id": "Office Depot",
                      "company_name": "Office Depot",
                      "status": "ACTIVE"
                    },
                    "line_items": [],
                    "subtotal": 1502,
                    "additional_sales_taxes": [],
                    "additional_sales_taxes_total": 0,
                    "total_amount": 1502,
                    "outstanding_balance": 0,
                    "memo": "Office supplies",
                    "payment_allocations": [],
                    "vendor_credits": [],
                    "imported_at": "2025-01-01T01:46:59.309329Z",
                    "updated_at": "2025-01-01T01:46:59.309329Z",
                    "transaction_tags": [],
                    "metadata": {}
                  }
                }
              }
            }
          },
          "200": {
            "description": "Existing expense returned (idempotent request with matching `external_id`).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBill"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/mileage/address-suggestions": {
      "get": {
        "tags": [],
        "summary": "Get address suggestions",
        "description": "Returns address autocomplete suggestions for a partial address query, for use when entering trip start and end addresses. Pass the selected suggestion's `place_id` to the address details endpoint and to trip create/update.",
        "operationId": "business.mileage.addressSuggestions.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "query",
            "in": "query",
            "description": "The partial address text to get suggestions for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "session_token",
            "in": "query",
            "description": "An opaque session token generated by the client (e.g. a UUID). Use the same token for all autocomplete requests in one address-entry session and the final address details request, then discard it. Groups the requests into a single billed session.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Address suggestions retrieved successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiPlaceSuggestion"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/businesses/{businessId}/mileage/address-details": {
      "get": {
        "tags": [],
        "summary": "Get address details",
        "description": "Resolves a `place_id` from the address suggestions endpoint to a formatted address and coordinates.",
        "operationId": "business.mileage.addressDetails.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "place_id",
            "in": "query",
            "description": "The Google Maps place ID from an address suggestion.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "session_token",
            "in": "query",
            "description": "An opaque session token generated by the client (e.g. a UUID). Use the same token for all autocomplete requests in one address-entry session and the final address details request, then discard it. Groups the requests into a single billed session.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Address details retrieved successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiPlaceDetails"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v1/billing/reports": {
      "post": {
        "tags": [],
        "summary": "Create billing report export",
        "description": "Submits an async request to generate a rolling 3-month bookkeeping billing report (XLSX) for the authenticated client. Returns immediately with an export resource; poll GET /v1/exports/{exportId} or subscribe to export.completed / export.failed webhooks for completion.",
        "operationId": "billing.reports.post",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BillingReportExportParameters"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Export request accepted and generation started.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiExport"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid request parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/exports": {
      "get": {
        "tags": [],
        "summary": "List exports",
        "description": "Returns async export requests for the authenticated client, newest first. Optionally filter by business_id or export_type.",
        "operationId": "exports.get",
        "parameters": [
          {
            "name": "business_id",
            "in": "query",
            "description": "When provided, only return exports associated with this business.",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          },
          {
            "name": "export_type",
            "in": "query",
            "description": "When provided, only return exports of this type.",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/ExportType"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of export requests.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiExport"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "business_id is not a valid UUID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business not found for the authenticated client.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/exports/{exportId}": {
      "get": {
        "tags": [],
        "summary": "Fetch export",
        "description": "Returns a single async export request for the authenticated client. When status is completed, download_url contains a presigned link to the generated file.",
        "operationId": "exports.id.get",
        "parameters": [
          {
            "name": "exportId",
            "in": "path",
            "description": "The UUID of the export request.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Export request.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiExport"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Export not found for the authenticated client.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/reports/bookkeeping/exports": {
      "post": {
        "tags": [],
        "summary": "Create bookkeeping status report export",
        "description": "Starts an async XLSX export of bookkeeping status for the authenticated client's enrolled businesses. The workbook contains Businesses and Periods sheets. Returns an export resource; poll GET /v1/exports/{exportId} or subscribe to export.completed / export.failed webhooks for completion.",
        "operationId": "reports.bookkeeping.exports.post",
        "parameters": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BookkeepingStatusReportExportParameters"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Export request accepted and generation started.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiExport"
                    }
                  },
                  "required": [
                    "data"
                  ]
                },
                "example": {
                  "data": {
                    "type": "Export",
                    "id": "00000000-0000-0000-0000-000000000006",
                    "business_id": null,
                    "export_type": "bookkeeping_status_report",
                    "status": "pending",
                    "params": {
                      "use_derived_status": false,
                      "require_onboarding_call": true
                    },
                    "download_url": null,
                    "file_name": null,
                    "error": null,
                    "created_at": "2026-08-04T14:00:00-04:00",
                    "started_at": null,
                    "completed_at": null,
                    "failed_at": null
                  }
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/reports/bookkeeping": {
      "get": {
        "tags": [],
        "summary": "List bookkeeping businesses",
        "description": "Returns a paginated list of businesses enrolled in bookkeeping for the authenticated client. Businesses with NOT_PURCHASED status are excluded. Designed for lightweight discovery and analytics dashboards.",
        "operationId": "reports.bookkeeping.get",
        "parameters": [
          {
            "name": "sort_by",
            "in": "query",
            "description": "Sort key. Only business_id is supported.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["business_id"]
            }
          },
          {
            "name": "sort_order",
            "in": "query",
            "description": "Sort direction. Accepts ASC, ASCENDING, DES, DESC, or DESCENDING (case-insensitive). Defaults to ASC.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "ASC"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Pagination cursor for fetching the next page of results.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Maximum number of results to return. Must be at least 1. Defaults to 100.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 100
            }
          },
          {
            "name": "show_total_count",
            "in": "query",
            "description": "When true, include total_count in pagination metadata.",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated list of enrolled bookkeeping businesses.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiBookkeepingReportingBusiness"
                      }
                    },
                    "meta": {
                      "$ref": "#/components/schemas/RequestMetadata"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid pagination parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/bookkeeping/status": {
      "get": {
        "tags": [],
        "summary": "Fetch bookkeeping reporting status",
        "description": "Returns a rich bookkeeping status summary for a single business, including enrollment dates, periods waiting on the business, latest closed period, pending tasks, disconnected bank accounts, and last inbound SMS.",
        "operationId": "business.reports.bookkeeping.status.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bookkeeping reporting status summary.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBookkeepingReportingSummary"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or bookkeeping configuration not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/reports/bookkeeping/periods": {
      "get": {
        "tags": [],
        "summary": "Fetch bookkeeping reporting periods",
        "description": "Returns the current bookkeeping status summary together with historical bookkeeping periods for a business. Periods include simplified external status, billing status, closing timeline milestones, and per-period task metrics. Newest periods are returned first; inactive and ongoing periods are excluded.",
        "operationId": "business.reports.bookkeeping.periods.get",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Bookkeeping period history for the business.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/ApiBookkeepingReportingPeriods"
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "404": {
            "description": "Business or bookkeeping configuration not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    },
    "/v1/businesses/{businessId}/receipts/import": {
      "post": {
        "tags": [],
        "summary": "Import receipt",
        "description": "Upload a single receipt for parsing on behalf of a business, such as an image or PDF submitted by a customer or platform. The uploaded file is run through Layer's receipt parsing pipeline, which proposes a vendor, amount, and line items that can be reviewed and turned into a bill. This endpoint expects a multipart upload.",
        "operationId": "business.receipts.import.post",
        "parameters": [
          {
            "name": "businessId",
            "in": "path",
            "description": "The UUID of the business to import the receipt for.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Content-Type",
            "in": "header",
            "description": "Content-Type must be set to multipart/form-data.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "file"
                ],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The receipt file. Images (jpg, png) and PDFs, including multi-page PDFs, are supported."
                  },
                  "context": {
                    "type": "string",
                    "description": "Optional contextual notes about the receipt to help guide parsing, such as who the purchase was for or what it was used for."
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Receipt uploaded and parsed successfully.",
            "headers": {},
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ApiReceiptParseResult"
                      }
                    }
                  },
                  "required": [
                    "data"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request. Possible causes: no file uploaded, more than one file uploaded, unrecognized form fields, or an unsupported file type.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          },
          "404": {
            "description": "Business id is not found. This indicates the business id is invalid or the business has been archived.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiError"
                }
              }
            }
          }
        },
        "deprecated": false
      }
    }
  },
  "components": {
    "parameters": {
      "CallListBusinessId": {
        "name": "businessId",
        "in": "path",
        "required": true,
        "description": "The UUID of the business.",
        "schema": { "type": "string", "format": "uuid" }
      },
      "CallListCursor": {
        "name": "cursor",
        "in": "query",
        "description": "Opaque cursor from meta.pagination.cursor. Omit for the first page. Keep filters and sort settings unchanged between pages.",
        "schema": { "type": "string" }
      },
      "CallListLimit": {
        "name": "limit",
        "in": "query",
        "description": "Maximum number of results per page.",
        "schema": { "type": "integer", "minimum": 1, "maximum": 1000, "default": 100 }
      },
      "CallListShowTotalCount": {
        "name": "show_total_count",
        "in": "query",
        "description": "Include the total number of matching results in meta.pagination.total_count.",
        "schema": { "type": "boolean", "default": false }
      },
      "CallSummarySortBy": {
        "name": "sort_by",
        "in": "query",
        "schema": { "type": "string", "enum": ["started_at"], "default": "started_at" }
      },
      "CallSummarySortOrder": {
        "name": "sort_order",
        "in": "query",
        "schema": { "type": "string", "enum": ["ASC", "DESC"], "default": "DESC" }
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    },
    "schemas": {
      "ApiCallBooking": {
        "type": "object",
        "description": "A bookkeeping call booking. COMPLETED means the start time has passed; it does not confirm attendance.",
        "required": ["id", "business_id", "external_id", "purpose", "state", "call_type", "event_start_at", "call_link", "cancellation_reason", "did_attend", "invitee_email", "bookkeeper_name", "bookkeeper_email", "created_at", "updated_at", "deleted_at"],
        "properties": {
          "type": { "type": "string", "enum": ["call_booking"] },
          "id": { "type": "string", "format": "uuid" },
          "business_id": { "type": "string", "format": "uuid", "nullable": true },
          "external_id": { "type": "string", "description": "The external Calendly event identifier." },
          "purpose": { "type": "string", "enum": ["BOOKKEEPING_ONBOARDING", "ADHOC"] },
          "state": { "type": "string", "enum": ["SCHEDULED", "CANCELLED", "COMPLETED"] },
          "call_type": { "type": "string", "enum": ["ZOOM", "GOOGLE_MEET"] },
          "event_start_at": { "type": "string", "format": "date-time" },
          "call_link": { "type": "string", "description": "The meeting link." },
          "cancellation_reason": { "type": "string", "nullable": true },
          "did_attend": { "type": "boolean", "nullable": true },
          "invitee_email": { "type": "string", "nullable": true },
          "bookkeeper_name": { "type": "string" },
          "bookkeeper_email": { "type": "string" },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time" },
          "deleted_at": { "type": "string", "format": "date-time", "nullable": true, "description": "The cancellation timestamp, or null if the booking is not cancelled." }
        }
      },
      "ApiCallSummary": {
        "type": "object",
        "description": "The public call representation. Booking and recording details are not included.",
        "required": ["id", "started_at", "recorded"],
        "properties": {
          "type": { "type": "string", "enum": ["Call_Summary"] },
          "id": { "type": "string", "format": "uuid", "description": "The booking ID when a booking exists; otherwise the recorded-call ID." },
          "started_at": { "type": "string", "format": "date-time", "description": "The call start timestamp. The combined calls list uses the booking start time when a booking exists." },
          "recorded": { "type": "boolean", "description": "Whether a recording exists." }
        }
      },
      "BankStatementImportResult": {
        "type": "object",
        "properties": {
          "custom_account_id": { "type": "string", "format": "uuid" },
          "upload_id": { "type": "string", "format": "uuid" },
          "statement": { "$ref": "#/components/schemas/ImportedBankStatement" },
          "created_transaction_count": { "type": "integer", "description": "Number of posted transactions created." },
          "pending_transaction_count": { "type": "integer", "description": "Number of pending transactions on the statement; these are not imported." },
          "checks": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/BankStatementImportCheck" }
          }
        },
        "required": ["custom_account_id", "upload_id", "statement", "created_transaction_count", "pending_transaction_count", "checks"]
      },
      "ImportedBankStatement": {
        "type": "object",
        "properties": {
          "starting_balance": { "$ref": "#/components/schemas/BankStatementImportBalance" },
          "ending_balance": { "$ref": "#/components/schemas/BankStatementImportBalance" },
          "transactions": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/BankStatementImportTransaction" }
          }
        },
        "required": ["starting_balance", "ending_balance", "transactions"]
      },
      "BankStatementImportBalance": {
        "type": "object",
        "properties": {
          "date": { "type": "string", "format": "date" },
          "amount": { "type": "integer", "format": "int64", "description": "Balance in cents." }
        },
        "required": ["date", "amount"]
      },
      "BankStatementImportTransaction": {
        "type": "object",
        "properties": {
          "date": { "type": "string", "format": "date" },
          "amount": { "type": "integer", "format": "int64", "description": "Transaction amount in cents." },
          "direction_reason": { "type": "string", "description": "Explanation of the parsed direction; may be empty." },
          "direction": { "type": "string", "enum": ["CREDIT", "DEBIT"] },
          "status": { "type": "string", "enum": ["POSTED", "PENDING"] },
          "description": { "type": "string" }
        },
        "required": ["date", "amount", "direction_reason", "direction", "status", "description"]
      },
      "BankStatementImportCheck": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "enum": ["POSTED_TRANSACTIONS_PRESENT", "TRANSACTION_AMOUNTS_NON_NEGATIVE", "STATEMENT_INTERNAL_BALANCE_CONSISTENCY", "TRANSACTION_DATES_WITHIN_STATEMENT_DATES", "STATEMENT_DATES_WITHIN_CUSTOM_ACCOUNT_DATES", "BALANCE_DATES_WITHIN_BOOKKEEPING_PERIOD", "ACCOUNT_BALANCE_CONTINUITY"]
          },
          "status": { "type": "string", "enum": ["passed", "failed", "skipped"] },
          "details": { "type": "string" },
          "violating_transactions": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/BankStatementImportTransaction" }
          }
        },
        "required": ["name", "status", "details", "violating_transactions"]
      },
      "PaginationMetadata": {
        "type": "object",
        "description": "Cursor-based pagination metadata returned alongside paginated list responses.",
        "properties": {
          "sort_by": {
            "type": "string",
            "nullable": true,
            "description": "Field the result set is sorted by."
          },
          "sort_order": {
            "type": "string",
            "enum": [
              "ASC",
              "DESC"
            ],
            "description": "Sort direction applied to the result set.",
            "example": "ASC"
          },
          "cursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque pagination cursor. Pass it using the query parameter documented for the endpoint only when has_more is true. A cursor can be present on the last page."
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether additional pages are available after the current one."
          },
          "total_count": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Total number of records across all pages, when available."
          }
        },
        "required": [
          "sort_by",
          "sort_order",
          "cursor",
          "has_more"
        ]
      },
      "AdminBusiness": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Admin_Business`.",
            "example": "Admin_Business"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string",
            "nullable": true,
            "description": "Display name of the business."
          },
          "bookkeeper": {
            "type": "object",
            "nullable": true,
            "description": "The assigned bookkeeper, if any.",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "email": {
                "type": "string"
              }
            }
          },
          "business_stats": {
            "type": "object",
            "properties": {
              "uncategorized_transaction_count": {
                "type": "integer",
                "description": "Number of uncategorized bank transactions."
              },
              "bank_accounts": {
                "type": "object",
                "properties": {
                  "linked": {
                    "type": "integer"
                  },
                  "import_only": {
                    "type": "integer"
                  }
                }
              },
              "pending_task_count": {
                "type": "integer",
                "description": "Number of pending business tasks."
              },
              "ongoing_step_count": {
                "type": "integer",
                "description": "Number of ongoing bookkeeping steps in TO_DO status."
              },
              "self_evaluating_steps": {
                "type": "object",
                "properties": {
                  "todo_count": {
                    "type": "integer"
                  },
                  "complete_count": {
                    "type": "integer"
                  },
                  "complete_auto_count": {
                    "type": "integer"
                  },
                  "todo_subset": {
                    "type": "object",
                    "properties": {
                      "description": {
                        "type": "string"
                      },
                      "count": {
                        "type": "integer"
                      }
                    }
                  }
                }
              }
            }
          },
          "bookkeeping_periods": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid"
                },
                "year": {
                  "type": "integer",
                  "nullable": true
                },
                "month": {
                  "type": "integer",
                  "nullable": true
                },
                "scale": {
                  "type": "string",
                  "enum": [
                    "MONTHLY",
                    "QUARTERLY",
                    "ANNUAL",
                    "CUSTOM"
                  ]
                },
                "status": {
                  "type": "string"
                },
                "billing_status": {
                  "type": "string"
                },
                "bookkeeper_id": {
                  "type": "string",
                  "format": "uuid",
                  "nullable": true
                },
                "high_priority_todo_count": {
                  "type": "integer"
                },
                "normal_priority_todo_count": {
                  "type": "integer"
                }
              }
            }
          }
        }
      },
      "ApiCheckPayrollConfig": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Api_Check_Payroll_Config`.",
            "example": "Api_Check_Payroll_Config"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the Check payroll config."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the business this config belongs to."
          },
          "check_company_id": {
            "type": "string",
            "description": "The Check company ID associated with this config."
          }
        },
        "required": [
          "id",
          "business_id",
          "check_company_id"
        ]
      },
      "CreateCheckPayrollConfigParams": {
        "type": "object",
        "properties": {
          "check_company_id": {
            "type": "string",
            "description": "The Check company ID to associate with this business."
          }
        },
        "required": [
          "check_company_id"
        ]
      },
      "QuickbooksConnectionStatus": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Quickbooks_Connection_Status`.",
            "example": "Quickbooks_Connection_Status"
          },
          "is_connected": {
            "type": "boolean",
            "description": "Whether Quickbooks is connected for the business."
          },
          "last_synced_at": {
            "type": "string",
            "format": "date-time",
            "description": "The last time Quickbooks was synced for the business."
          },
          "last_sync_status": {
            "$ref": "#/components/schemas/QuickbooksSyncStatus",
            "description": "The status of the last Quickbooks sync for the business."
          },
          "is_syncing": {
            "type": "boolean",
            "description": "Whether Quickbooks is currently syncing for the business."
          },
          "sync_failure_reason": {
            "type": "string",
            "enum": [
              "QUICKBOOKS_AUTHENTICATION_FAILURE",
              "QUICKBOOKS_AUTHORIZATION_FAILURE",
              "QUICKBOOKS_SERVICE_UNAVAILABLE",
              "QUICKBOOKS_INTERNAL_SERVER_ERROR",
              "QUICKBOOKS_GENERAL_SERVICE_FAILURE",
              "QUICKBOOKS_VALIDATION_ERROR",
              "QUICKBOOKS_BAD_REQUEST",
              "QUICKBOOKS_INVALID_REQUEST_STATE",
              "QUICKBOOKS_INVALID_CREDENTIALS",
              "QUICKBOOKS_CONFIGURATION_ERROR",
              "QUICKBOOKS_UNKNOWN_EXCEPTION",
              "INTERNAL_SERVER_ERROR"
            ],
            "description": "The specific reason for sync failure when `last_sync_status` is `SYNC_FAILURE`.\n\nProvides detailed categorization of the failure type to help with troubleshooting and determining appropriate next steps.\n\nDetailed categorization of QuickBooks sync failure reasons:\n\n- `QUICKBOOKS_AUTHENTICATION_FAILURE`: The OAuth token used to connect to QuickBooks is expired or invalid. Retryable after re-authentication.\n- `QUICKBOOKS_AUTHORIZATION_FAILURE`: The QuickBooks app is not authorized by the user or organization. Retryable after reauthorization.\n- `QUICKBOOKS_SERVICE_UNAVAILABLE`: QuickBooks service is temporarily unavailable (e.g., 503 error). Retryable with backoff.\n- `QUICKBOOKS_INTERNAL_SERVER_ERROR`: Internal error occurred within QuickBooks (e.g., 500 response). Retryable temporary issue.\n- `QUICKBOOKS_GENERAL_SERVICE_FAILURE`: A general SDK-level failure not covered by specific categories. May be retryable depending on context.\n- `QUICKBOOKS_VALIDATION_ERROR`: Request rejected by QuickBooks due to validation constraints (e.g., field format). Not retryable.\n- `QUICKBOOKS_BAD_REQUEST`: Malformed or structurally invalid request sent to QuickBooks. Not retryable; requires code fix.\n- `QUICKBOOKS_INVALID_REQUEST_STATE`: Request is logically valid but not allowed in current QuickBooks state (e.g., closed period). Not retryable.\n- `QUICKBOOKS_INVALID_CREDENTIALS`: Credentials were revoked or permanently rejected. Not retryable; requires new connection.\n- `QUICKBOOKS_CONFIGURATION_ERROR`: Integration is misconfigured (e.g., missing realm ID or base URL). Not retryable until corrected.\n- `QUICKBOOKS_UNKNOWN_EXCEPTION`: An unknown or unclassified error occurred during QuickBooks sync. Not retryable until corrected.\n- `INTERNAL_SERVER_ERROR`: A generic internal failure occurred within Layer\u2019s infrastructure during sync. Not retryable until corrected.",
            "example": "QUICKBOOKS_AUTHENTICATION_FAILURE"
          },
          "is_retryable_failure": {
            "type": "boolean",
            "description": "Indicates whether the sync can be retried after `SYNC_FAILURE`. When true, the failure may be temporary (e.g., network issues, service unavailable) and retrying the sync operation may succeed. When false, the failure requires manual intervention (e.g., invalid credentials, configuration errors)."
          }
        }
      },
      "CreateCategorizationRuleParams": {
        "type": "object",
        "description": "Parameters for creating or updating a categorization rule. At least one filter must be specified.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Optional name for the rule."
          },
          "category": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_1": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_2": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_3": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "apply_retroactively": {
            "type": "boolean",
            "default": false,
            "description": "Whether to apply this rule to existing uncategorized transactions."
          },
          "external_id": {
            "type": "string",
            "description": "External identifier for idempotency. Used for create/upsert operations."
          },
          "created_by_suggestion_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the suggestion that created this rule (if applicable)."
          },
          "merchant_type_filter": {
            "type": "string",
            "description": "Regex pattern that matches the entire merchant name. Patterns must contain 1 to 1,024 characters. Lookaround and backreferences are not supported.",
            "minLength": 1,
            "maxLength": 1024
          },
          "transaction_description_filter": {
            "type": "string",
            "description": "Regex pattern that matches the entire transaction description. Patterns must contain 1 to 1,024 characters. Lookaround and backreferences are not supported.",
            "minLength": 1,
            "maxLength": 1024
          },
          "counterparty_filter": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of a specific counterparty (merchant/vendor) to match."
          },
          "bank_transaction_type_filter": {
            "$ref": "#/components/schemas/BankTransactionType"
          },
          "bank_direction_filter": {
            "type": "string",
            "enum": [
              "MONEY_IN",
              "MONEY_OUT"
            ],
            "description": "Transaction direction to match.",
            "example": "MONEY_OUT"
          },
          "amount_min_filter": {
            "type": "integer",
            "format": "int64",
            "description": "Minimum transaction amount in cents."
          },
          "amount_max_filter": {
            "type": "integer",
            "format": "int64",
            "description": "Maximum transaction amount in cents."
          }
        }
      },
      "CategorizationRule": {
        "type": "object",
        "description": "A categorization rule that automatically categorizes transactions matching specified filters.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Categorization_Rule`.",
            "example": "Categorization_Rule"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the rule."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "The business this rule belongs to."
          },
          "name": {
            "type": "string",
            "description": "Name of the rule."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the rule was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the rule was last updated."
          },
          "category": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_1": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_2": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_3": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "merchant_type_filter": {
            "type": "string",
            "description": "Regex pattern matching merchant type."
          },
          "transaction_description_filter": {
            "type": "string",
            "description": "Regex pattern matching transaction description."
          },
          "counterparty_filter": {
            "$ref": "#/components/schemas/BankTransactionCounterparty"
          },
          "bank_transaction_type_filter": {
            "$ref": "#/components/schemas/BankTransactionType"
          },
          "bank_direction_filter": {
            "type": "string",
            "enum": [
              "MONEY_IN",
              "MONEY_OUT"
            ],
            "description": "Transaction direction that this rule matches.",
            "example": "MONEY_OUT"
          },
          "amount_min_filter": {
            "type": "integer",
            "format": "int64",
            "description": "Minimum amount in cents."
          },
          "amount_max_filter": {
            "type": "integer",
            "format": "int64",
            "description": "Maximum amount in cents."
          }
        },
        "required": [
          "id",
          "business_id",
          "created_at",
          "updated_at"
        ]
      },
      "BankTransactionType": {
        "type": "string",
        "description": "Type of bank transaction.",
        "enum": [
          "REVENUE",
          "LOAN_DISBURSEMENT",
          "REFUND_RECEIVED",
          "INCOMING_P2P_TRANSFER",
          "INTRA_ACCOUNT_TRANSFER_IN",
          "CHECK_WITHDRAWAL",
          "ATM_DEPOSIT",
          "BANK_DEPOSIT",
          "BANK_VERIFICATION_TRIAL_CREDIT",
          "REVERSAL_IN",
          "CREDIT_CARD_REWARD",
          "CREDIT_CARD_PAYMENT_IN",
          "INTEREST_EARNED",
          "GOVERNMENT_OR_OTHER_GRANT",
          "TAX_REFUND",
          "PURCHASE",
          "REFUND_GIVEN",
          "OUTGOING_P2P_TRANSFER",
          "INTRA_ACCOUNT_TRANSFER_OUT",
          "CHECK_DEPOSIT",
          "CREDIT_CARD_PAYMENT_OUT",
          "ATM_WITHDRAWAL",
          "BANK_WITHDRAWAL",
          "BANKING_FEE",
          "PAYMENT_PROCESSING_FEE",
          "BANK_VERIFICATION_TRIAL_DEBIT",
          "REVERSAL_OUT",
          "LOAN_PAYMENT",
          "TAX_PAYMENT",
          "CASH_DEPOSIT_OR_WITHDRAWAL",
          "CHECK_DEPOSIT_OR_WITHDRAWAL",
          "NOT_ENOUGH_INFORMATION"
        ],
        "example": "PURCHASE"
      },
      "BankTransactionCounterparty": {
        "type": "object",
        "description": "Information about a transaction counterparty (merchant/vendor).",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the counterparty."
          },
          "name": {
            "type": "string",
            "description": "Name of the counterparty."
          },
          "logo_url": {
            "type": "string",
            "description": "URL to the counterparty's logo."
          },
          "website": {
            "type": "string",
            "description": "Counterparty website."
          }
        }
      },
      "QuickbooksSyncStatus": {
        "type": "string",
        "enum": [
          "SYNC_SUCCESS",
          "SYNC_FAILURE"
        ],
        "description": "The status of a Quickbooks sync.",
        "example": "SYNC_SUCCESS"
      },
      "QuickbooksSyncFromParams": {
        "type": "object",
        "properties": {
          "quickbooks_realm_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of Quickbooks realm IDs to sync from. If not provided, all connected realms will be synced."
          }
        }
      },
      "ApiQuickbooksLedger": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the Quickbooks ledger."
          },
          "export_upload_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the export upload associated with the Quickbooks ledger."
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the Quickbooks connection associated with the Quickbooks ledger."
          },
          "is_nested": {
            "type": "boolean",
            "description": "Whether the Quickbooks ledger is nested."
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiQuickbooksLedgerAccount"
            },
            "description": "List of Quickbooks ledger accounts."
          }
        }
      },
      "ApiQuickbooksLedgerAccount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the Quickbooks ledger account."
          },
          "name": {
            "type": "string",
            "description": "The name of the Quickbooks ledger account."
          },
          "stable_name": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The stable name of the Quickbooks ledger account."
          },
          "normality": {
            "$ref": "#/components/schemas/LedgerEntryDirection",
            "description": "The normality of the Quickbooks ledger account."
          },
          "account_type": {
            "$ref": "#/components/schemas/ApiLedgerAccountType",
            "description": "The type of the Quickbooks ledger account."
          },
          "account_subtype": {
            "$ref": "#/components/schemas/ApiLedgerAccountSubtype",
            "description": "The subtype of the Quickbooks ledger account."
          },
          "balance": {
            "type": "integer",
            "description": "The balance of the Quickbooks ledger account."
          },
          "local_ledger_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "The local ledger account associated with the Quickbooks ledger account."
          },
          "child_accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiQuickbooksLedgerAccount"
            },
            "description": "The child accounts of the Quickbooks ledger account."
          }
        }
      },
      "UpdateQuickbooksLocalLedgerAccountMappingRequest": {
        "type": "object",
        "properties": {
          "local_ledger_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The local ledger account identifier to map the Quickbooks ledger account to."
          }
        }
      },
      "NewTagsPostParamsWithEntity": {
        "type": "object",
        "properties": {
          "key_values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "List of key-value pairs used to create new tags."
          },
          "entity_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The entity IDs to create each new tag for."
          },
          "entity_type": {
            "$ref": "#/components/schemas/TaggableEntityType",
            "description": "The type of entity to tag."
          }
        },
        "required": [
          "key_values",
          "entity_ids",
          "entity_type"
        ]
      },
      "TagsDeleteParamsWithEntity": {
        "type": "object",
        "properties": {
          "tag_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "List of tag IDs to delete."
          },
          "entity_type": {
            "$ref": "#/components/schemas/TaggableEntityType",
            "description": "The type of entity to remove tags from."
          }
        },
        "required": [
          "tag_ids",
          "entity_type"
        ]
      },
      "TaggableEntityType": {
        "type": "string",
        "enum": [
          "CUSTOMER",
          "VENDOR",
          "BANK_TRANSACTION",
          "INVOICE",
          "INVOICE_PAYMENT",
          "INVOICE_PAYMENT_ALLOCATION",
          "INVOICE_WRITE_OFF",
          "BILL",
          "BILL_PAYMENT",
          "BILL_PAYMENT_ALLOCATION",
          "MANUAL_JOURNAL_ENTRY",
          "MANUAL_JOURNAL_ENTRY_LINE_ITEM",
          "CLOSING_ACTION",
          "CUSTOMER_PAYOUT",
          "VENDOR_PAYOUT",
          "PAYROLL",
          "PAYROLL_PAYMENT",
          "OPENING_BALANCE",
          "CUSTOMER_REFUND",
          "CUSTOMER_REFUND_PAYMENT",
          "CUSTOMER_REFUND_ALLOCATION",
          "CUSTOMER_REFUND_ALLOCATION_LINE_ITEM",
          "VENDOR_REFUND",
          "VENDOR_REFUND_PAYMENT",
          "VENDOR_REFUND_ALLOCATION",
          "VENDOR_REFUND_ALLOCATION_LINE_ITEM",
          "LEDGER_ENTRY",
          "QUICKBOOKS_LEDGER_ENTRY",
          "VENDOR_CREDIT",
          "CUSTOMER_CREDIT",
          "INVOICE_LINE_ITEM",
          "BILL_LINE_ITEM",
          "VENDOR_CREDIT_LINE_ITEM",
          "CUSTOMER_CREDIT_LINE_ITEM",
          "BANK_ACCOUNT"
        ],
        "description": "Type of entity that can be tagged.",
        "example": "BANK_TRANSACTION"
      },
      "APIUnitAccount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The Unit account\u2019s ID.",
            "example": "111111"
          },
          "importedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the Unit account was imported."
          }
        }
      },
      "ApiPlaidInstitution": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated. Use `layer_id` instead.",
            "example": "550e8400-e29b-41d4-a716-446655440000"
          },
          "layer_id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer\u2019s unique identifier for this Plaid institution.",
            "example": "550e8400-e29b-41d4-a716-446655440000"
          },
          "plaid_institution_id": {
            "type": "string",
            "description": "The Plaid institution\u2019s ID within Plaid.",
            "example": "ins_1"
          },
          "name": {
            "type": "string",
            "description": "The Plaid institution\u2019s name.",
            "example": "Bank of America"
          },
          "logo": {
            "type": "string",
            "nullable": true,
            "description": "The Plaid institution\u2019s logo.",
            "example": "iVBORw0KGgoAAAANSUhEUgAAAJgAAACYCAMAAAAvHNATAAAA6lBMVEUAAAD////////////////////////////////////////////////////////////////////////////////qUmn74ubnNVD4xc398fLlJkT1qLTf4+zpRFzrYHb509rvfY7xjJuAkLTzmqfxi5vzmai/x9lBWY7v8fXtb4LjGDftboIhPXwBIWkRL3P3t8D2t8HsYHbvfo7P1ePzmqigrMeQnr3oRF1RZphhdaGQnb0xS4Wfq8dgdKHuboL609lwgqtgdaFwgqqvutCfrMevudCQnr5BWY/pQ11RZpeQnb70qLRRZ5f98fO30r7oAAAAFHRSTlMA3yDvv0AQn2DPcFCAoJAwf4+vXxXsOc8AAAYDSURBVHhe7ZwHcus4EESZo5L9h1nROfvnvDmn+19nvevvoqimQAKgRFTtvguwa7pnIEIgNFmM0DtwLV/X6V903bLcQWCPtR4ZB65v0jZ8N7B7EGUHFmhCTCvYZ+kc+8Ck1uhuqO0FUNWM6e7cVGdikhC6Z+yyWK5J4ri7kmZbJIllKyILsbo21ABZShjqTKhDJo7WEaFOnaJ73ZTrkAAV/AxNAhQomnNAO+JAKmmGTjtDl7DzmUk7xBS2c0I7ZiIWL5d2jiuiy6c94BuqxB5bQBVdqEwVXahMFV2oTA1diN52EfBpz/jtlLm0d1zhea/AGuBRLzxrDL5JvWA2tKYDDalIax5QbxwoEjAkVGOyIqajxgRDDhUxEgmbOlKxzpxQ7wxqk08KYKiRfMRSpGCIDcIsIiVLZpMkWfEyn13eZ9Il67Rg6Sq6+kJ0+o1cybpM2PN5frVG8jKVKVm3LZku31W0XQprcztvybiIqnWL5ddyT6hIUXSabnbAfF1bVMSS418nXrLVY6zyFxsPz6p1E7DUlJgVacQqTFwk65Zyl80WjX4cXW0yO61qS6/XhXMOkJH2hMmf88cBAXWDsuWXRSYc/5BESK+TTW0v7quGz09SEsEGJ6W1JZcxyTPi6smLn89qtZWeNvVhlhYxT1+OW8k6uru9vfvzzZSAItrshJiQ7DTK/5Edt/cyoEam390+8Qtqo3jd0vwE0x6Xi3wraQH8sNgmq+T8jOp4Gl3RaVZTq2oOV3G7nxhms4koC3kePchKGbMYpbFDZgvKQtK0duFC8uWC2IybIrYu6+anqr93H6ZtFi5UBfqRgD3Fzm5KWXdHNbH7UDqLyXpXp+pF2nrv098q6/y25Oii4m9ZxjeEoIfYGWz8B2HbwlVpxSnErpT2QztZaCE7/ePmzN9UDPvx0d/S4ovtsmC6AenxtldyuzlcF+Avr6worVf18sHwpCCEwrqmnJ5vdfHb2wrvp+KystVTd/waE+BpA9C13cWPpb8w1kAWe1FPK298uEyNtCG6WPL9ulGvNlx8C8sSyMJH1q/76KdbrpTo1aczcBE14zhFWWg3klT9tDaEfYKKQCHBYngPwGyhLCSKq4NMpwqfz1uE/u4InyYpa3NF0PGVcvoVs1yl5pI0QWeYspqHnK4RMj16zyrXW3QRn8QpC9GITXO5XqM5y4xTFrcwbMbNci2iduEqEoYsAWGvNprxFVVZoTHHzC0FlCUk7CN7di1mOLkyAuI5pywUhh3Kml0rVi9iuDCILJredqe/QeqhGZnPSpPmcYrgHEM+30Dq65txtmBuDGF/sIX51MjRDaQ+wwc+ji5Uj+QFMYC1ksH09wv0p7lc6azWRch8vbAh8bPEdBGQLTnCBbjaiHjB3CQpM/TYts0M+Des0xybkV0udLGZQAtlbczv25YrWvBsKhpCNmJmsFy4VnEw5twZjq9hSLQs1zwjHvhPixVJQ5aXQqHHLQKYFxxFizL0esaxLrI3VQLi5fhLXx4zRj13uXAbakzcxEm9O9lcoly4O2wSPyfQjZB6KBcHpvi/zjEBK9FmRCz2djrvhEPyP0iIQPYAAdtGsJtnvAqFrKWNxySIrj0yIkmyOhuTheSxWHkvF3U2fp3JnyNz5Lx8ncuu2DgsuvAylbcRnezEyyKRtxHHfhd9GSdS3Yg9WTIgOU5gDZLA00qE44/7wrO40+OAQwLE7Fxm3Z7tt0mWv67hdVwMAw+2SQctv+/+LKBN8jyPSR5b3cOTWDJFTugqWTJX4SPNyIB6Z6D0sXkkpJ7xtC0cKpV85lquyueMoSJGIiPqjZHSn5ip/1Ee4ikSMGSgyMhHhrR3hkp87I/4GsBozf8/FNcN9T/5V/+SBPWvlUAMv5eP/RWZZ0NHE2HQ47xn4/V8PY76Fwohzoh2xMjR5PD0ndgYatIYO+jOQyiXEkXTQ60jnE4HxwDK1Z+f6t8LaNn/mQse0VC1bhI1RDvUhMh3jj00uVWNbG0vhEOdS5Wj7Y9xy6t9e7p3eOhv1+S7Qb9XNdvBwLWs8vpo33JHXig9Rv8G+MxS+LqktYUAAAAASUVORK5CYII="
          }
        }
      },
      "ApiPlaidItem": {
        "type": "object",
        "properties": {
          "layer_item_id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer\u2019s unique identifier for this Plaid item. Can be used to reference this item when updating a business.",
            "example": "550e8400-e29b-41d4-a716-446655440000"
          },
          "access_token": {
            "type": "string",
            "example": "access-sandbox-a67d0be8-abcd-1234-5678-14fc7bc65366"
          },
          "institution": {
            "$ref": "#/components/schemas/ApiPlaidInstitution"
          },
          "item_id": {
            "type": "string",
            "example": "V3jvONy9xbroJVaRnm6oiAqVMv5Qz3TrNyLdL"
          },
          "sync_transactions": {
            "type": "boolean"
          }
        }
      },
      "ApiPlaidProcessorToken": {
        "type": "object",
        "properties": {
          "layer_processor_token_id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer\u2019s unique identifier for this Plaid processor token. Can be used to reference this token when updating a business.",
            "example": "550e8400-e29b-41d4-a716-446655440000"
          },
          "plaid_processor_token": {
            "type": "string",
            "example": "processor-sandbox-d8e791d1-1234-9876-a207-69acca316045"
          }
        }
      },
      "ApiStripeConnectAccount": {
        "type": "object",
        "properties": {
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the Stripe Connect account was archived."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the Stripe Connect account was created."
          },
          "createdInStripe": {
            "type": "string",
            "format": "date-time",
            "description": "When the account was created in Stripe Connect."
          },
          "lastSyncedAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the Stripe Connect account was last synced in Layer."
          },
          "merchantName": {
            "type": "string",
            "description": "Merchant name associated with the Stripe Connect account.",
            "example": "Example Merchant"
          },
          "stripeConnectAccountStripeId": {
            "type": "string",
            "description": "Stripe's ID for the Stripe Connect account.",
            "example": "acct_1Nd0q5QiTVB2FAKE"
          }
        }
      },
      "BusinessType": {
        "type": "string",
        "enum": [
          "SOLE_PROP",
          "C_CORP",
          "LLC",
          "S_CORP",
          "PARTNERSHIP",
          "NON_PROFIT",
          "TRUST"
        ],
        "description": "Type of the business.",
        "example": "LLC"
      },
      "USState": {
        "type": "string",
        "enum": [
          "AL",
          "AK",
          "AZ",
          "AR",
          "CA",
          "CO",
          "CT",
          "DE",
          "DC",
          "FL",
          "GA",
          "HI",
          "ID",
          "IL",
          "IN",
          "IA",
          "KS",
          "KY",
          "LA",
          "ME",
          "MD",
          "MA",
          "MI",
          "MN",
          "MS",
          "MO",
          "MT",
          "NE",
          "NV",
          "NH",
          "NJ",
          "NM",
          "NY",
          "NC",
          "ND",
          "OH",
          "OK",
          "OR",
          "PA",
          "PR",
          "RI",
          "SC",
          "SD",
          "TN",
          "TX",
          "UT",
          "VT",
          "VI",
          "VA",
          "WA",
          "WV",
          "WI",
          "WY"
        ],
        "description": "Which United States state the business is incorporated in.",
        "example": "CA"
      },
      "Country": {
        "type": "string",
        "enum": [
          "AF",
          "AL",
          "DZ",
          "AS",
          "AD",
          "AO",
          "AI",
          "AQ",
          "AG",
          "AR",
          "AM",
          "AW",
          "AU",
          "AT",
          "AZ",
          "BS",
          "BH",
          "BD",
          "BB",
          "BY",
          "BE",
          "BZ",
          "BJ",
          "BM",
          "BT",
          "BO",
          "BA",
          "BW",
          "BV",
          "BR",
          "IO",
          "BN",
          "BG",
          "BF",
          "BI",
          "KH",
          "CM",
          "CA",
          "CV",
          "KY",
          "CF",
          "TD",
          "CL",
          "CN",
          "CX",
          "CC",
          "CO",
          "KM",
          "CG",
          "CD",
          "CK",
          "CR",
          "CI",
          "HR",
          "CU",
          "CY",
          "CZ",
          "DK",
          "DJ",
          "DM",
          "DO",
          "EC",
          "EG",
          "SV",
          "GQ",
          "ER",
          "EE",
          "ET",
          "FK",
          "FO",
          "FJ",
          "FI",
          "FR",
          "GF",
          "PF",
          "TF",
          "GA",
          "GM",
          "GE",
          "DE",
          "GH",
          "GI",
          "GR",
          "GL",
          "GD",
          "GP",
          "GU",
          "GT",
          "GN",
          "GW",
          "GY",
          "HT",
          "HM",
          "VA",
          "HN",
          "HK",
          "HU",
          "IS",
          "IN",
          "ID",
          "IR",
          "IQ",
          "IE",
          "IL",
          "IT",
          "JM",
          "JP",
          "JO",
          "KZ",
          "KE",
          "KI",
          "KP",
          "KR",
          "KW",
          "KG",
          "LA",
          "LV",
          "LB",
          "LS",
          "LR",
          "LY",
          "LI",
          "LT",
          "LU",
          "MO",
          "MK",
          "MG",
          "MW",
          "MY",
          "MV",
          "ML",
          "MT",
          "ME",
          "MH",
          "MQ",
          "MR",
          "MU",
          "YT",
          "MX",
          "FM",
          "MD",
          "MC",
          "MN",
          "MS",
          "MA",
          "MZ",
          "MM",
          "NA",
          "NR",
          "NP",
          "NL",
          "NC",
          "NZ",
          "NI",
          "NE",
          "NG",
          "NU",
          "NF",
          "MP",
          "NO",
          "OM",
          "PK",
          "PW",
          "PS",
          "PA",
          "PG",
          "PY",
          "PE",
          "PH",
          "PN",
          "PL",
          "PT",
          "PR",
          "QA",
          "RE",
          "RO",
          "RU",
          "RS",
          "RW",
          "SH",
          "KN",
          "LC",
          "PM",
          "VC",
          "WS",
          "SM",
          "ST",
          "SA",
          "SN",
          "SC",
          "SL",
          "SG",
          "SK",
          "SI",
          "SB",
          "SO",
          "ZA",
          "GS",
          "ES",
          "LK",
          "SD",
          "SR",
          "SJ",
          "SZ",
          "SE",
          "CH",
          "SY",
          "TW",
          "TJ",
          "TZ",
          "TH",
          "TL",
          "TG",
          "TK",
          "TO",
          "TT",
          "TN",
          "TR",
          "TM",
          "TC",
          "TV",
          "UG",
          "UA",
          "AE",
          "GB",
          "US",
          "UM",
          "UY",
          "UZ",
          "VU",
          "VE",
          "VN",
          "VG",
          "VI",
          "WF",
          "EH",
          "YE",
          "ZM",
          "ZW"
        ],
        "description": "Which country the business is incorporated in.",
        "example": "US"
      },
      "ApiBusiness": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the business."
          },
          "type": {
            "type": "string",
            "description": "Resource type. Value will be \u201cBusiness\u201d.",
            "example": "Business"
          },
          "external_id": {
            "type": "string",
            "description": "Unique ID of the business in your system for linking purposes. **Idempotency key**.",
            "example": "test-acme-id"
          },
          "legal_name": {
            "type": "string",
            "example": "ACME LLC",
            "description": "Legal name of the business as it has been registered."
          },
          "tin": {
            "type": "string",
            "nullable": true,
            "description": "Tax Identification Number for the business."
          },
          "us_state": {
            "$ref": "#/components/schemas/USState",
            "description": "The state this business is incorporated in."
          },
          "country": {
            "$ref": "#/components/schemas/Country",
            "description": "2 letter ISO country code representing the country this business is incorporated in. Defaults to US."
          },
          "entity_type": {
            "$ref": "#/components/schemas/BusinessType",
            "description": "Entity type of the business. Used to determine tax filing status."
          },
          "industry": {
            "type": "string",
            "description": "Industry classification for the business."
          },
          "phone_number": {
            "type": "string",
            "description": "Phone number used for SMS based categorization.",
            "example": "+16504651359"
          },
          "naics_code": {
            "type": "string",
            "nullable": true,
            "description": "6-digit NAICS code used to identify the business's industry.",
            "example": "484110"
          },
          "sms_enabled": {
            "type": "boolean",
            "description": "Whether SMS is enabled for this business."
          },
          "sms_stopped": {
            "type": "boolean",
            "description": "Whether this business has responded to Layer's SMS with \"STOP\"."
          },
          "readonly_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Time when the business became read-only, if applicable. `null` when the business is writable."
          },
          "sms_categorization_start_date": {
            "type": "string",
            "format": "date-time",
            "description": "Date when SMS categorization starts for this business."
          },
          "activation_at": {
            "type": "string",
            "format": "date-time",
            "description": "The activation timestamp represents the time at which Layer should begin displaying accounting data. Data before this time will not be displayed to users. This field is important for businesses migrating over from other accounting platforms. Defaults to Jan 1 of the current year."
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time when the business entity was created in Layer. **Eligible sort key**."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Time when the business's information was last updated in Layer. **Eligible sort key**."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Time when the business was archived, if applicable."
          },
          "unit_accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/APIUnitAccount"
            },
            "description": "List of unit accounts associated with this business."
          },
          "plaid_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiPlaidItem"
            },
            "description": "Plaid items linked to this account."
          },
          "plaid_processor_tokens": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiPlaidProcessorToken"
            },
            "description": "Plaid processor tokens linked to this account."
          },
          "previously_imported": {
            "type": "boolean",
            "nullable": true,
            "description": "True if an archived business with the same phone number was unarchived during creation."
          },
          "stripe_connect_accounts": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "List of Stripe Connect accounts associated with this business."
          },
          "default_reporting_basis": {
            "type": "string",
            "nullable": true,
            "enum": [
              "CASH",
              "ACCRUAL"
            ],
            "description": "Default accounting basis for financial reports.",
            "example": "CASH"
          },
          "default_locale": {
            "type": "string",
            "enum": [
              "en-US",
              "fr-CA"
            ],
            "default": "en-US",
            "description": "Default locale used to localize the business's content, such as SMS messages.",
            "example": "en-US"
          },
          "free_trial_ends_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The date and time when the business's free trial ends."
          }
        }
      },
      "MigrateTightUserParams": {
        "type": "object",
        "description": "Parameters for migrating a Tight user into Layer.",
        "required": [
          "user_id"
        ],
        "properties": {
          "user_id": {
            "type": "string",
            "description": "The Tight user ID to migrate into Layer.",
            "example": "tight_user_123"
          },
          "use_snapshot": {
            "type": "boolean",
            "default": false,
            "description": "When true, Layer replays the latest stored Tight snapshot for this user instead of fetching a fresh snapshot from Tight."
          },
          "run_verification_synchronously": {
            "type": "boolean",
            "default": false,
            "description": "When true, Layer waits for post-migration report verification before returning. The default is false, which returns after the business is created and sends the final result by webhook."
          },
          "free_trial_ends_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Optional free trial end timestamp to set on the migrated business."
          }
        }
      },
      "WebhookTightMigrationPayload": {
        "type": "object",
        "description": "Webhook payload sent when a Tight migration finishes or fails.",
        "required": [
          "id",
          "type",
          "business_id",
          "data"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique webhook message identifier.",
            "example": "tight_migration_finished_8e7a359e-7af5-4f6e-b786-6ddfd1807c32_03f6c94f-574d-42ca-a6cd-fecf2a2aeccb"
          },
          "type": {
            "type": "string",
            "enum": [
              "tight_migration.finished"
            ],
            "description": "Webhook event type."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer business ID created for the Tight migration."
          },
          "business_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External business ID, if one is set."
          },
          "data": {
            "$ref": "#/components/schemas/WebhookTightMigrationData"
          }
        }
      },
      "WebhookTightMigrationData": {
        "type": "object",
        "required": [
          "state"
        ],
        "properties": {
          "state": {
            "$ref": "#/components/schemas/TightMigrationState"
          }
        }
      },
      "TightMigrationState": {
        "type": "string",
        "description": "Final Tight migration state. `SUCCESS` means import and post-migration report verification completed. `SYNC_FAIL` means the migration failed before report verification completed. `VALIDATION_FAIL` means post-migration report verification found discrepancies or failed.",
        "enum": [
          "SUCCESS",
          "SYNC_FAIL",
          "VALIDATION_FAIL"
        ],
        "example": "SUCCESS"
      },
      "DemoBusinessCreateParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the demo business in your system for linking purposes. This field is optional and can be used as an idempotency key. If provided and a demo business with this external_id already exists, the existing business will be returned instead of creating a new one.",
            "example": "demo-business-123"
          }
        },
        "description": "Parameters for creating a new demo business. All fields are optional."
      },
      "SalesDemoBusinessCreateParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Optional idempotency key. If a sales demo with this ID already exists, it is returned and seeding is re-triggered. An empty plain demo with this ID is promoted to a sales demo.",
            "example": "sales-demo-123"
          },
          "enable_bookkeeping": {
            "type": "boolean",
            "default": false,
            "description": "Activate bookkeeping after seeding. Returns `400` if the client has no bookkeeping configuration."
          }
        },
        "description": "Parameters for creating a new sales demo business. All fields are optional."
      },
      "ApiRefund": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Customer_Refund`.",
            "example": "Customer_Refund"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the refund."
          },
          "external_id": {
            "type": "string",
            "description": "Unique ID of the refund in your system for linking purposes. **Idempotency key**.",
            "example": "31415926535"
          },
          "refunded_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount refunded to the customer in cents."
          },
          "status": {
            "type": "string",
            "description": "Status of the refund.",
            "example": "PAID"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time when the refund was completed."
          },
          "is_dedicated": {
            "type": "boolean",
            "description": "Whether this refund is dedicated or not. Dedicated refunds can only have one allocation and one payment.",
            "example": true
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiRefundAllocation"
            },
            "description": "Allocations associated with this refund."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiRefundPayment"
            },
            "description": "Payments associated with this refund."
          },
          "payouts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiPayoutWithoutTransactions"
            },
            "description": "Payouts associated with this refund."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the refund (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the refund. Can be used to filter when listing refunds."
          }
        },
        "description": "A refund represents a transaction that returns value to from a business to a customer. A specific payment can be refunded or a general refund can be applied to an invoice."
      },
      "ApiRefundPayment": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Customer_Refund_Payment`.",
            "example": "Customer_Refund_Payment"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the payment."
          },
          "external_id": {
            "type": "string",
            "description": "Unique ID of the payment in your system for linking purposes. **Idempotency key**.",
            "example": "31415926535"
          },
          "refunded_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount refunded to the customer in cents."
          },
          "fee": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Fee charged for the refund in cents."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time when the payment was completed."
          },
          "method": {
            "type": "string",
            "description": "Method of the payment.",
            "example": "CREDIT_CARD"
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Processor used for the payment.",
            "example": "STRIPE"
          },
          "payment_clearing_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "The the ledger account to use for the payment (overrides the default determined by the payment method), if specified."
          },
          "refunded_payment_fees": {
            "type": "array",
            "description": "Refunded payment fees associated with the refund payment.",
            "items": {
              "$ref": "#/components/schemas/ApiRefundedPaymentFee"
            }
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the refund payment (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the refund payment. Can be used to filter when listing refund payments."
          }
        },
        "description": "A payment represents a transaction that moves value from a customer to a business. A specific payment can be refunded or a general refund can be applied to an invoice."
      },
      "ApiRefundAllocation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the refund allocation."
          },
          "refund_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the refund this allocation belongs to."
          },
          "refund_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the refund this allocation belongs to."
          },
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the invoice this allocation is associated with."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the allocation in cents."
          },
          "account_identifier": {
            "description": "Identifier of the ledger account for the refund allocation to apply to.",
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true
          },
          "invoice_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the invoice this allocation is associated with."
          },
          "invoice_line_item_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the invoice line item this allocation is associated with. If specified, must not refer to a different invoice `invoice_external` or `invoice_id`."
          },
          "invoice_line_item_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the invoice line item to refund. If specified alongside `invoice_line_item_id`, they must refer to the same invoice line item."
          },
          "invoice_payment_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the invoice payment this allocation is associated with."
          },
          "invoice_payment_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the invoice payment this allocation is associated with."
          },
          "customer": {
            "$ref": "#/components/schemas/ApiCustomerData"
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the refund allocation (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the refund allocation."
          }
        }
      },
      "ApiRefundedPaymentFee": {
        "type": "object",
        "properties": {
          "account": {
            "description": "Identifier of the ledger account for the refunded payment fee.",
            "$ref": "#/components/schemas/AccountIdentifier"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description of the fee that the refunded payment fee refunds."
          },
          "fee_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the fee refund in cents."
          }
        }
      },
      "QuickbooksAuthorizationParams": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Quickbooks_Authorization_Params`.",
            "example": "Quickbooks_Authorization_Params"
          },
          "redirect_url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "redirect_url"
        ]
      },
      "CategorizationRulePostParams": {
        "type": "object",
        "properties": {
          "category": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_1": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_2": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_3": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "business_name_filter": {
            "type": "string",
            "nullable": true
          },
          "client_name_filter": {
            "type": "string",
            "nullable": true
          },
          "merchant_type_filter": {
            "type": "string",
            "nullable": true
          },
          "transaction_description_filter": {
            "type": "string",
            "nullable": true
          },
          "transaction_type_filter": {
            "type": "string",
            "nullable": true
          },
          "bank_direction_filter": {
            "type": "string",
            "nullable": true
          },
          "amount_min_filter": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "amount_max_filter": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          }
        },
        "required": [
          "category",
          "suggestion_1",
          "suggestion_2",
          "suggestion_3"
        ]
      },
      "ApiCategorizationRule": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "client_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "industry": {
            "type": "string",
            "nullable": true
          },
          "is_global": {
            "type": "boolean",
            "nullable": true
          },
          "category": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_1": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_2": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "suggestion_3": {
            "$ref": "#/components/schemas/BankTransactionClassification"
          },
          "business_name_filter": {
            "type": "string",
            "nullable": true
          },
          "client_name_filter": {
            "type": "string",
            "nullable": true
          },
          "merchant_type_filter": {
            "type": "string",
            "nullable": true
          },
          "transaction_description_filter": {
            "type": "string",
            "nullable": true
          },
          "transaction_type_filter": {
            "type": "string",
            "nullable": true
          },
          "bank_direction_filter": {
            "type": "string",
            "nullable": true
          },
          "amount_min_filter": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "amount_max_filter": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          }
        },
        "required": [
          "id"
        ]
      },
      "ApiCategorizationRules": {
        "type": "object",
        "properties": {
          "rules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCategorizationRule"
            }
          }
        },
        "required": [
          "rules"
        ]
      },
      "FlatBankTransactionInput": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "Unique ID of the bank transaction in your system for linking purposes. **Idempotency key**.",
            "example": "31415926535"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "transaction_type": {
            "type": "string",
            "description": "The type of bank account transaction (debit card, check, wire, etc). Can be any string.",
            "example": "Purchase"
          },
          "bank_account_id": {
            "type": "string",
            "description": "ID of the Bank Account this transaction occurred within.",
            "example": "111111111"
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection",
            "description": "Direction of the bank transaction."
          },
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "Balance of the bank account.",
            "example": 12345
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the transaction, in cents."
          },
          "merchant_type": {
            "type": "string",
            "nullable": true,
            "description": "MCC of counterparty merchant for debit card transactions.",
            "example": "0742"
          },
          "merchant_location": {
            "type": "string",
            "nullable": true,
            "description": "Location of counterparty merchant.",
            "example": "California"
          },
          "processed_counterparty_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the merchant or counterparty associated with the transaction.",
            "example": "WeWork"
          },
          "card_last_4_digits": {
            "type": "string",
            "nullable": true,
            "description": "Last 4 digits of the debit card used for the transaction.",
            "example": "4321"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description of the transaction.",
            "example": "Example transaction"
          },
          "auto_categorize": {
            "type": "boolean",
            "nullable": true,
            "default": true,
            "description": "Whether Layer should automatically categorize the transaction."
          }
        },
        "required": [
          "external_id",
          "created_at",
          "transaction_type",
          "bank_account_id",
          "direction",
          "balance",
          "amount"
        ]
      },
      "FlatBankTransactionResult": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'Flat_Bank_Transaction'.",
            "example": "Flat_Bank_Transaction"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer's ID for the transaction."
          },
          "bank_transaction_id": {
            "type": "string",
            "description": "Unique ID of the bank transaction in its source system (e.g, Plaid). Idempotency key.",
            "example": "1111111"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the transaction was created (as opposed to when it was imported into Layer)."
          },
          "transaction_type": {
            "type": "string",
            "description": "The type of bank account transaction (debit card, check, wire, etc). Can be any string.",
            "example": "Purchase"
          },
          "bank_account_id": {
            "type": "string",
            "description": "ID of the Bank Account this transaction occurred within.",
            "example": "1111111111"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer's ID of the business this transaction was imported for."
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection",
            "description": "Direction of the transaction."
          },
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "Balance post-transaction settlement in cents.",
            "example": 12345
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the transaction in cents."
          },
          "merchant_type": {
            "type": "string",
            "nullable": true,
            "description": "MCC of counterparty merchant for debit card transactions.",
            "example": "0742"
          },
          "merchant_location": {
            "type": "string",
            "nullable": true,
            "description": "Location of counterparty merchant.",
            "example": "California"
          },
          "processed_counterparty_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the merchant or counterparty associated with the transaction.",
            "example": "WeWork"
          },
          "card_last_4_digits": {
            "type": "string",
            "nullable": true,
            "description": "Last 4 digits of the debit card used for the transaction.",
            "example": "4321"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description of the transaction.",
            "example": "Example transaction"
          },
          "category": {
            "$ref": "#/components/schemas/ApiCategorization",
            "description": "The category assigned to the transaction. Only populated for transactions that have a finalized category."
          },
          "categorizationStatus": {
            "$ref": "#/components/schemas/CategorizationStatus",
            "description": "The status of the transaction\u2019s categorization in Layer\u2019s systems."
          },
          "previouslyImported": {
            "type": "boolean",
            "description": "Whether the transaction was previously imported (and therefore deduplicated)."
          }
        },
        "required": [
          "id",
          "bank_transaction_id",
          "created_at",
          "transaction_type",
          "bank_account_id",
          "business_id",
          "direction",
          "balance",
          "amount"
        ]
      },
      "SmsSendRequest": {
        "type": "object",
        "properties": {
          "business_id": {
            "type": "string",
            "format": "uuid"
          },
          "body": {
            "type": "string"
          }
        },
        "required": [
          "business_id",
          "body"
        ]
      },
      "ShadowAccountCreationRequest": {
        "type": "object",
        "properties": {
          "randomize_transaction_amounts": {
            "type": "boolean",
            "default": false
          },
          "copy_categorizations": {
            "type": "boolean",
            "default": true
          }
        }
      },
      "CreateShadowAccountResult": {
        "type": "object",
        "properties": {
          "business_id": {
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "business_id"
        ]
      },
      "MessageResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "required": [
          "message"
        ]
      },
      "BusinessDataDeletionResponse": {
        "type": "object",
        "description": "Response returned after requesting permanent deletion of business data.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Business_Data_Deletion_Response`.",
            "example": "Business_Data_Deletion_Response"
          },
          "success": {
            "type": "boolean",
            "description": "Whether the business data deletion completed successfully."
          }
        },
        "required": [
          "success"
        ]
      },
      "ApiError": {
        "type": "object",
        "description": "An error object returned in API error responses.",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/ApiErrorType",
            "description": "A fixed category for the error, helpful for categorizing and processing errors."
          },
          "description": {
            "type": "string",
            "description": "A human-readable error description."
          },
          "error_enum": {
            "$ref": "#/components/schemas/ApiEnumErrorType",
            "description": "A stable, machine-readable identifier for programmatically handling specific error conditions. Only present for 4xx client errors\u2014not included for 5xx server errors. Use this instead of parsing the description field, as enum values remain stable across API versions.",
            "nullable": true
          },
          "meta": {
            "type": "object",
            "description": "Optional additional information about the error.",
            "nullable": true
          }
        },
        "required": [
          "type",
          "description"
        ]
      },
      "ApiEnumErrorType": {
        "type": "string",
        "description": "Stable enum values for programmatic error handling. Only present in 4xx error responses.",
        "enum": [
          "AccessCodeInvalid",
          "BalanceSheetDoesNotBalance",
          "BalanceSheetMissingAccount",
          "BankStatementAccountDetectionError",
          "BankStatementParsingError",
          "BankStatementParserError",
          "BankStatementValidationError",
          "BillStateError",
          "BulkCategorizeFailure",
          "BulkMatchFailure",
          "BusinessTaskAlreadyCompleted",
          "BusinessTaskDeleted",
          "CalendlyOAuthError",
          "CallBookingError",
          "CantUpdateTransactionInCustomerPayout",
          "CantUpdateTransactionInVendorPayout",
          "CheckPayrollConfigNotFound",
          "CheckPayrollServiceNotFound",
          "ClerkUserAlreadyExists",
          "ConflictingQueryParams",
          "CustomAccountAlreadyExists",
          "CustomTransactionCsvParsingError",
          "CustomTransactionUploadFailure",
          "CustomerPayoutInputFormatError",
          "DoesNotMatchExistingEntity",
          "EmptyBatchRequest",
          "ExpenseParserError",
          "ExternalAccountBalanceReconciliationError",
          "ExternalIdConflict",
          "InvalidCategory",
          "InvalidEffectiveDate",
          "InvalidLedgerOperation",
          "InvalidMonthlyAverageRange",
          "InvalidMultiPartRequest",
          "InvalidPaginationCursor",
          "InvalidPayload",
          "InvoiceDeleted",
          "InvoiceNotFound",
          "InvoiceReferenceMismatch",
          "InvoiceStateError",
          "ManualRateLimit",
          "MultipleTagKeyFiltersUnsupported",
          "NoCognitoUserFound",
          "NoOpeningBalanceFound",
          "NotYetReconciled",
          "OnePasswordApiError",
          "OnePasswordItemNotFound",
          "OnePasswordVaultNotFound",
          "OpenAICategorizationError",
          "PaymentLinkInvalid",
          "PayrollStateError",
          "PeriodIsClosed",
          "PeriodNotClosed",
          "PhoneNumberAlreadyRegistered",
          "PlaidApiError",
          "PlaidConnectionBroken",
          "PlaidCreateLinkTokenError",
          "PlaidCredentialsNotConfigured",
          "PlaidExchangePublicTokenError",
          "PlaidGetInstitutionByIdError",
          "PlaidGetItemError",
          "PlaidInvalidEnvironment",
          "PlaidItemAlreadyExists",
          "PlaidItemNotFound",
          "PlaidProcessorApiError",
          "PlaidStatementsAccessNotEnabled",
          "PlaidStatementsNotEnabled",
          "PlaidStatementsNotSupported",
          "PlaidUnlinkItemError",
          "QueryParamFormat",
          "QueryParamMissing",
          "QuickbooksBrokenConnection",
          "QuickbooksConnectionAlreadyExists",
          "QuickbooksConnectionAlreadySyncing",
          "QuickbooksConnectionMissing",
          "QuickbooksConnectionNotActivated",
          "QuickbooksInvalidRequest",
          "QuickbooksInvalidState",
          "QuickbooksNoMatchingAccount",
          "QuickbooksNonPostingAccountType",
          "QuickbooksNotConfigured",
          "QuickbooksOAuthCallbackInvalid",
          "QuickbooksOAuthError",
          "QuickbooksTokenExpired",
          "ReadOnlyBusiness",
          "ResourceArchived",
          "ScheduleCNotConfigured",
          "SmsNotEnabled",
          "SpecifiedBadRequest",
          "SpecifiedIdNotFound",
          "SplitTransactionError",
          "StepEvaluationBadRequest",
          "StripeConnectAccountIdNotFound",
          "StripeCredentialsNotConfigured",
          "StripeGetBalanceForConnectAccountFailure",
          "StripeRedirectOrRefreshUrlNotConfigured",
          "TagFilterNotFound",
          "UnexpectedQueryParam",
          "UnitAccountsInUse",
          "WrongAnswerType"
        ],
        "example": "InvalidPayload"
      },
      "ApiResponse.SuccessResponse": {
        "type": "object",
        "properties": {},
        "example": "",
        "description": ""
      },
      "ApiResponse.SuccessListResponse": {
        "type": "object",
        "properties": {},
        "example": "",
        "description": ""
      },
      "ApiResponse.ErrorResponse": {
        "type": "object",
        "properties": {},
        "example": "",
        "description": ""
      },
      "S3PresignedUrl": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'S3_Presigned_Url'.",
            "example": "S3_Presigned_Url"
          },
          "presignedUrl": {
            "type": "string",
            "description": "Pre-signed URL to download a document.",
            "example": "https://example-bucket.s3.amazonaws.com/example-object?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=FAKEAWSACCESSKEY%2F20240710%2Fus-west-1%2Fs3%2Faws4_request&X-Amz-Date=20240710T000000Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=FAKESIGNATURE1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\n"
          },
          "fileType": {
            "type": "string",
            "description": "The file type of the document.",
            "example": "csv"
          },
          "fileName": {
            "type": "string",
            "description": "The name of the file.",
            "example": "receipt.pdf"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "When the document or generated file was created."
          },
          "documentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the stored document. Present when this URL is for a stored business document; omitted for generated downloads such as report CSV/XLSX exports."
          },
          "document_type": {
            "$ref": "#/components/schemas/DocumentType",
            "description": "The type of the stored document. Included on fetch document and on nested `presigned_url` objects from list documents. Omitted for generated report CSV/XLSX downloads.",
            "nullable": true
          }
        },
        "required": [
          "presignedUrl",
          "fileType",
          "fileName",
          "createdAt"
        ],
        "description": "A pre-signed URL to download a document or generated file."
      },
      "S3PresignedUrlForPDF": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'S3_Presigned_Url'.",
            "example": "S3_Presigned_Url"
          },
          "presignedUrl": {
            "type": "string",
            "description": "Pre-signed URL to download a document.",
            "example": "https://example-bucket.s3.amazonaws.com/example-object?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=FAKEAWSACCESSKEY%2F20240710%2Fus-west-1%2Fs3%2Faws4_request&X-Amz-Date=20240710T000000Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=FAKESIGNATURE1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\n"
          },
          "fileType": {
            "type": "string",
            "description": "The file type of the document.",
            "example": "pdf"
          }
        },
        "description": "A pre-signed URL to download a document."
      },
      "ApiMessageLog": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'Message_Log'.",
            "example": "Message_Log"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The ID of the message log."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "The ID of the business that sent the message."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "The time when the message was received."
          },
          "direction": {
            "description": "Whether the message was sent or received.",
            "$ref": "#/components/schemas/MessageDirection"
          },
          "delivery_status": {
            "description": "The message's delivery status.",
            "$ref": "#/components/schemas/MessageDeliveryStatus"
          },
          "sent_by": {
            "description": "How the message was sent.",
            "$ref": "#/components/schemas/MessageSender"
          },
          "business_phone": {
            "type": "string",
            "description": "The phone number for the business.",
            "example": "+16504651359"
          },
          "body": {
            "type": "string",
            "description": "The message body.",
            "example": "Hello from Layer!"
          },
          "retry_of_id": {
            "type": "string",
            "format": "uuid",
            "description": "The ID of the original message log this is a retry of."
          },
          "sent_at": {
            "type": "string",
            "format": "date-time",
            "description": "The time when the message was sent."
          },
          "presigned_attachment_urls": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "Pre-signed URL to download an attachment.",
              "example": "https://example-bucket.s3.amazonaws.com/example-object?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=FAKEAWSACCESSKEY%2F20240710%2Fus-west-1%2Fs3%2Faws4_request&X-Amz-Date=20240710T000000Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=FAKESIGNATURE1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef\n"
            },
            "description": "List of pre-signed URLs to download the message's attachments."
          },
          "presigned_file_types": {
            "type": "array",
            "items": {
              "type": "string",
              "description": "The filetype of an attachment.",
              "example": "csv"
            },
            "description": "List of file types for the message's attachments."
          }
        },
        "description": "A single message log."
      },
      "ApiMessages": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'Messages'.",
            "example": "Messages"
          },
          "messages": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiMessageLog"
            },
            "description": "List of message logs."
          }
        },
        "example": "",
        "description": ""
      },
      "BusinessNotifications": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Business_Notifications`.",
            "example": "Business_Notifications"
          },
          "uncategorized_transactions_this_month": {
            "type": "integer",
            "format": "int32"
          },
          "uncategorized_transactions_all_time": {
            "type": "integer",
            "format": "int32"
          },
          "todo_tasks": {
            "type": "integer",
            "format": "int32"
          },
          "external_accounts_requiring_update": {
            "type": "integer",
            "format": "int32"
          }
        },
        "required": [
          "uncategorized_transactions_this_month",
          "uncategorized_transactions_all_time",
          "todo_tasks",
          "external_accounts_requiring_update"
        ]
      },
      "MonthlyCategorizationCounts": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Monthly_Categorization_Counts`.",
            "example": "Monthly_Categorization_Counts"
          },
          "months": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MonthUncategorizedTransactions"
            },
            "description": "List of monthly categorization counts."
          }
        },
        "required": [
          "months"
        ],
        "description": "Transaction categorization counts for a list of months."
      },
      "MonthUncategorizedTransactions": {
        "type": "object",
        "properties": {
          "month": {
            "type": "integer",
            "format": "int32",
            "description": "The month (1-12) for the categorization counts.",
            "example": "12"
          },
          "year": {
            "type": "integer",
            "format": "int32",
            "description": "The year for the categorization counts.",
            "example": 2024
          },
          "uncategorized": {
            "type": "integer",
            "format": "int32",
            "description": "The number of uncategorized transactions for the month.",
            "example": 7
          },
          "categorized": {
            "type": "integer",
            "format": "int32",
            "description": "The number of categorized transactions for the month.",
            "example": 98
          }
        },
        "required": [
          "month",
          "year",
          "uncategorized",
          "categorized"
        ],
        "description": "Transaction categorization counts for a single month."
      },
      "BusinessSmsConfigurationInput": {
        "type": "object",
        "properties": {
          "sms_enabled": {
            "type": "boolean",
            "description": "Whether SMS is enabled for this business."
          }
        },
        "description": "The SMS configuration status to set for a business."
      },
      "BusinessSmsConfiguration": {
        "type": "object",
        "properties": {
          "sms_enabled": {
            "type": "boolean",
            "description": "Whether SMS is enabled for this business."
          },
          "sms_stopped": {
            "type": "boolean",
            "description": "Whether this business has responded to Layer's SMS with \"STOP\"."
          },
          "phone_number": {
            "type": "string",
            "nullable": true,
            "description": "Phone number used for SMS-based categorization."
          }
        },
        "description": "The SMS configuration status for a business."
      },
      "CreateTaskParams": {
        "type": "object",
        "properties": {
          "user_response_type": {
            "$ref": "#/components/schemas/TaskUserResponseType"
          },
          "title": {
            "type": "string",
            "description": "Title for the task.",
            "example": "This is a demo task"
          },
          "question": {
            "type": "string",
            "description": "The question asked to the business owner.",
            "example": "On Wednesday, you spent $290,952,012.99 on treasury bonds. What was this purchase for?"
          },
          "transaction_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The transaction the task is related to, if any."
          }
        },
        "required": [
          "user_response_type",
          "title",
          "question"
        ]
      },
      "ApiBusinessTask": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Human_Task",
              "Automated_Task",
              "Automated_Transaction_Review_Task"
            ],
            "description": "Resource type discriminator indicating the task subtype.",
            "example": "Human_Task"
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "enum": [
              "ASSIGNED",
              "IN_PROGRESS",
              "COMPLETED",
              "CANCELLED"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "effective_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          }
        },
        "required": [
          "id",
          "status",
          "created_at",
          "effective_at",
          "updated_at"
        ]
      },
      "ApiBusinessTaskUserResponse": {
        "type": "object",
        "$ref": "#/components/schemas/FreeResponseAnswer",
        "description": "Base schema for a user response in a business task, allowing for different types of responses."
      },
      "FreeResponseAnswer": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiBusinessTaskUserResponse"
          },
          {
            "type": "object",
            "properties": {
              "user_response": {
                "type": "string",
                "description": "The free text response provided by the user.",
                "example": "This is my response to the task."
              }
            },
            "required": [
              "user_response",
              "type"
            ],
            "description": "Describes a free text response to a business task, where the user can provide any text as feedback or answer."
          }
        ]
      },
      "MultiArchivalPayload": {
        "type": "object",
        "properties": {
          "task_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        },
        "required": [
          "task_ids"
        ]
      },
      "InvoiceMatchDetails": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "amount",
          "date",
          "description"
        ]
      },
      "PayoutMatchDetails": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "description": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "amount",
          "date",
          "description"
        ]
      },
      "TransferMatchDetails": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "description": {
            "type": "string"
          },
          "fromAccountName": {
            "type": "string"
          },
          "toAccountName": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "amount",
          "date",
          "description",
          "fromAccountName",
          "toAccountName"
        ]
      },
      "BankTransactionCategorizationWithClassificationString": {
        "type": "object",
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "Category": "#/components/schemas/Category",
            "Split": "#/components/schemas/ApiSplitInput"
          }
        }
      },
      "DocumentS3Urls": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Document_S3_Urls`.",
            "example": "Document_S3_Urls"
          },
          "documentUrls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/S3PresignedUrl"
            },
            "description": "A list of presigned URLs to documents stored in S3."
          }
        },
        "required": [
          "documentUrls"
        ],
        "description": "Contains a list of presigned URLs pointing to various documents stored on Amazon S3. These URLs allow authorized access to the documents for a limited period."
      },
      "ApiTransactionMetadata": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Transaction_Metadata`.",
            "example": "Transaction_Metadata"
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Optional memo field for adding notes or additional information about the transaction.",
            "example": "Example memo to associate with a transaction"
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bank transaction. Can be used to filter when listing bank transactions."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Layer customer ID to associate with the bank transaction. Send null to clear the customer."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Layer vendor ID to associate with the bank transaction. Send null to clear the vendor."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          }
        },
        "description": "Contains metadata associated with a transaction, including an optional memo, customer, and vendor."
      },
      "PatchTransactionMetadataParams": {
        "type": "object",
        "properties": {
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo to store on the transaction. Omit this field to leave the current memo unchanged. Send null to clear it."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number to store on the transaction. Omit this field to leave the current value unchanged. Send null to clear it."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Layer customer ID to associate with the transaction. The customer must already exist. Omit this field to leave the current customer unchanged. Send null to clear it."
          },
          "customer_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the customer to associate with the transaction. Layer creates the customer when this external ID does not exist yet. Omit this field to leave the current customer unchanged. Send null to clear it. If you also send customer_id, both values must refer to the same customer."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Layer vendor ID to associate with the transaction. The vendor must already exist. Omit this field to leave the current vendor unchanged. Send null to clear it."
          },
          "vendor_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the vendor to associate with the transaction. Layer creates the vendor when this external ID does not exist yet. Omit this field to leave the current vendor unchanged. Send null to clear it. If you also send vendor_id, both values must refer to the same vendor."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Custom metadata for the transaction. Omit this field to leave the current metadata unchanged. Send null to clear it."
          }
        },
        "description": "Fields to change on a bank transaction's metadata. Omitted fields stay unchanged."
      },
      "ApiFileMetadata": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `File_Metadata`.",
            "example": "File_Metadata"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Optional unique identifier for the file, can be null if not specified."
          },
          "fileType": {
            "type": "string",
            "description": "The type of the file (e.g., PDF, DOCX, JPEG).",
            "example": "JPEG"
          },
          "filename": {
            "type": "string",
            "description": "The name of the file including its extension.",
            "example": "exampleFile.jpg"
          },
          "documentType": {
            "$ref": "#/components/schemas/DocumentType",
            "description": "The type of document."
          }
        },
        "required": [
          "fileType",
          "filename",
          "documentType"
        ],
        "description": "Contains metadata about a file, including its type, name, and the category of document it represents."
      },
      "CreateS3DocumentParams": {
        "type": "object",
        "properties": {
          "document_type": {
            "$ref": "#/components/schemas/DocumentType",
            "description": "The type of document being uploaded."
          },
          "file_name": {
            "type": "string",
            "description": "The name of the file including its extension.",
            "example": "quarterly-report.pdf"
          },
          "file_type": {
            "type": "string",
            "description": "The MIME type of the file.",
            "example": "application/pdf"
          },
          "file_size_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "The size of the file in bytes. Used to calculate the number of upload parts.",
            "example": 10485760
          }
        },
        "required": [
          "document_type",
          "file_name",
          "file_type",
          "file_size_bytes"
        ],
        "description": "Parameters for creating a new document with presigned upload URLs."
      },
      "ApiS3MultipartUpload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `S3_Multipart_Upload`.",
            "example": "S3_Multipart_Upload"
          },
          "document_id": {
            "type": "string",
            "format": "uuid",
            "description": "The unique identifier of the created document record."
          },
          "upload_id": {
            "type": "string",
            "description": "The S3 multipart upload ID. Required when completing or aborting the upload."
          },
          "part_size_bytes": {
            "type": "integer",
            "format": "int64",
            "description": "The size in bytes that each part should be, except for the last part which may be smaller."
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiS3UploadPart"
            },
            "description": "List of presigned URLs for uploading each part of the file."
          }
        },
        "required": [
          "document_id",
          "upload_id",
          "part_size_bytes",
          "parts"
        ],
        "description": "Response containing presigned URLs for multipart upload to S3."
      },
      "ApiS3UploadPart": {
        "type": "object",
        "properties": {
          "part_number": {
            "type": "integer",
            "description": "The part number for this upload segment (1-indexed)."
          },
          "url": {
            "type": "string",
            "description": "The presigned URL for uploading this part. PUT the file bytes to this URL. The response will include an ETag header that must be provided when completing the upload."
          }
        },
        "required": [
          "part_number",
          "url"
        ],
        "description": "A single part of a multipart upload with its presigned URL."
      },
      "CompleteS3DocumentUploadParams": {
        "type": "object",
        "properties": {
          "upload_id": {
            "type": "string",
            "description": "The upload ID returned from the create document endpoint."
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CompleteS3DocumentUploadPart"
            },
            "description": "List of parts that were uploaded, with their part numbers and ETags."
          }
        },
        "required": [
          "upload_id",
          "parts"
        ],
        "description": "Parameters for completing a multipart upload."
      },
      "CompleteS3DocumentUploadPart": {
        "type": "object",
        "properties": {
          "part_number": {
            "type": "integer",
            "description": "The part number that was uploaded (1-indexed)."
          },
          "etag": {
            "type": "string",
            "description": "The ETag returned by S3 when the part was uploaded. Found in the response headers of the PUT request to the presigned URL."
          }
        },
        "required": [
          "part_number",
          "etag"
        ],
        "description": "Information about an uploaded part required to complete the multipart upload."
      },
      "AbortS3DocumentUploadParams": {
        "type": "object",
        "properties": {
          "upload_id": {
            "type": "string",
            "description": "The upload ID returned from the create document endpoint."
          }
        },
        "required": [
          "upload_id"
        ],
        "description": "Parameters for aborting a multipart upload."
      },
      "ApiS3Document": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Document`.",
            "example": "Document"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The unique identifier of the document."
          },
          "file_name": {
            "type": "string",
            "description": "The name of the uploaded file."
          },
          "file_type": {
            "type": "string",
            "description": "The MIME type of the file."
          },
          "document_type": {
            "$ref": "#/components/schemas/DocumentType",
            "description": "The type of document."
          },
          "presigned_url": {
            "$ref": "#/components/schemas/S3PresignedUrl",
            "description": "Presigned download details for the document, including `document_type`."
          }
        },
        "required": [
          "id",
          "file_name",
          "file_type",
          "document_type"
        ],
        "description": "A document stored in S3."
      },
      "SupportEmailListMetadata": {
        "type": "object",
        "description": "Pagination metadata for the business email list. Total count is not available.",
        "properties": {
          "pagination": { "$ref": "#/components/schemas/SupportEmailPaginationMetadata" }
        },
        "required": ["pagination"]
      },
      "SupportEmailPaginationMetadata": {
        "type": "object",
        "description": "Cursor-based pagination for business emails, ordered by receive time and message ID.",
        "properties": {
          "sort_by": { "type": "string", "enum": ["received_at"], "description": "The sort field." },
          "sort_order": { "type": "string", "enum": ["ASC", "DESC"], "description": "The sort direction." },
          "cursor": { "type": "string", "nullable": true, "description": "Opaque cursor to send as the `cursor` query parameter for the next page. Null when there are no more pages." },
          "has_more": { "type": "boolean", "description": "Whether another page is available." }
        },
        "required": ["sort_by", "sort_order", "cursor", "has_more"]
      },
      "ApiSupportEmailParticipant": {
        "type": "object",
        "properties": {
          "email_address": { "type": "string", "format": "email", "description": "The participant's email address." },
          "role": { "type": "string", "enum": ["FROM", "TO", "CC", "BCC", "REPLY_TO"], "description": "The participant's role in this message." }
        },
        "required": ["email_address", "role"]
      },
      "ApiSupportEmailAttachment": {
        "type": "object",
        "description": "An attachment stored with the email. Download URLs are provided only on the single-message endpoint.",
        "properties": {
          "id": { "type": "string", "format": "uuid", "description": "The attachment UUID." },
          "filename": { "type": "string", "description": "The original filename." },
          "mime_type": { "type": "string", "description": "The attachment MIME type." },
          "size_bytes": { "type": "integer", "format": "int32", "description": "The attachment size in bytes." },
          "url": { "type": "string", "format": "uri", "description": "Temporary presigned S3 download URL, valid for 24 hours. Omitted from list results." }
        },
        "required": ["id", "filename", "mime_type", "size_bytes"]
      },
      "ApiSupportEmailAttachmentDetail": {
        "allOf": [
          { "$ref": "#/components/schemas/ApiSupportEmailAttachment" },
          { "type": "object", "required": ["url"] }
        ],
        "description": "An email attachment with a presigned download URL."
      },
      "ApiSupportEmailMessage": {
        "type": "object",
        "description": "A message in a thread linked to the business.",
        "properties": {
          "id": { "type": "string", "format": "uuid", "description": "The message UUID. Use this ID to fetch the full message." },
          "thread_id": { "type": "string", "format": "uuid", "description": "The linked thread UUID." },
          "mailbox_id": { "type": "string", "format": "uuid", "description": "The support mailbox UUID." },
          "gmail_message_id": { "type": "string", "description": "The source Gmail message ID." },
          "gmail_thread_id": { "type": "string", "description": "The source Gmail thread ID." },
          "business_id": { "type": "string", "format": "uuid", "description": "The business linked to the thread." },
          "direction": { "type": "string", "enum": ["RECEIVED", "SENT"], "description": "Whether the message was received or sent." },
          "from_address": { "type": "string", "format": "email", "description": "The sender's email address." },
          "subject": { "type": "string", "description": "The message subject." },
          "snippet": { "type": "string", "description": "A short preview, not the full body." },
          "received_at": { "type": "string", "format": "date-time", "description": "The message timestamp used for ordering and date filters." },
          "participants": { "type": "array", "items": { "$ref": "#/components/schemas/ApiSupportEmailParticipant" }, "description": "Email addresses and their roles." },
          "attachments": { "type": "array", "items": { "$ref": "#/components/schemas/ApiSupportEmailAttachment" }, "description": "Stored attachment metadata; list results omit download URLs." }
        },
        "required": ["id", "thread_id", "mailbox_id", "gmail_message_id", "gmail_thread_id", "business_id", "direction", "from_address", "subject", "snippet", "received_at"]
      },
      "ApiSupportEmailMessageDetail": {
        "description": "One business email with its stored body and presigned attachment download URLs. HTML takes precedence when both HTML and plain text arrive; only one body field is populated. Both are null when no body was stored.",
        "allOf": [
          { "$ref": "#/components/schemas/ApiSupportEmailMessage" },
          {
            "type": "object",
            "properties": {
              "body_html": { "type": "string", "nullable": true, "description": "The stored HTML body, or null when only plain text or no body was stored. Treat as untrusted HTML." },
              "body_text": { "type": "string", "nullable": true, "description": "The stored plain-text body, or null when HTML or no body was stored." },
              "attachments": { "type": "array", "items": { "$ref": "#/components/schemas/ApiSupportEmailAttachmentDetail" }, "description": "Stored attachments with presigned download URLs." }
            },
            "required": ["body_html", "body_text"]
          }
        ]
      },
      "PayoutRefundInput": {
        "type": "object",
        "oneOf": [
          {
            "$ref": "#/components/schemas/ReferencingCustomerPayoutRefundInput",
            "title": "Reference existing refund payment"
          },
          {
            "$ref": "#/components/schemas/ExplicitCustomerPayoutRefundInput",
            "title": "Create new refund with payment"
          }
        ]
      },
      "ReferencingCustomerPayoutRefundInput": {
        "type": "object",
        "properties": {
          "refund_id": {
            "type": "string",
            "format": "uuid",
            "description": "The ID of the refund to reference. Must have exactly one payment."
          },
          "refund_external_id": {
            "type": "string",
            "description": "The external ID of the refund to reference. Must have exactly one payment."
          },
          "refund_payment_id": {
            "type": "string",
            "format": "uuid",
            "description": "The ID of the refund payment to reference."
          },
          "refund_payment_external_id": {
            "type": "string",
            "description": "The external ID of the refund payment to reference."
          }
        }
      },
      "ExplicitCustomerPayoutRefundInput": {
        "type": "object",
        "properties": {
          "refund_external_id": {
            "type": "string",
            "description": "An external identifier for the refund transaction."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of the refund in cents. This value must be positive."
          }
        },
        "required": [
          "refund_external_id",
          "amount"
        ],
        "description": "Contains details for initiating a refund in a payout transaction. It includes an external identifier and the refund amount."
      },
      "ApiTags": {
        "type": "object",
        "properties": {
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "A list of tags associated with a taggable object."
          }
        },
        "required": [
          "tags"
        ],
        "description": "Contains a collection of tags as defined by the ApiTag schema. This structure is used to encapsulate multiple tags in API responses or requests."
      },
      "BankTransactionDirection": {
        "type": "string",
        "enum": [
          "CREDIT",
          "DEBIT"
        ],
        "example": "DEBIT"
      },
      "DocumentType": {
        "type": "string",
        "enum": [
          "RECEIPT",
          "BANK_STATEMENT",
          "UNSTRUCTURED_BOOKKEEPING_CONTEXT",
          "OTHER"
        ],
        "description": "The type of document. RECEIPT is for receipts and invoices. UNSTRUCTURED_BOOKKEEPING_CONTEXT is for general bookkeeping context documents. OTHER is for any other document type.",
        "example": "RECEIPT"
      },
      "CurrencyCode": {
        "type": "string",
        "enum": [
          "AED",
          "AFN",
          "ALL",
          "AMD",
          "ANG",
          "AOA",
          "ARS",
          "AUD",
          "AWG",
          "AZN",
          "BAM",
          "BBD",
          "BDT",
          "BGN",
          "BHD",
          "BIF",
          "BMD",
          "BND",
          "BOB",
          "BRL",
          "BSD",
          "BTN",
          "BWP",
          "BYR",
          "BZD",
          "CAD",
          "CDF",
          "CHF",
          "CLP",
          "CNY",
          "COP",
          "CRC",
          "CUC",
          "CUP",
          "CVE",
          "CZK",
          "DJF",
          "DKK",
          "DOP",
          "DZD",
          "EGP",
          "ERN",
          "ETB",
          "EUR",
          "FJD",
          "FKP",
          "GBP",
          "GEL",
          "GGP",
          "GHS",
          "GIP",
          "GMD",
          "GNF",
          "GTQ",
          "GYD",
          "HKD",
          "HNL",
          "HRK",
          "HTG",
          "HUF",
          "IDR",
          "ILS",
          "IMP",
          "INR",
          "IQD",
          "IRR",
          "ISK",
          "JEP",
          "JMD",
          "JOD",
          "JPY",
          "KES",
          "KGS",
          "KHR",
          "KMF",
          "KPW",
          "KRW",
          "KWD",
          "KYD",
          "KZT",
          "LAK",
          "LBP",
          "LKR",
          "LRD",
          "LSL",
          "LYD",
          "MAD",
          "MDL",
          "MGA",
          "MKD",
          "MMK",
          "MNT",
          "MOP",
          "MRO",
          "MUR",
          "MVR",
          "MWK",
          "MXN",
          "MYR",
          "MZN",
          "NAD",
          "NGN",
          "NIO",
          "NOK",
          "NPR",
          "NZD",
          "OMR",
          "PAB",
          "PEN",
          "PGK",
          "PHP",
          "PKR",
          "PLN",
          "PYG",
          "QAR",
          "RON",
          "RSD",
          "RUB",
          "RWF",
          "SAR",
          "SBD",
          "SCR",
          "SDG",
          "SEK",
          "SGD",
          "SHP",
          "SLL",
          "SOS",
          "SPL",
          "SRD",
          "STD",
          "SVC",
          "SYP",
          "SZL",
          "THB",
          "TJS",
          "TMT",
          "TND",
          "TOP",
          "TRY",
          "TTD",
          "TVD",
          "TWD",
          "TZS",
          "UAH",
          "UGX",
          "USD",
          "UYU",
          "UZS",
          "VEF",
          "VND",
          "VUV",
          "WST",
          "XAF",
          "XCD",
          "XDR",
          "XOF",
          "XPF",
          "YER",
          "ZAR",
          "ZMW",
          "ZWD"
        ],
        "example": "USD"
      },
      "PaymentProcessor": {
        "type": "string",
        "enum": [
          "STRIPE",
          "PAYPAL",
          "SHOPIFY",
          "ADYEN",
          "RAINFOREST"
        ],
        "example": "STRIPE"
      },
      "BusinessTaskStatus": {
        "type": "string",
        "enum": [
          "TODO",
          "USER_MARKED_COMPLETED",
          "COMPLETED",
          "ARCHIVED",
          "DELETED"
        ],
        "example": "TODO"
      },
      "MessageDirection": {
        "type": "string",
        "enum": [
          "SENT",
          "RECEIVED"
        ],
        "example": "SENT"
      },
      "MessageSender": {
        "type": "string",
        "enum": [
          "API",
          "MANUAL"
        ],
        "example": "API"
      },
      "MessageDeliveryStatus": {
        "type": "string",
        "enum": [
          "ACCEPTED",
          "SCHEDULED",
          "QUEUED",
          "SENDING",
          "SENT",
          "RECEIVING",
          "RECEIVED",
          "DELIVERED",
          "UNDELIVERED",
          "FAILED",
          "READ",
          "CANCELED",
          "LAYER_TIMEOUT",
          "UNKNOWN"
        ],
        "example": "DELIVERED"
      },
      "MatchType": {
        "type": "string",
        "enum": [
          "TRANSFER",
          "INVOICE_PAYMENT",
          "PAYOUT"
        ],
        "example": "TRANSFER"
      },
      "SuccessStatusCode": {
        "type": "string",
        "enum": [
          "OK",
          "Created"
        ],
        "example": "OK"
      },
      "ApiErrorType": {
        "type": "string",
        "enum": [
          "ResourceArchived",
          "AuthFailure",
          "Plaid",
          "Stripe",
          "InvalidState",
          "ResourceNotFound",
          "InvalidParameters",
          "JsonSerialization",
          "Unknown",
          "BadRequest",
          "PaginationCursor",
          "Conflict",
          "LedgerOperationFailed"
        ],
        "example": "InvalidParameters"
      },
      "AccountStatus": {
        "type": "string",
        "enum": [
          "ACTIVE",
          "ARCHIVED"
        ],
        "example": "ACTIVE"
      },
      "BankTransactionSource": {
        "type": "string",
        "enum": [
          "UNIT",
          "PLAID",
          "API"
        ],
        "example": "PLAID"
      },
      "TransactionSource": {
        "type": "string",
        "enum": [
          "UNIT",
          "PLAID",
          "API",
          "STRIPE",
          "CUSTOM"
        ],
        "example": "PLAID"
      },
      "InputStrategy": {
        "type": "string",
        "enum": [
          "AUTO",
          "MEALS",
          "CLOTHING",
          "ASK_IF_PERSONAL",
          "ASK_FROM_SUGGESTIONS",
          "BUSINESS_TRAVEL_TRANSPORTATION",
          "BUSINESS_TRAVEL_LODGING",
          "LAYER_REVIEW",
          ""
        ],
        "example": "AUTO"
      },
      "CategorizationStatus": {
        "type": "string",
        "enum": [
          "PENDING",
          "READY_FOR_INPUT",
          "CATEGORIZED",
          "SPLIT",
          "LAYER_REVIEW",
          "JOURNALING",
          "MATCHED"
        ],
        "example": "CATEGORIZED"
      },
      "ClassifierAgent": {
        "type": "string",
        "enum": [
          "SMS",
          "API",
          "LAYER_AUTO",
          "LAYER_MANUAL"
        ],
        "example": "API"
      },
      "ProjectedIncomeCategory": {
        "type": "string",
        "enum": [
          "REVENUE",
          "EXPENSE",
          "EXCLUDE"
        ],
        "example": "REVENUE"
      },
      "TaskUserResponseType": {
        "type": "string",
        "enum": [
          "FREE_RESPONSE",
          "UPLOAD_DOCUMENT"
        ],
        "example": "FREE_RESPONSE"
      },
      "RootInfoResponse": {
        "type": "object",
        "properties": {
          "clientName": {
            "type": "string",
            "description": "Name of the client."
          },
          "clientId": {
            "type": "string",
            "format": "uuid",
            "description": "Universally unique identifier of the client."
          }
        },
        "required": [
          "clientName",
          "clientId"
        ]
      },
      "ApiChartOfAccounts": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Chart_Of_Accounts`.",
            "example": "Chart_Of_Accounts"
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NestedApiChartAccount"
            }
          }
        }
      },
      "PlaidConfigurationResponse": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Plaid_Configuration`.",
            "example": "Plaid_Configuration"
          },
          "client_id": {
            "type": "string"
          },
          "secret_last_4": {
            "type": "string",
            "example": "5432"
          },
          "plaid_env_url_override": {
            "type": "string",
            "enum": [
              "SANDBOX",
              "PRODUCTION"
            ],
            "nullable": true,
            "description": "The Plaid environment to use. If not specified, the default environment is used.",
            "example": "SANDBOX"
          }
        }
      },
      "SmsConfigurationResponse": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Sms_Configuration`.",
            "example": "Sms_Configuration"
          },
          "sms_enabled": {
            "type": "boolean",
            "description": "Whether SMS messaging is enabled at the platform level."
          }
        }
      },
      "UpdateCustomAccountParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "Unique ID of the custom account in an external system for linking and idempotency.",
            "example": "ww9wwLgkrbU3jkg3J4J7ckBR3zKQV6sLPQevK"
          },
          "mask": {
            "type": "string",
            "description": "Last 4 digits of the custom account number.",
            "example": "4321"
          },
          "account_name": {
            "type": "string",
            "description": "Name of the custom account.",
            "example": "My custom account"
          },
          "institution_name": {
            "type": "string",
            "description": "Name of the institution for the custom account.",
            "example": "My custom account institution"
          },
          "account_type": {
            "type": "string",
            "enum": [
              "DEPOSITORY",
              "CREDIT",
              "LOAN"
            ],
            "nullable": true,
            "description": "The type of the custom account.",
            "example": "DEPOSITORY"
          },
          "account_subtype": {
            "type": "string",
            "enum": [
              "CHECKING",
              "SAVINGS",
              "CREDIT CARD",
              "LOAN"
            ],
            "nullable": true,
            "description": "The subtype of the custom account.",
            "example": "checking"
          }
        }
      },
      "NewTagsPostParams": {
        "type": "object",
        "properties": {
          "key_values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "List of key-value pairs used to create new tags."
          },
          "transaction_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "The transaction IDs to create each new tag for."
          }
        }
      },
      "ApiChartOfAccountsOld": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Account"
            }
          }
        }
      },
      "CreateManualLedgerEntry": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "Unique ID of the ledger entry in your system. **Idempotency key.**."
          },
          "entry_at": {
            "type": "string",
            "format": "date-time",
            "description": "The date and time when the entry should be recorded effective in the ledger, in ISO 8601 format."
          },
          "created_by": {
            "type": "string",
            "description": "Identifier of the user or system that created the manual entry."
          },
          "memo": {
            "type": "string",
            "description": "Description or memo of the manual entry."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLedgerEntryLineItem"
            }
          },
          "customer_id": {
            "description": "Layer customer ID to associate with the ledger entry. Customer IDs can be specified on the entry or on individual line items, but not both.",
            "type": "string",
            "format": "uuid"
          },
          "customer_external_id": {
            "description": "External ID of the Layer customer to associate with the ledger entry. Can be specified in place of the Layer customer ID. Customer IDs can be specified on the entry or on individual line items, but not both.",
            "type": "string",
            "example": "customer-1"
          },
          "vendor_id": {
            "description": "Layer vendor ID to associate with the ledger entry. Vendor IDs can be specified on the entry or on individual line items, but not both.",
            "type": "string",
            "format": "uuid"
          },
          "vendor_external_id": {
            "description": "External ID of the Layer vendor to associate with the ledger entry. Can be specified in place of the Layer vendor ID. Vendor IDs can be specified on the entry or on individual line items, but not both.",
            "type": "string",
            "example": "vendor-1"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          }
        },
        "required": [
          "entry_at",
          "created_by",
          "memo",
          "line_items"
        ]
      },
      "CreateApiLedgerAccount": {
        "type": "object",
        "required": [
          "name",
          "normality",
          "parent_id",
          "account_type",
          "account_subtype"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Display name of the ledger account.",
            "example": "Consulting Revenue"
          },
          "account_number": {
            "type": "string",
            "nullable": true,
            "description": "Optional account number for the ledger account.",
            "example": "4000"
          },
          "normality": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "parent_id": {
            "$ref": "#/components/schemas/AccountIdentifier"
          },
          "stable_name": {
            "$ref": "#/components/schemas/AccountStableName"
          },
          "account_type": {
            "$ref": "#/components/schemas/LedgerAccountType"
          },
          "account_subtype": {
            "$ref": "#/components/schemas/LedgerAccountSubtype"
          }
        },
        "description": "Parameters for creating a new ledger account. The stable_name field is used for idempotency."
      },
      "CreateApiChildLedgerAccount": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Display name of the child ledger account.",
            "example": "Software Consulting"
          },
          "stable_name": {
            "$ref": "#/components/schemas/AccountStableName"
          },
          "account_number": {
            "type": "string",
            "nullable": true,
            "description": "Optional account number for the ledger account.",
            "example": "4010"
          }
        },
        "description": "Parameters for creating a child ledger account. The child inherits account_type, account_subtype, and normality from its parent."
      },
      "MatchPayload": {
        "$ref": "#/components/schemas/ConfirmMatch"
      },
      "SimpleCustomerRefundCreateParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An external identifier for the refund transaction."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "The time the refund was completed."
          },
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the invoice to refund."
          },
          "invoice_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the invoice to refund."
          },
          "invoice_line_item_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the invoice line item to refund."
          },
          "invoice_line_item_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the invoice line item to refund."
          },
          "invoice_payment_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the invoice payment to refund."
          },
          "invoice_payment_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the invoice payment to refund."
          },
          "refund_processing_fee": {
            "type": "integer",
            "format": "int64",
            "default": 0,
            "description": "The fee charged to the business for processing the refund in cents."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "The payment method used for the refund."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "The payment processor used to process the refund.",
            "example": "STRIPE"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the refund."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the refund (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the refund. Can be used to filter when listing refunds."
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "Optional account identifier to specify the clearing account for inferred refund payments. Only used when creating simple refunds where the system automatically generates the payment."
          }
        },
        "required": [
          "completed_at",
          "method"
        ],
        "description": "Simple refund creation parameters. The system will automatically calculate the refund amount based on the specified target (invoice, line item, or payment). At least one target identifier must be provided."
      },
      "ItemizedCustomerRefundCreateParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An external identifier for the refund transaction."
          },
          "refunded_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The total amount of the refund in cents. This value must be positive and equal to the sum of all allocation amounts."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "The time the refund was completed."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomerRefundAllocationParams"
            },
            "description": "The targets of the refund. Each allocation specifies how much of the refund should be applied to a specific invoice, line item, payment, or customer."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomerRefundPaymentParams"
            },
            "description": "The payment methods and amounts used to process the refund."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the refund."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the refund (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the refund. Can be used to filter when listing refunds."
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "Optional account identifier to specify the clearing account for inferred refund payments. Only used when the `payments` field is not provided and the system automatically generates a payment based on the `method` field."
          }
        },
        "required": [
          "refunded_amount",
          "completed_at",
          "allocations",
          "payments"
        ],
        "description": "Itemized refund creation parameters. Provides full control over refund allocations and payments. The sum of allocation amounts must equal the refunded_amount."
      },
      "PatchCustomerRefundParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An external identifier for the refund transaction."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "The time the refund was completed."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomerRefundAllocationParams"
            },
            "description": "The targets of the refund. If provided, all existing allocations will be replaced with these new allocations. Each allocation specifies how much of the refund should be applied to a specific invoice, line item, payment, or customer."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomerRefundPaymentParams"
            },
            "description": "The payment methods and amounts used to process the refund. If provided, all existing payments will be replaced with these new payments."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the refund. If provided, all existing tags will be replaced."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the refund (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the refund. Can be used to filter when listing refunds."
          }
        },
        "description": "Parameters for partially updating a refund. All fields are optional. If allocations or payments are provided, they will fully replace the existing allocations or payments respectively."
      },
      "CreateCustomerRefundAllocationParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An external identifier for the refund allocation."
          },
          "total_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The total amount of this allocation in cents. Must equal the sum of all line item amounts."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomerRefundAllocationLineItemParams"
            },
            "description": "The line items that make up this allocation."
          },
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the invoice to refund."
          },
          "invoice_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the invoice to refund."
          },
          "invoice_line_item_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the invoice line item to refund."
          },
          "invoice_line_item_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the invoice line item to refund."
          },
          "invoice_payment_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the invoice payment to refund."
          },
          "invoice_payment_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the invoice payment to refund."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the customer to refund."
          },
          "customer_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the customer to refund."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the allocation."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the refund allocation."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the refund allocation."
          }
        },
        "required": [
          "total_amount",
          "line_items"
        ],
        "description": "Parameters for creating a refund allocation. At least one target identifier (invoice, line item, payment, or customer) must be provided."
      },
      "CreateCustomerRefundAllocationLineItemParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An external identifier for the line item."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of this line item in cents."
          },
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "Identifier of the ledger account for this line item."
          },
          "prepayment_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "Identifier of the prepayment ledger account for this line item."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the line item."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the line item."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the refund allocation line item."
          }
        },
        "required": [
          "amount"
        ],
        "description": "Parameters for creating a refund allocation line item."
      },
      "CreateCustomerRefundPaymentParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the payment in your system for linking purposes. **Idempotency key**.",
            "example": "31415926535"
          },
          "refunded_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount refunded to the customer in cents."
          },
          "refund_processing_fee": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Fee charged to the business for processing the refund in cents."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time when the payment was completed."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "Payment method used for the refund."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Processor used to make the payment, if any. Any processor name can be provided and will be tracked. Supported processors (e.g. `STRIPE`) will have additional asset balance tracking.",
            "example": "STRIPE"
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The the ledger account to use for the payment (overrides the default determined by the payment method)."
          },
          "refunded_payment_fees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RefundedPaymentFeeInput"
            },
            "description": "List of fees associated with this payment. These are refunded from the payment processor rather than the business."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the payment."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the refund payment."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the refund payment. Can be used to filter when listing refund payments."
          }
        },
        "required": [
          "refunded_amount",
          "completed_at",
          "method"
        ],
        "description": "Parameters for creating a refund payment."
      },
      "RefundedPaymentFeeInput": {
        "type": "object",
        "properties": {
          "account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Account to which the fee should be allocated."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description of the fee."
          },
          "fee_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the fee in cents."
          }
        },
        "required": [
          "account",
          "fee_amount"
        ],
        "description": "Input parameters for a refunded payment fee."
      },
      "NewInvoicePostParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "External ID for the invoice within your platform. **Idempotency key**.",
            "example": "019234"
          },
          "sent_at": {
            "type": "string",
            "description": "When the invoice was sent by the business to the recipient. Accepts an ISO 8601 date (`YYYY-MM-DD`) or a full ISO 8601 timestamp. A date-only value is stored as midnight Eastern Time on that day.",
            "example": "2024-04-02"
          },
          "due_at": {
            "type": "string",
            "description": "When the invoice is due. Accepts an ISO 8601 date (`YYYY-MM-DD`) or a full ISO 8601 timestamp. A date-only value is stored as midnight Eastern Time on that day.",
            "example": "2024-05-02"
          },
          "voided_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the invoice was voided. Voiding excludes the invoice entirely from accounting."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the customer to associate with the invoice. Either `customer_id` or `customer_external_id` must be provided."
          },
          "customer_external_id": {
            "type": "string",
            "description": "External ID of the customer to associate with the invoice. Either `customer_id` or `customer_external_id` must be provided. If the customer does not already exist, Layer will create it using this external ID."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewInvoiceLineItem"
            },
            "description": "Line items making up the invoice."
          },
          "additional_sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateTaxLineItem"
            },
            "description": "List of additional sales tax obligations on the invoice outside individual line items."
          },
          "additional_discount": {
            "type": "integer",
            "description": "Additional discount applied to the whole invoice in addition to individual line items."
          },
          "tips": {
            "type": "integer",
            "description": "Tips included by the buyer, in cents."
          },
          "tips_account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The Account Identifier for a tips account. If not specified, Layer uses the chart's default tips account, which is typically a liability account. Specify a different account if tips should be tracked as revenue."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateImmediatePaymentInput"
            },
            "nullable": true,
            "description": "Payments that have been made towards the balance of the invoice. Include these to create an immediately paid or partially paid invoice in the same API call. When upserting an existing invoice: omitting this field (or passing `null`) preserves any existing dedicated payments; passing an empty array `[]` removes all dedicated payments. Non-dedicated payments (those independently recorded or included in a payout) are never removed by this field."
          },
          "dedicated_refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateDedicatedRefundParams"
            },
            "description": "Dedicated refunds to associate with this invoice."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the invoice (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the invoice. Can be used to filter when listing invoices."
          }
        }
      },
      "UpdateInvoiceParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "External ID for the invoice within your platform. **Idempotency key**.",
            "example": "019234"
          },
          "sent_at": {
            "type": "string",
            "description": "When the invoice was sent by the business to the recipient. Accepts an ISO 8601 date (`YYYY-MM-DD`) or a full ISO 8601 timestamp. A date-only value is stored as midnight Eastern Time on that day.",
            "example": "2024-04-02"
          },
          "due_at": {
            "type": "string",
            "description": "When the invoice is due. Accepts an ISO 8601 date (`YYYY-MM-DD`) or a full ISO 8601 timestamp. A date-only value is stored as midnight Eastern Time on that day.",
            "example": "2024-05-02"
          },
          "voided_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the invoice was voided. Voiding excludes the invoice entirely from accounting."
          },
          "invoice_number": {
            "type": "string",
            "description": "Number for the invoice for display to end-users.",
            "example": "1"
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the customer to associate with the invoice."
          },
          "customer_external_id": {
            "type": "string",
            "description": "External ID of the customer to associate with the invoice."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewInvoiceLineItem"
            },
            "description": "Line items making up the invoice."
          },
          "additional_sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateTaxLineItem"
            },
            "description": "List of sales tax obligations on this line item."
          },
          "additional_discount": {
            "type": "integer",
            "description": "Additional discount applied to the whole invoice in addition to individual line items."
          },
          "tips": {
            "type": "integer",
            "description": "Tips included by the buyer, in cents."
          },
          "tips_account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The Account Identifier for a tips account."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the invoice (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the invoice. Can be used to filter when listing invoices."
          }
        }
      },
      "PatchInvoiceParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID for the invoice within your platform. **Idempotency key**.",
            "example": "019234"
          },
          "sent_at": {
            "type": "string",
            "description": "When the invoice was sent by the business to the recipient. Accepts an ISO 8601 date (`YYYY-MM-DD`) or a full ISO 8601 timestamp. A date-only value is stored as midnight Eastern Time on that day.",
            "example": "2024-04-02"
          },
          "due_at": {
            "type": "string",
            "nullable": true,
            "description": "When the invoice is due. Accepts an ISO 8601 date (`YYYY-MM-DD`) or a full ISO 8601 timestamp. A date-only value is stored as midnight Eastern Time on that day.",
            "example": "2024-05-02"
          },
          "invoice_number": {
            "type": "string",
            "description": "Number for the invoice for display to end-users.",
            "example": "1"
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the customer to associate with the invoice."
          },
          "customer_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the customer to associate with the invoice."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewInvoiceLineItem"
            },
            "description": "Line items making up the invoice."
          },
          "additional_sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateTaxLineItem"
            },
            "description": "List of additional sales tax obligations on the invoice outside individual line items."
          },
          "additional_discount": {
            "type": "integer",
            "description": "Additional discount applied to the whole invoice in addition to individual line items."
          },
          "tips": {
            "type": "integer",
            "description": "Tips included by the buyer, in cents."
          },
          "tips_account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The Account Identifier for a tips account."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the invoice (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the invoice. Can be used to filter when listing invoices."
          }
        },
        "description": "Parameters for partially updating an invoice. All fields are optional. Provide at least one field."
      },
      "ApiOpeningBalance": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Opening_Balance`.",
            "example": "Opening_Balance"
          },
          "external_account_external_id": {
            "type": "string",
            "description": "Unique ID of the external account in an external system for linking and idempotency.",
            "example": "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq"
          },
          "external_account_source": {
            "$ref": "#/components/schemas/TransactionSource",
            "description": "Source of the external account."
          },
          "balance": {
            "type": "integer",
            "description": "Opening balance of the account, in cents.",
            "example": 432100
          },
          "effective_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp for when the account had this balance."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the opening balance timestamp was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the opening balance timestamp was updated."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags associated with the opening balance."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the opening balance (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the opening balance."
          }
        }
      },
      "BusinessReadOnlyStatusParams": {
        "type": "object",
        "properties": {
          "readonly": {
            "type": "boolean",
            "description": "Set to `true` to enable read-only mode for the business, or `false` to clear it."
          }
        },
        "required": [
          "readonly"
        ]
      },
      "NewBusinessParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "Unique ID of the business in your system for linking purposes. **Idempotency key**."
          },
          "legal_name": {
            "type": "string",
            "description": "Legal name of the business as it has been registered."
          },
          "owner_name": {
            "type": "string",
            "nullable": true,
            "example": "Jane Doe",
            "description": "Full name of the business owner. Creates OWNER personnel. Create-only; not returned on the business resource."
          },
          "owner_email": {
            "type": "string",
            "format": "email",
            "nullable": true,
            "example": "jane@example.com",
            "description": "Email for the business owner. Requires `owner_name`. Creates OWNER personnel. Create-only; not returned on the business resource."
          },
          "tin": {
            "type": "string",
            "nullable": true,
            "description": "Tax Identification Number for the business."
          },
          "us_state": {
            "$ref": "#/components/schemas/USState",
            "description": "The state this business is incorporated in."
          },
          "country": {
            "$ref": "#/components/schemas/Country",
            "description": "2 letter ISO country code representing the country this business is incorporated in. Defaults to US."
          },
          "entity_type": {
            "$ref": "#/components/schemas/BusinessType",
            "description": "Entity type of the business. Used to determine tax filing status."
          },
          "phone_number": {
            "type": "string",
            "description": "Phone number used for SMS based categorization."
          },
          "sms_enabled": {
            "type": "boolean",
            "description": "Whether SMS is enabled for this business."
          },
          "sms_categorization_start_date": {
            "type": "string",
            "format": "date-time",
            "description": "Date when SMS categorization starts for this business."
          },
          "activation_at": {
            "type": "string",
            "format": "date-time",
            "description": "The activation timestamp represents the time at which Layer should begin displaying accounting data. Data before this time will not be displayed to users. This field is important for businesses migrating over from other accounting platforms. Defaults to Jan 1 of the current year."
          },
          "internal_bank_account_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewBusinessUnitAccountId"
            },
            "description": "List of internal bank account identifiers to associate with this business."
          },
          "unit_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewBusinessUnitAccountId"
            },
            "description": "List of unit account identifiers to associate with this business."
          },
          "plaid_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatePlaidItem"
            },
            "description": "Plaid items to link to this business."
          },
          "plaid_processor_tokens": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatePlaidProcessorToken"
            },
            "description": "Plaid processor tokens to link to this business."
          },
          "skip_onboarding": {
            "type": "boolean",
            "description": "Whether to skip the onboarding process for this business."
          },
          "industry": {
            "type": "string",
            "description": "Industry classification for the business."
          },
          "naics_code": {
            "type": "string",
            "nullable": true,
            "description": "6-digit NAICS code used to identify the business's industry."
          },
          "stripe_connect_accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StripeConnectAccountInput"
            },
            "description": "List of Stripe Connect accounts associated with this business."
          },
          "default_reporting_basis": {
            "type": "string",
            "nullable": true,
            "enum": [
              "CASH",
              "ACCRUAL"
            ],
            "description": "Default accounting basis for financial reports.",
            "example": "CASH"
          },
          "default_locale": {
            "type": "string",
            "enum": [
              "en-US",
              "fr-CA"
            ],
            "default": "en-US",
            "description": "Default locale used to localize the business's content, such as SMS messages.",
            "example": "en-US"
          },
          "free_trial_ends_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The date and time when the business's free trial ends."
          },
          "bookkeeping_configuration": {
            "type": "object",
            "nullable": true,
            "description": "Optional bookkeeping configuration to create with the business.",
            "properties": {
              "bookkeeping_status": {
                "type": "string",
                "description": "Initial bookkeeping status (e.g. `ONBOARDING`)."
              },
              "metadata": {
                "$ref": "#/components/schemas/PlatformDefinedJson",
                "nullable": true,
                "description": "Optional freeform JSON (max 1KB). Set on business create only."
              }
            }
          },
          "enable_bookkeeping": {
            "type": "boolean",
            "default": false,
            "description": "When true, enrolls the created business into bookkeeping, provided that the platform is configured for bookkeeping."
          }
        }
      },
      "StripeConfigurationResponse": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Stripe_Configuration`.",
            "example": "Stripe_Configuration"
          },
          "stripe_secret_last_4": {
            "type": "string",
            "description": "Last 4 digits of the stripe connect account.",
            "example": "8765"
          }
        }
      },
      "QuickbooksConfigurationResponse": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Quickbooks_Configuration`.",
            "example": "Quickbooks_Configuration"
          },
          "client_id": {
            "type": "string",
            "description": "The client ID issued to your platform by Quickbooks.",
            "example": "ABCD1234FAKECLIENTID"
          },
          "secret_last_4": {
            "type": "string",
            "description": "The client secret associated with your Quickbooks client ID, masked except for the last four digits for reference.",
            "example": "**************CRET"
          },
          "environment": {
            "$ref": "#/components/schemas/QuickbooksEnvironmentType"
          },
          "redirect_url": {
            "type": "string",
            "format": "uri",
            "description": "The URL to which Quickbooks should redirect after authentication.",
            "example": "https://yourplatform.com/link-quickbooks"
          }
        }
      },
      "NewCustomAccountBalance": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "description": "The new balance for the custom account, in cents."
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "The timestamp when the new balance was recorded."
          }
        }
      },
      "CustomTransactionUpload": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Custom_Transaction_Upload`.",
            "example": "Custom_Transaction_Upload"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the transaction upload."
          },
          "custom_account_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the custom account the transactions were uploaded to."
          },
          "custom_account_name": {
            "type": "string",
            "description": "Name of the custom account."
          },
          "uploaded_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the upload occurred."
          },
          "upload_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the uploaded file or batch."
          },
          "transaction_count": {
            "type": "integer",
            "description": "Number of transactions in this upload."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp when the upload was archived, if applicable."
          }
        }
      },
      "CustomTransactionUploads": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Custom_Transaction_Uploads`.",
            "example": "Custom_Transaction_Uploads"
          },
          "uploads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomTransactionUpload"
            },
            "description": "List of transaction uploads."
          }
        }
      },
      "UpdateApiLedgerAccount": {
        "type": "object",
        "required": [
          "name",
          "normality",
          "account_type",
          "account_subtype"
        ],
        "properties": {
          "stable_name": {
            "$ref": "#/components/schemas/AccountStableName"
          },
          "name": {
            "type": "string",
            "description": "Display name of the ledger account.",
            "example": "Consulting Revenue"
          },
          "account_number": {
            "type": "string",
            "nullable": true,
            "description": "Optional account number for the ledger account.",
            "example": "4000"
          },
          "normality": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "parent_id": {
            "$ref": "#/components/schemas/AccountIdentifier"
          },
          "account_type": {
            "$ref": "#/components/schemas/LedgerAccountType"
          },
          "account_subtype": {
            "$ref": "#/components/schemas/LedgerAccountSubtype"
          }
        },
        "description": "Parameters for fully updating a ledger account (PUT operation)."
      },
      "ApiBookkeepingStatus": {
        "type": "object",
        "description": "Simple bookkeeping enrollment status returned by activate and deactivate.",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "NOT_PURCHASED",
              "BOOKKEEPING_PAUSED",
              "ACTIVE"
            ],
            "description": "Bookkeeping enrollment status after activate or deactivate.",
            "example": "ACTIVE"
          }
        },
        "required": [
          "status"
        ]
      },
      "SetBookkeepingStartDateParams": {
        "type": "object",
        "description": "The first month to include in bookkeeping.",
        "properties": {
          "year": {
            "type": "integer",
            "format": "int32",
            "minimum": 2020,
            "maximum": 2100,
            "description": "The calendar year of the first bookkeeping month.",
            "example": 2024
          },
          "month": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 12,
            "description": "The calendar month of the first bookkeeping month, from 1 through 12.",
            "example": 7
          }
        },
        "required": [
          "year",
          "month"
        ]
      },
      "ApiBookkeepingStartDate": {
        "type": "object",
        "description": "The effective bookkeeping start date.",
        "properties": {
          "bookkeeping_start_date": {
            "type": "string",
            "format": "date",
            "description": "The first day of the first bookkeeping month.",
            "example": "2024-07-01"
          }
        },
        "required": [
          "bookkeeping_start_date"
        ]
      },
      "ApiBookkeepingStatusDetail": {
        "type": "object",
        "description": "Effective bookkeeping enrollment status and onboarding completion metadata for a business.",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "NOT_PURCHASED",
              "ONBOARDING",
              "BOOKKEEPING_PAUSED",
              "ACTIVE"
            ],
            "description": "Effective bookkeeping enrollment status.",
            "example": "ACTIVE"
          },
          "onboarding_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Date onboarding was completed. Null if onboarding is not yet complete."
          },
          "scheduled_onboarding_call_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Start time of the scheduled onboarding call, if any."
          },
          "onboarding_call_url": {
            "type": "string",
            "format": "uri",
            "nullable": true,
            "description": "Business-specific onboarding scheduling URL. Use this URL unchanged to preserve the business-identifying tracking parameters. Null if no onboarding scheduling URL is configured."
          }
        },
        "required": [
          "status"
        ]
      },
      "ApiVendorData": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `VendorData`.",
            "example": "VendorData"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the vendor."
          },
          "external_id": {
            "type": "string",
            "description": "Unique ID of the vendor in your system for linking purposes. **Idempotency key**."
          },
          "individual_name": {
            "type": "string",
            "nullable": true,
            "description": "Full name of the individual vendor or contact at a corporate vendor."
          },
          "company_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the company vendor."
          },
          "email": {
            "type": "string",
            "nullable": true,
            "description": "Email address of the vendor."
          },
          "mobile_phone": {
            "type": "string",
            "nullable": true,
            "description": "Mobile phone number of the vendor."
          },
          "office_phone": {
            "type": "string",
            "nullable": true,
            "description": "Office phone number of the vendor."
          },
          "address_string": {
            "type": "string",
            "nullable": true,
            "description": "Address of the vendor."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor (for example, to display to end users)."
          },
          "status": {
            "type": "string",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ],
            "description": "Status of the vendor.",
            "example": "ACTIVE"
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          }
        }
      },
      "CreateVendorInput": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID for the vendor."
          },
          "individual_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of individual vendor or contact."
          },
          "company_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of company vendor."
          },
          "email": {
            "type": "string",
            "nullable": true,
            "description": "Email address."
          },
          "mobile_phone": {
            "type": "string",
            "nullable": true,
            "description": "Mobile phone number."
          },
          "office_phone": {
            "type": "string",
            "nullable": true,
            "description": "Office phone number."
          },
          "address_string": {
            "type": "string",
            "nullable": true,
            "description": "Physical address."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor (for example, to display to end users)."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          }
        }
      },
      "UpdateVendorParams": {
        "type": "object",
        "description": "Parameters for updating a vendor. All fields are optional.",
        "properties": {
          "individual_name": {
            "type": "string",
            "nullable": true,
            "description": "Full name of the individual vendor or contact at a corporate vendor."
          },
          "company_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the company vendor."
          },
          "email": {
            "type": "string",
            "nullable": true,
            "description": "Email address of the vendor."
          },
          "mobile_phone": {
            "type": "string",
            "nullable": true,
            "description": "Mobile phone number of the vendor."
          },
          "office_phone": {
            "type": "string",
            "nullable": true,
            "description": "Office phone number of the vendor."
          },
          "address_string": {
            "type": "string",
            "nullable": true,
            "description": "Address of the vendor."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor (for example, to display to end users)."
          },
          "status": {
            "type": "string",
            "description": "Status of the vendor. Possible values: `ACTIVE`, `ARCHIVED`.",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ],
            "example": "ACTIVE"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          }
        }
      },
      "BillStatus": {
        "type": "string",
        "enum": [
          "RECEIVED",
          "PARTIALLY_PAID",
          "PAID",
          "VOIDED"
        ],
        "example": "RECEIVED"
      },
      "BillTerms": {
        "type": "string",
        "enum": [
          "DUE_ON_RECEIPT",
          "NET_10",
          "NET_15",
          "NET_30",
          "NET_60"
        ],
        "description": "Payment terms for the bill.",
        "example": "NET_30"
      },
      "NewBillPostParams": {
        "type": "object",
        "required": [
          "received_at",
          "line_items"
        ],
        "properties": {
          "external_id": {
            "type": "string",
            "description": "External ID for the bill within your platform. **Idempotency key**."
          },
          "received_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the bill was received by the business from the vendor."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the bill is due. Either due_at or bill_terms must be specified, but not both."
          },
          "bill_terms": {
            "$ref": "#/components/schemas/BillTerms",
            "description": "Payment terms for the bill. Either due_at or bill_terms must be specified, but not both."
          },
          "additional_discount": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "default": 0,
            "description": "Additional discount applied to the whole bill in addition to individual line item discounts, in cents."
          },
          "memo": {
            "type": "string",
            "description": "Memo for any text you would like to associate with the bill (for example, to display to end users)."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the vendor to associate with the bill. Either vendor_id or vendor_external_id must be specified."
          },
          "vendor_external_id": {
            "type": "string",
            "description": "External ID of the vendor to associate with the bill. Either vendor_id or vendor_external_id must be specified."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewBillLineItem"
            },
            "description": "Line items making up the bill."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateImmediateBillPaymentInput"
            },
            "nullable": true,
            "description": "Payments that have been made towards the balance of the bill. When upserting an existing bill: omitting this field (or passing `null`) preserves any existing dedicated payments; passing an empty array `[]` removes all dedicated payments. Non-dedicated payments (those independently recorded or included in a vendor payout) are never removed by this field."
          },
          "additional_sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateTaxLineItem"
            },
            "description": "Additional sales tax line items for the bill."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "is_expense": {
            "type": "boolean",
            "default": false,
            "description": "Whether the bill should be treated as an expense."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bill. Can be used to filter when listing bills."
          }
        }
      },
      "BillUpdatePayload": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID for the bill within your platform."
          },
          "received_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the bill was received."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the bill is due. Cannot be specified along with bill_terms."
          },
          "bill_terms": {
            "$ref": "#/components/schemas/BillTerms",
            "description": "Payment terms for the bill. Cannot be specified along with due_at."
          },
          "memo": {
            "type": "string",
            "description": "Memo for any text you would like to associate with the bill (for example, to display to end users)."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the vendor associated with the bill."
          },
          "vendor_external_id": {
            "type": "string",
            "description": "External ID of the vendor associated with the bill."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewBillLineItem"
            },
            "description": "Updated line items for the bill."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateImmediateBillPaymentInput"
            },
            "nullable": true,
            "description": "Payments for the bill. Omitting this field (or passing `null`) preserves any existing dedicated payments; passing an empty array `[]` removes all dedicated payments. Non-dedicated payments (those independently recorded or included in a vendor payout) are never removed by this field."
          },
          "additional_sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateTaxLineItem"
            },
            "description": "Updated additional sales tax line items."
          },
          "status": {
            "$ref": "#/components/schemas/BillStatus",
            "description": "Updated status of the bill."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bill. Can be used to filter when listing bills."
          }
        }
      },
      "NewBillLineItem": {
        "type": "object",
        "required": [
          "product_name",
          "unit_price"
        ],
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the bill line item in your system."
          },
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Account identifier for the line item."
          },
          "prepayment_account_identifier": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "Ledger account for the line item used for accrual reporting. Should only be specified when this line item is a pre-payment."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description for the bill line item."
          },
          "product_name": {
            "type": "string",
            "description": "Name of the product/service the line item is for."
          },
          "unit_price": {
            "type": "integer",
            "format": "int64",
            "description": "Price of a single unit of the product (in cents)."
          },
          "quantity": {
            "type": "number",
            "format": "bigdecimal",
            "nullable": true,
            "description": "Number of units of the product purchased.",
            "default": 1
          },
          "discount_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of discount applied to this line item in cents."
          },
          "sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateTaxLineItem"
            },
            "nullable": true,
            "description": "Sales tax line items for this line item."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "nullable": true,
            "description": "Tags for the bill line item."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the bill line item."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bill line item."
          }
        }
      },
      "ApiBillLineItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the bill line item."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the bill line item in your system."
          },
          "bill_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the parent bill."
          },
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Account identifier for the line item."
          },
          "ledger_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "Ledger account for the line item."
          },
          "prepayment_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "Ledger account for the line item used for accrual reporting. Should only be specified when this line item is a pre-payment."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description for the bill line item."
          },
          "product_name": {
            "type": "string",
            "description": "Name of the product/service."
          },
          "unit_price": {
            "type": "integer",
            "format": "int64",
            "description": "Price per unit in cents."
          },
          "quantity": {
            "type": "number",
            "format": "bigdecimal",
            "description": "Number of units."
          },
          "subtotal": {
            "type": "integer",
            "format": "int64",
            "description": "Subtotal for the line item in cents."
          },
          "discount_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of discount in cents."
          },
          "sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBillTaxLineItem"
            },
            "description": "Sales tax line items."
          },
          "sales_taxes_total": {
            "type": "integer",
            "format": "int64",
            "description": "Total sales tax in cents."
          },
          "total_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Total amount including taxes and discounts."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags for the bill line item."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo associated with the bill line item."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier associated with the bill line item."
          }
        }
      },
      "ApiBill": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Bill`.",
            "example": "Bill"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the bill."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the Business that received the bill."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the bill in your system."
          },
          "status": {
            "$ref": "#/components/schemas/BillStatus",
            "description": "Status of the bill."
          },
          "terms": {
            "$ref": "#/components/schemas/BillTerms",
            "description": "Payment terms of the bill."
          },
          "received_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the bill was received."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the bill is due."
          },
          "paid_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the bill was paid."
          },
          "voided_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the bill was voided. Voiding excludes the bill from accounting."
          },
          "memo": {
            "type": "string",
            "description": "Memo for the bill for display."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBillLineItem"
            },
            "description": "Line items making up the bill."
          },
          "additional_sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBillTaxLineItem"
            },
            "description": "Additional sales tax line items."
          },
          "additional_sales_taxes_total": {
            "type": "integer",
            "description": "Sum of all additional taxes in cents."
          },
          "additional_discount": {
            "type": "integer",
            "format": "int64",
            "description": "Additional discount applied to the whole bill in addition to individual line item discounts, in cents."
          },
          "subtotal": {
            "type": "integer",
            "description": "Subtotal of all line items in cents."
          },
          "total_amount": {
            "type": "integer",
            "description": "Total amount including taxes in cents."
          },
          "outstanding_balance": {
            "type": "integer",
            "description": "Remaining balance after payments in cents."
          },
          "payment_allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBillPaymentAllocationWithPayment"
            },
            "description": "Payments made to a vendor are allocated toward one or many bills. This list shows which payments have been allocated toward this bill. The most common case is a 1:1 relationship between a payment and a bill, in which case the allocation amount matches the payment amount."
          },
          "vendor_credits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiVendorCreditAllocationWithVendorCredit"
            },
            "description": "Vendor credit allocations for this bill."
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the bill was imported. **Eligible sort key**."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the bill was last updated. **Eligible sort key**."
          },
          "vendor": {
            "$ref": "#/components/schemas/ApiVendorData",
            "description": "The vendor associated with this bill."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          },
          "is_expense": {
            "type": "boolean",
            "description": "Whether this bill is an expense. Expenses are a type of bill for purchases paid at the time of the transaction."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bill. Can be used to filter when listing bills."
          }
        }
      },
      "CreateImmediateBillPaymentInput": {
        "type": "object",
        "required": [
          "method",
          "amount"
        ],
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID for the payment."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "Method used for payment."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Payment amount in cents."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Payment processor used."
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The the ledger account to use for the payment (overrides the default determined by the payment method)."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the bill payment (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bill payment. Can be used to filter when listing bill payments."
          }
        }
      },
      "CreateStandaloneBillPayment": {
        "type": "object",
        "required": [
          "paid_at",
          "method",
          "amount",
          "bill_payment_allocations"
        ],
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID for the payment."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Layer ID of the vendor to associate with the payment. Lets you tag a payment with a vendor even before it is allocated to any bill (for example, a standalone deposit). When the payment has bill allocations, the vendor must match the vendor on every allocated bill, otherwise the request is rejected with a 400."
          },
          "vendor_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the vendor to associate with the payment. Can be specified in place of `vendor_id`."
          },
          "paid_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the payment was made."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "Method used for payment."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Payment amount in cents."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Payment processor used."
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The the ledger account to use for the payment (overrides the default determined by the payment method)."
          },
          "bill_payment_allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BillPaymentAllocationInput"
            },
            "description": "How the payment is allocated across bills."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the bill payment (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bill payment. Can be used to filter when listing bill payments."
          }
        }
      },
      "BillPaymentUpdatePayload": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID for the payment."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Layer ID of the vendor to associate with the payment. Pass `null` to clear the association. When the payment has bill allocations, the vendor must match the vendor on every allocated bill, otherwise the request is rejected with a 400."
          },
          "vendor_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the vendor to associate with the payment. Can be specified in place of `vendor_id`."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "When the payment was made."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Payment amount in cents."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "Method used for payment."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Payment processor used."
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The the ledger account to use for the payment (overrides the default determined by the payment method)."
          },
          "bill_payment_allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BillPaymentAllocationInput"
            },
            "description": "Updated payment allocations across bills."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the bill payment (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bill payment. Can be used to filter when listing bill payments."
          }
        }
      },
      "ApiBillPayment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the payment."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID for the payment."
          },
          "vendor": {
            "$ref": "#/components/schemas/ApiVendorData",
            "nullable": true,
            "description": "The vendor associated with this payment, if one has been set. May be present even when the payment is not allocated to any bill."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "When the payment was made."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "Method used for payment."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Payment amount in cents."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Payment processor used."
          },
          "payment_clearing_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "The the ledger account to use for the payment (overrides the default determined by the payment method), if specified."
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the payment was imported."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBillPaymentAllocation"
            },
            "description": "How the payment is allocated across bills."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags associated with the payment."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the bill payment (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bill payment. Can be used to filter when listing bill payments."
          }
        }
      },
      "BillPaymentAllocationInput": {
        "type": "object",
        "required": [
          "amount"
        ],
        "properties": {
          "bill_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the bill to apply payment to."
          },
          "bill_external_id": {
            "type": "string",
            "description": "External ID of the bill to apply payment to."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount to allocate to this bill in cents."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the bill payment allocation (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bill payment allocation."
          }
        }
      },
      "ApiBillPaymentAllocation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the allocation."
          },
          "bill_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the bill."
          },
          "payment_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the payment."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the payment allocated toward this bill, in cents. If this amount equals the full payment amount, the payment was fully allocated toward this bill. The amount cannot exceed the bill total."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags associated with the allocation."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the bill payment allocation (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bill payment allocation."
          }
        }
      },
      "ApiBillPaymentAllocationWithPayment": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the allocation."
          },
          "bill_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the bill."
          },
          "payment_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the payment."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the payment allocated toward this bill, in cents. If this amount equals the full payment amount, the payment was fully allocated toward this bill. The amount cannot exceed the bill total."
          },
          "payment": {
            "$ref": "#/components/schemas/ApiBillPayment",
            "description": "The full payment details."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags associated with the allocation."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the bill payment allocation (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bill payment allocation."
          }
        }
      },
      "BillLedgerEntrySource": {
        "type": "object",
        "properties": {
          "bill_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string",
            "nullable": true
          },
          "bill_number": {
            "type": "string",
            "nullable": true
          },
          "vendor_name": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "entity_name": {
            "type": "string",
            "default": "Bill"
          },
          "display_description": {
            "type": "string",
            "default": "Generated display description based on bill number and date"
          }
        }
      },
      "BillPaymentLedgerEntrySource": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true
          },
          "bill_id": {
            "type": "string",
            "format": "uuid"
          },
          "bill_number": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "entity_name": {
            "type": "string",
            "default": "Bill Payment"
          },
          "display_description": {
            "type": "string",
            "default": "Payment on bill based on bill number"
          }
        }
      },
      "ApiTaxLineItem": {
        "type": "object",
        "required": [
          "amount",
          "tax_rate",
          "tax_rate_id"
        ],
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Tax amount in cents."
          },
          "tax_rate": {
            "type": "number",
            "format": "float",
            "description": "Tax rate as a decimal (e.g., 0.08 for 8%)."
          },
          "tax_rate_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the tax rate."
          },
          "tax_rate_name": {
            "type": "string",
            "description": "Display name of the tax rate."
          }
        }
      },
      "ApiCustomerData": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `CustomerData`.",
            "example": "CustomerData"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the customer."
          },
          "external_id": {
            "type": "string",
            "description": "Unique ID of the customer in your system for linking purposes. **Idempotency key**.",
            "example": "31415926535"
          },
          "individual_name": {
            "type": "string",
            "nullable": true,
            "description": "Full name of the individual customer or contact at a corporate customer."
          },
          "company_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the company customer."
          },
          "email": {
            "type": "string",
            "nullable": true,
            "description": "Email address of the customer."
          },
          "mobile_phone": {
            "type": "string",
            "nullable": true,
            "description": "Mobile phone number of the customer."
          },
          "office_phone": {
            "type": "string",
            "nullable": true,
            "description": "Office phone number of the customer."
          },
          "address_string": {
            "type": "string",
            "nullable": true,
            "description": "Address of the customer."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the customer (for example, to display to end users)."
          },
          "status": {
            "type": "string",
            "description": "Status of the customer. Possible values: `ACTIVE`, `ARCHIVED`.",
            "example": "ACTIVE"
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          }
        }
      },
      "CreateCustomerInput": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID for the customer."
          },
          "individual_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of individual customer or contact."
          },
          "company_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of company customer."
          },
          "email": {
            "type": "string",
            "nullable": true,
            "description": "Email address."
          },
          "mobile_phone": {
            "type": "string",
            "nullable": true,
            "description": "Mobile phone number."
          },
          "office_phone": {
            "type": "string",
            "nullable": true,
            "description": "Office phone number."
          },
          "address_string": {
            "type": "string",
            "nullable": true,
            "description": "Physical address."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the customer (for example, to display to end users)."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          }
        }
      },
      "UpdateCustomerParams": {
        "type": "object",
        "description": "Parameters for updating a customer. All fields are optional.",
        "properties": {
          "individual_name": {
            "type": "string",
            "nullable": true,
            "description": "Full name of the individual customer or contact at a corporate customer."
          },
          "company_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the company customer."
          },
          "email": {
            "type": "string",
            "nullable": true,
            "description": "Email address of the customer."
          },
          "mobile_phone": {
            "type": "string",
            "nullable": true,
            "description": "Mobile phone number of the customer."
          },
          "office_phone": {
            "type": "string",
            "nullable": true,
            "description": "Office phone number of the customer."
          },
          "address_string": {
            "type": "string",
            "nullable": true,
            "description": "Address of the customer."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the customer (for example, to display to end users)."
          },
          "status": {
            "type": "string",
            "description": "Status of the customer. Possible values: `ACTIVE`, `ARCHIVED`.",
            "enum": [
              "ACTIVE",
              "ARCHIVED"
            ],
            "example": "ACTIVE"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          }
        }
      },
      "ApiInvoice": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the invoice."
          },
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'Invoice'.",
            "example": "Invoice"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the Business that generated the invoice."
          },
          "external_id": {
            "type": "string",
            "description": "Unique ID of the invoice in your system for linking purposes.",
            "example": "1"
          },
          "status": {
            "$ref": "#/components/schemas/InvoiceStatus",
            "description": "Status of the invoice."
          },
          "sent_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the invoice was sent by the business to the recipient."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the invoice is due."
          },
          "paid_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the invoice was paid."
          },
          "voided_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the invoice was voided. Voiding excludes the invoice from accounting."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiInvoiceLineItem"
            },
            "description": "Line items making up the invoice."
          },
          "subtotal": {
            "type": "integer",
            "description": "Subtotal of all invoice line items in cents."
          },
          "additional_discount": {
            "type": "integer",
            "description": "Additional discount applied to the whole invoice in addition to individual line items."
          },
          "additional_sales_taxes_total": {
            "type": "integer",
            "description": "Sum of all taxes across the invoice line items and any additional taxes in cents."
          },
          "additional_sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiInvoiceTaxLineItem"
            },
            "description": "List of additional sales tax line items."
          },
          "tips": {
            "type": "integer",
            "description": "Tips included by the buyer, in cents."
          },
          "total_amount": {
            "type": "integer",
            "description": "Total amount of the invoice in cents."
          },
          "outstanding_balance": {
            "type": "integer",
            "description": "The remaining balance on the invoice after factoring in all previous invoice payments and write-offs."
          },
          "memo": {
            "type": "string",
            "description": "Memo for any text you would like to associate with the Invoice (for example, to display to end users)."
          },
          "payment_allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiInvoicePaymentAllocation"
            },
            "description": "Payments made by a customer are allocated toward one or many invoices. This list shows which payments have been been allocated towards this invoice. The most common case is that there is a 1:1 relationship between a payment and an invoice, in which case the allocation\u2019s `amount` will match the payment\u2019s `amount`.",
            "example": []
          },
          "refund_allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiRefundAllocation"
            },
            "description": "Refunds made by a customer are allocated toward one or many invoices. This list shows which refunds have been been allocated towards this invoice.",
            "example": []
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time when the invoice was first imported into Layer. **Eligible sort key**."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time when the invoice was first updated in Layer. **Eligible sort key**."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags on the transactions associated with the invoice."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the invoice. Can be used to filter when listing invoices."
          }
        }
      },
      "ApiBalanceTimestamps": {
        "type": "object",
        "properties": {
          "external_account_external_id": {
            "type": "string",
            "description": "Unique ID of the external account in an external system for linking and idempotency.",
            "example": "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq"
          },
          "external_account_source": {
            "$ref": "#/components/schemas/TransactionSource",
            "description": "Source of the external account."
          },
          "balance_timestamps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBalanceTimestamp"
            },
            "description": "List of balance timestamps for the external account."
          }
        }
      },
      "ApiLedgerBalances": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Ledger_Balances`.",
            "example": "Ledger_Balances"
          },
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NestedApiLedgerAccount"
            }
          }
        }
      },
      "ApiTag": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID for the tag."
          },
          "key": {
            "type": "string",
            "description": "Key for the tag.",
            "example": "ExampleTagKey"
          },
          "dimension_display_name": {
            "type": "string",
            "nullable": true,
            "description": "Display name for the tag dimension."
          },
          "value": {
            "type": "string",
            "description": "Value for the tag.",
            "example": "ExampleTagValue"
          },
          "value_display_name": {
            "type": "string",
            "nullable": true,
            "description": "Display name for the tag value definition."
          },
          "dimension_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the tag dimension this tag belongs to."
          },
          "definition_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the tag value definition."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the tag was archived."
          }
        },
        "required": [
          "id",
          "key",
          "value",
          "dimension_id",
          "definition_id"
        ]
      },
      "UpdateModeLinkCreationPayload": {
        "type": "object",
        "properties": {
          "plaid_item_id": {
            "type": "string"
          }
        }
      },
      "ApiMatch": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Match`.",
            "example": "Match"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer's UUID for the match."
          },
          "match_type": {
            "$ref": "#/components/schemas/MatchType",
            "description": "Type of the object to match."
          },
          "bank_transaction": {
            "$ref": "#/components/schemas/ApiBankTransactionInterface"
          },
          "details": {
            "$ref": "#/components/schemas/ApiMatchDetails"
          }
        }
      },
      "BusinessActivitySummary": {
        "type": "object",
        "properties": {
          "businessId": {
            "type": "string",
            "format": "uuid",
            "description": "The ID of the business this activity summary is for."
          },
          "legal_name": {
            "type": "string",
            "description": "The legal name of the business this summary is for.",
            "example": "ACME Inc."
          },
          "sms_sent": {
            "type": "integer",
            "description": "The number of SMS messages sent by the business.",
            "example": 400
          },
          "sms_received": {
            "type": "integer",
            "description": "The number of SMS messages received by the business.",
            "example": 400
          },
          "sms_sent_last_30": {
            "type": "integer",
            "description": "The number of SMS messages sent by the business within the last 30 days.",
            "example": 40
          },
          "sms_received_last_30": {
            "type": "integer",
            "description": "The number of SMS messages received by the business within the last 30 days.",
            "example": 40
          },
          "categorized_last_month": {
            "type": "integer",
            "description": "The number of transactions for the business last month that were categorized.",
            "example": 60
          },
          "uncategorized_last_month": {
            "type": "integer",
            "description": "The number of transactions for the business last month that were not categorized.",
            "example": 5
          },
          "categorized_by_api_last_month": {
            "type": "integer",
            "description": "The number of transactions for the business last month that were categorized via Layer's API.",
            "example": 40
          },
          "categorized_by_sms_last_month": {
            "type": "integer",
            "description": "The number of transactions for the business last month that were categorized via Layer's SMS flows.",
            "example": 20
          },
          "categorized_pct_last_month": {
            "type": "number",
            "description": "The percent of transactions for the business last month that were categorized.",
            "example": 0.92
          },
          "categorized_this_month": {
            "type": "integer",
            "description": "The number of transactions for the business this month that have been categorized.",
            "example": 30
          },
          "uncategorized_this_month": {
            "type": "integer",
            "description": "The number of transactions for the business this month that have not been categorized.",
            "example": 10
          },
          "categorized_by_api_this_month": {
            "type": "integer",
            "description": "The number of transactions for the business this month that have been categorized via Layer's API.",
            "example": 10
          },
          "categorized_by_sms_this_month": {
            "type": "integer",
            "description": "The number of transactions for the business this month that have been categorized via Layer's SMS flows.",
            "example": 20
          },
          "categorized_pct_this_month": {
            "type": "number",
            "description": "The percent of transactions for the business last month that were categorized.",
            "example": 0.75
          },
          "days_since_last_activity": {
            "type": "integer",
            "description": "The number of days since the business was last active (sent an SMS, categorized a transaction).",
            "example": 1
          },
          "current_sms_queue_length": {
            "type": "integer",
            "description": "The number of transactions ready for categorization via SMS.",
            "example": 5
          }
        }
      },
      "BusinessActivitySummaryV2": {
        "type": "object",
        "properties": {
          "months": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/BusinessActivityMonthlySummary"
            },
            "description": "Monthly activity summaries for a single business."
          }
        },
        "description": "Business activity summary with monthly breakdowns."
      },
      "BusinessActivityMonthlySummary": {
        "type": "object",
        "properties": {
          "month": {
            "type": "string",
            "description": "The month in YYYY-MM format.",
            "example": "2024-01"
          },
          "sms_sent": {
            "type": "integer",
            "description": "Number of SMS messages sent by this business in this month.",
            "example": 5
          },
          "sms_received": {
            "type": "integer",
            "description": "Number of SMS messages received by this business in this month.",
            "example": 3
          },
          "categorized_transactions": {
            "type": "integer",
            "description": "Number of transactions categorized in this month.",
            "example": 10
          },
          "uncategorized_transactions": {
            "type": "integer",
            "description": "Number of transactions that remain uncategorized in this month.",
            "example": 2
          },
          "categorized_by_api": {
            "type": "integer",
            "description": "Number of transactions categorized via Layer's API in this month.",
            "example": 7
          },
          "categorized_by_sms": {
            "type": "integer",
            "description": "Number of transactions categorized via Layer's SMS flows in this month.",
            "example": 3
          },
          "categorization_pct": {
            "type": "number",
            "description": "The fraction of transactions that were categorized this month (0-1).",
            "example": 0.83
          },
          "active_days": {
            "type": "integer",
            "description": "Number of days in this month where the business had SMS or categorization activity.",
            "example": 15
          },
          "external_accounts_linked": {
            "type": "integer",
            "description": "Number of external accounts linked to this business during this month.",
            "example": 2
          },
          "external_accounts_unlinked": {
            "type": "integer",
            "description": "Number of external accounts unlinked from this business during this month.",
            "example": 1
          },
          "external_account_links_active": {
            "type": "integer",
            "description": "Snapshot of the number of external accounts linked to this business at the end of the month. For the current in-progress month, this reflects the count as of the current time.",
            "example": 4
          }
        }
      },
      "EmptyResponse": {
        "type": "object",
        "properties": {}
      },
      "NewCustomTransactions": {
        "type": "object",
        "properties": {
          "transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewCustomTransactionParams"
            },
            "description": "List of new transactions to import."
          }
        }
      },
      "ClientActivitySummary": {
        "type": "object",
        "properties": {
          "businesses_onboarded": {
            "type": "integer",
            "description": "The total number of businesses on your platform onboarded onto Layer.",
            "example": 100
          },
          "businesses_sent_sms": {
            "type": "integer",
            "description": "The total number of businesses on your platform that have used Layer's SMS workflows.",
            "example": 80
          },
          "businesses_engaged": {
            "type": "integer",
            "description": "The total number of businesses on your platform that have used Layer's transaction categorization workflows.",
            "example": 95
          },
          "businesses_engaged_last_30": {
            "type": "integer",
            "description": "The number of businesses on your platform that have used Layer's transaction categorization workflows within the last 30 days.",
            "example": 90
          },
          "new_businesses_engaged_last_30": {
            "type": "integer",
            "description": "The number of businesses on your platform that have used Layer's transaction categorization workflows within the last 30 days and not previously.",
            "example": 20
          },
          "businesses_engaged_last_90": {
            "type": "integer",
            "description": "The number of businesses on your platform that have used Layer's transaction categorization workflows within the last 90 days.",
            "example": 90
          },
          "new_businesses_engaged_last_90": {
            "type": "integer",
            "description": "The number of businesses on your platform that have used Layer's transaction categorization workflows within the last 90 days and not previously.",
            "example": 70
          },
          "categorized_by_sms_last_30": {
            "type": "integer",
            "description": "The number of transactions categorized by Layer's SMS flows by businesses on your platform within the last 30 days.",
            "example": 1234
          },
          "categorized_by_api_last_30": {
            "type": "integer",
            "description": "The number of transactions categorized by Layer's API by businesses on your platform within the last 30 days.",
            "example": 1234
          }
        }
      },
      "PlatformActivitySummary": {
        "type": "object",
        "properties": {
          "months": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PlatformActivityMonthlySummary"
            },
            "description": "Monthly activity summaries for the platform."
          }
        },
        "description": "Platform-wide activity summary with monthly breakdowns."
      },
      "PlatformActivityMonthlySummary": {
        "type": "object",
        "properties": {
          "month": {
            "type": "string",
            "description": "The month in YYYY-MM format.",
            "example": "2024-07"
          },
          "creations": {
            "type": "integer",
            "description": "Number of businesses created in this month.",
            "example": 15
          },
          "archivals": {
            "type": "integer",
            "description": "Number of businesses archived in this month.",
            "example": 2
          },
          "categorizations": {
            "type": "integer",
            "description": "Total number of transaction categorizations in this month.",
            "example": 1250
          },
          "categorization_uniq_business": {
            "type": "integer",
            "description": "Number of unique businesses that performed categorizations in this month.",
            "example": 45
          },
          "sms_categorizations": {
            "type": "integer",
            "description": "Number of transaction categorizations done via SMS in this month.",
            "example": 800
          },
          "sms_categorizations_uniq_business": {
            "type": "integer",
            "description": "Number of unique businesses that performed SMS categorizations in this month.",
            "example": 30
          },
          "pnl_loads": {
            "type": "integer",
            "description": "Number of P&L report loads in this month.",
            "example": 120
          },
          "pnl_load_uniq_business": {
            "type": "integer",
            "description": "Number of unique businesses that loaded P&L reports in this month.",
            "example": 25
          },
          "active_businesses": {
            "type": "integer",
            "description": "Number of businesses that had any activity (categorizations or P&L loads) in this month.",
            "example": 50
          }
        },
        "description": "Monthly activity summary for a specific month."
      },
      "ApiCustomAccounts": {
        "type": "object",
        "properties": {
          "custom_accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCustomAccount"
            },
            "description": "List of custom accounts."
          }
        }
      },
      "PnlEntry": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/BankTransactionPnlEntry"
          },
          {
            "$ref": "#/components/schemas/SplitBankTransactionPnlEntry"
          }
        ]
      },
      "ExternalAccountQueryParams": {
        "type": "object",
        "properties": {
          "account_source": {
            "$ref": "#/components/schemas/TransactionSource"
          },
          "start_date": {
            "type": "string",
            "format": "date-time"
          },
          "end_date": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TagsDeleteParams": {
        "type": "object",
        "properties": {
          "tag_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "List of tag IDs to delete."
          }
        }
      },
      "ApiLinkToken": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Link_Token"
            ],
            "description": "Resource type. Value will be: \"Link_Token\"."
          },
          "link_token": {
            "type": "string",
            "description": "The link token to use for Plaid authentication."
          },
          "hosted_link": {
            "type": "string",
            "nullable": true,
            "description": "URL for the Plaid Hosted Link flow when hosted link parameters were requested; null for the embedded Plaid Link flow."
          }
        }
      },
      "PlaidConnectionEventType": {
        "type": "string",
        "description": "Recorded event kind. See [Event types](#event-types) for diagnostic guidance.",
        "enum": [
          "LINK_TOKEN_CREATED", "LINK_EXCHANGE_SUCCEEDED", "LINK_EXCHANGE_FAILED", "LINK_CLIENT_OUTCOME",
          "LINK_UPDATE_COMPLETED", "WEBHOOK_RECEIVED", "SYNC_FAILED", "CONNECTION_NEEDS_REPAIR",
          "CONNECTION_REPAIRED", "PROCESSOR_TOKEN_ATTACHED", "CONNECTION_ARCHIVED",
          "CONNECTION_DISCONNECTED", "CONNECTION_REACTIVATED"
        ]
      },
      "ApiPlaidConnectionEvent": {
        "type": "object",
        "required": ["type", "id", "event_type", "source", "created_at"],
        "properties": {
          "type": { "type": "string", "enum": ["Plaid_Connection_Event"] },
          "id": { "type": "string", "format": "uuid", "description": "Layer event UUID." },
          "event_type": { "$ref": "#/components/schemas/PlaidConnectionEventType" },
          "source": { "type": "string", "enum": ["USER", "PLAID_WEBHOOK", "SYSTEM"], "description": "Origin of the event." },
          "actor": { "type": "string", "nullable": true, "enum": ["USER", "AI_BOOKKEEPER", "MANUAL_BOOKKEEPER", "SYSTEM", "UNKNOWN", null], "description": "Actor recorded for the event, when available." },
          "connection_type": { "type": "string", "nullable": true, "enum": ["ITEM", "PROCESSOR_TOKEN", null] },
          "connection_id": { "type": "string", "format": "uuid", "nullable": true, "description": "Layer item or processor-token UUID, when associated with the event." },
          "plaid_account_id": { "type": "string", "format": "uuid", "nullable": true, "description": "Layer Plaid account UUID, when associated with the event. Filter using account_id." },
          "webhook_type": { "type": "string", "nullable": true, "description": "Plaid webhook type, when recorded." },
          "webhook_code": { "type": "string", "nullable": true, "description": "Plaid webhook code, when recorded." },
          "details": { "type": "string", "nullable": true, "description": "Event-specific diagnostic text; some event types store JSON inside this string. See Event types for interpretation." },
          "created_at": { "type": "string", "format": "date-time", "description": "Time Layer recorded the event." }
        }
      },
      "ApiPlaidStatements": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": ["Plaid_Statements"]
          },
          "accounts": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/ApiPlaidStatementAccount" }
          }
        },
        "required": ["type", "accounts"]
      },
      "ApiPlaidStatementAccount": {
        "type": "object",
        "properties": {
          "account_id": {
            "type": "string"
          },
          "statements": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/ApiPlaidStatement" }
          }
        },
        "required": ["account_id", "statements"]
      },
      "ApiPlaidStatement": {
        "type": "object",
        "properties": {
          "statement_id": {
            "type": "string"
          },
          "month": { "type": "integer", "minimum": 1, "maximum": 12 },
          "year": { "type": "integer" },
          "date_posted": {
            "type": "string",
            "format": "date",
            "nullable": true
          }
        },
        "required": ["statement_id", "month", "year", "date_posted"]
      },
      "ApiPlaidAccount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Universally unique identifier of the Plaid account."
          },
          "plaid_account_id": {
            "type": "string",
            "description": "Plaid's unique identifier for the account."
          },
          "plaid_item_id": {
            "type": "string",
            "description": "Plaid's unique identifier for the item."
          },
          "status": {
            "$ref": "#/components/schemas/AccountStatus"
          },
          "mask": {
            "type": "string",
            "nullable": true,
            "description": "Last 4 digits of the account number.",
            "example": "4321"
          },
          "name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the account.",
            "example": "My plaid account"
          },
          "account_type": {
            "type": "string",
            "nullable": true,
            "description": "Type of the account."
          },
          "subtype": {
            "type": "string",
            "nullable": true,
            "description": "Subtype of the account."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the account was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the account was last updated."
          }
        }
      },
      "PlaidItemConfiguration": {
        "type": "object",
        "properties": {
          "sync_transactions": {
            "type": "boolean",
            "description": "Whether to sync transactions for this item."
          },
          "current_cursor": {
            "type": "string",
            "nullable": true,
            "description": "The current cursor position for transaction sync."
          },
          "archived": {
            "type": "boolean",
            "description": "Whether this item configuration is archived."
          }
        }
      },
      "PlaidInstitution": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the financial institution."
          },
          "institution_id": {
            "type": "string",
            "description": "Plaid's unique identifier for the institution."
          }
        }
      },
      "PlaidLinkPublicToken": {
        "type": "object",
        "properties": {
          "public_token": {
            "type": "string",
            "description": "The public token returned by Plaid Link."
          },
          "institution": {
            "$ref": "#/components/schemas/PlaidInstitution",
            "nullable": true,
            "description": "The financial institution the user selected in Plaid Link, when available. May be null."
          }
        }
      },
      "PlaidAccountConfiguration": {
        "type": "object",
        "properties": {
          "sync_from_time": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp to start syncing account transactions from."
          },
          "status": {
            "$ref": "#/components/schemas/AccountStatus"
          }
        }
      },
      "CreatePlaidItem": {
        "description": "Parameters for specifying a Plaid item when creating or updating a business. Either provide `item_id` and `access_token` to create a new item, or provide `id` to reference an existing Plaid item by its Layer ID. Referencing by `id` is only supported when updating a business, not when creating one.",
        "oneOf": [
          {
            "title": "New Plaid item",
            "type": "object",
            "description": "Create a new Plaid item from an item ID and access token.",
            "required": [
              "item_id",
              "access_token"
            ],
            "properties": {
              "item_id": {
                "type": "string",
                "description": "Plaid's unique identifier for the item."
              },
              "access_token": {
                "type": "string",
                "description": "Access token for the Plaid item."
              },
              "sync_transactions": {
                "type": "boolean",
                "default": true,
                "description": "Whether to sync transactions for this item."
              },
              "institution_plaid_id": {
                "type": "string",
                "nullable": true,
                "description": "Plaid's identifier for the institution."
              }
            }
          },
          {
            "title": "Existing Plaid item by Layer ID",
            "type": "object",
            "description": "Reference an existing Plaid item by its Layer ID. Only valid when updating a business.",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "The Layer ID of an existing Plaid item (the `layer_item_id` from the response)."
              }
            }
          }
        ]
      },
      "CreatePlaidProcessorToken": {
        "description": "Parameters for specifying a Plaid processor token when creating or updating a business. Either provide `processor_token` to create a new token, or provide `id` to reference an existing processor token by its Layer ID. Referencing by `id` is only supported when updating a business, not when creating one.",
        "oneOf": [
          {
            "title": "New Plaid processor token",
            "type": "object",
            "description": "Create a new Plaid processor token.",
            "required": [
              "processor_token"
            ],
            "properties": {
              "processor_token": {
                "type": "string",
                "description": "The processor_token returned by Plaid upon generation via the [/processor/token/create](https://plaid.com/docs/api/processors/#processortokencreate) endpoint."
              }
            }
          },
          {
            "title": "Existing processor token by Layer ID",
            "type": "object",
            "description": "Reference an existing Plaid processor token by its Layer ID. Only valid when updating a business.",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "description": "The Layer ID of an existing Plaid processor token (the `layer_processor_token_id` from the response)."
              }
            }
          }
        ]
      },
      "ApiTransactions": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `External_Account_Transactions`.",
            "example": "External_Account_Transactions"
          },
          "external_account_external_id": {
            "type": "string",
            "description": "Unique ID of the external account in an external system for linking and idempotency.",
            "example": "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq"
          },
          "external_account_source": {
            "$ref": "#/components/schemas/TransactionSource",
            "description": "Source of the external account."
          },
          "transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBankTransactionDataOnly"
            },
            "description": "List of transactions in the external account."
          }
        }
      },
      "PaymentPatchUpdate": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An optional external identifier for the payment.",
            "example": "Unique ID of the invoice payment in an external system for linking and idempotency."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Layer ID of the customer to associate with the payment. Pass `null` to clear the association. When the payment has invoice allocations, the customer must match the customer on every allocated invoice, otherwise the request is rejected with a 400."
          },
          "customer_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the customer to associate with the payment. Can be specified in place of `customer_id`."
          },
          "paid_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp when the payment was completed."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Customer payment amount, in cents."
          },
          "fee": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Fee paid by business for processing of payment in positive cents."
          },
          "additional_fees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentFeeInput"
            },
            "nullable": true,
            "description": "List of additional fees associated with this payment."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "nullable": true,
            "description": "Payment method."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Processor used to make the payment, if any. Any processor name can be provided and will be tracked.",
            "example": "STRIPE"
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The the ledger account to use for the payment (overrides the default determined by the payment method)."
          },
          "invoice_payments": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/CreateInvoicePaymentAllocation",
                  "description": "Allocates a portion of the payment to a specific invoice.",
                  "title": "Invoice Payment Allocation"
                },
                {
                  "$ref": "#/components/schemas/CreateInvoicePaymentAllocationToLedgerAccount",
                  "description": "Allocates a portion of the payment directly to a ledger account, rather than to an invoice.",
                  "title": "Ledger Account Allocation"
                }
              ]
            },
            "nullable": true,
            "description": "Allocations of this payment towards invoices or ledger accounts. Setting these allocations will override any existing allocations."
          },
          "dedicated_refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateDedicatedRefundParams"
            },
            "nullable": true,
            "description": "Dedicated refunds to associate with this invoice payment."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the invoice payment (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the invoice payment. Can be used to filter when listing invoice payments."
          }
        },
        "description": "An object containing a subset of Payment object fields used to update an existing Payment."
      },
      "PaymentFeeInput": {
        "type": "object",
        "properties": {
          "fee_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the fee in cents."
          },
          "description": {
            "type": "string",
            "description": "Description of the fee."
          },
          "account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "[Account identifier](/api-reference/ledger/account-identifier) to which the fee should be allocated."
          },
          "is_passed_to_customer": {
            "type": "boolean",
            "description": "Whether or not the fee is passed to the customer. It is paid by the business otherwise. When calculating the outstanding balance on the invoice, only the portion of each payment allocation that is applied to the invoice (excluding pass-through fees) is considered. This allows customers to pay the invoice amount plus any pass-through fees without the invoice being considered overpaid."
          }
        }
      },
      "ApiInvoicePaymentFee": {
        "type": "object",
        "properties": {
          "fee_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the fee in cents."
          },
          "description": {
            "type": "string",
            "description": "Description of the fee."
          },
          "account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Account to which the fee should be allocated."
          },
          "is_passed_to_customer": {
            "type": "boolean",
            "description": "Whether or not the fee is passed to the customer. It is paid by the business otherwise."
          }
        }
      },
      "ApiInvoicePayment": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Invoice_Payment`.",
            "example": "Invoice_Payment"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the payment."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the invoice payment in an external system for linking and idempotency.",
            "example": "payment-1"
          },
          "customer": {
            "$ref": "#/components/schemas/ApiCustomerData",
            "nullable": true,
            "description": "The customer associated with this payment, if one has been set. May be present even when the payment is not allocated to any invoice."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the payment was completed."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "Payment method."
          },
          "fee": {
            "type": "integer",
            "format": "int64",
            "description": "Fee paid by business for processing of payment in positive cents."
          },
          "prepayment_account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Identifier for the ledger account to use if this is a prepayment."
          },
          "payment_clearing_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "The the ledger account to use for the payment (overrides the default determined by the payment method), if specified."
          },
          "additional_fees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiInvoicePaymentFee"
            },
            "description": "List of additional fees associated with this payment."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Customer payment amount, in cents."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Processor used to make the payment, if any. Any processor name can be provided and will be tracked. Allowed only when `method` is `CREDIT_CARD`, `ACH`, `CREDIT_BALANCE`, or `OTHER`.",
            "example": "STRIPE"
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the payment was imported into Layer."
          },
          "allocations": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ApiInvoicePaymentAllocation",
                  "description": "Allocates a portion of the payment to a specific invoice.",
                  "title": "Invoice Payment Allocation"
                },
                {
                  "$ref": "#/components/schemas/ApiInvoicePaymentAllocationToLedgerAccount",
                  "description": "Allocates a portion of the payment directly to a ledger account, rather than to an invoice.",
                  "title": "Ledger Account Allocation"
                }
              ],
              "discriminator": {
                "propertyName": "type"
              }
            },
            "description": "Allocations specify how a payment is distributed. A payment can include two types of allocations: `InvoicePaymentAllocation` (allocates to an invoice) and `InvoicePaymentAllocationToLedgerAccount` (allocates directly to a ledger account for overpayments or deposits). The sum of all allocation amounts must be less than or equal to the payment amount."
          },
          "refund_allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiRefundAllocation"
            },
            "description": "Refund allocations associated with this invoice payment.",
            "example": []
          },
          "payouts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiPayoutWithoutTransactions"
            },
            "description": "Payouts associated with this payment."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "List of tags associated with this transaction.",
            "example": []
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the invoice payment (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the invoice payment. Can be used to filter when listing invoice payments."
          }
        }
      },
      "ApiBankTransaction": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Bank_Transaction`.",
            "example": "Bank_Transaction"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the bank transaction."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the business the bank transaction is associated with."
          },
          "source": {
            "$ref": "#/components/schemas/TransactionSource",
            "description": "Source of the transaction."
          },
          "source_transaction_id": {
            "type": "string",
            "description": "External transaction ID from the source platform (e.g, Plaid transaction ID).",
            "example": "g4DlKyjXqGH3Kp5XlaWMtwLRrE4Z9AiE8B4Ko"
          },
          "source_account_id": {
            "type": "string",
            "description": "External account ID from the source platform (e.g, Plaid account ID).",
            "example": "Aaoy8G7VXZHVeqNoL1GvcmkPdqpLRWi9NArdG"
          },
          "external_account_id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer's internal UUID for the linked external account. This is distinct from source_account_id, which is the provider's identifier (e.g., Plaid or Stripe account ID)."
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the transaction was imported."
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Date of the transaction."
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection",
            "description": "Direction of the transaction."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Transaction amount in cents."
          },
          "counterparty_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the transaction counterparty.",
            "example": "WeWork"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description of the transaction.",
            "example": "WeWork monthly rent payment"
          },
          "account_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the bank account.",
            "example": "Plaid Checking"
          },
          "categorizationStatus": {
            "$ref": "#/components/schemas/CategorizationStatus",
            "description": "The status of the transaction\u2019s categorization in Layer\u2019s systems."
          },
          "category": {
            "$ref": "#/components/schemas/ApiCategorization",
            "description": "The category assigned to the transaction. Only populated for transactions that have a finalized category."
          },
          "categorization_method": {
            "$ref": "#/components/schemas/ClassifierAgent",
            "description": "The method used to classify the transaction."
          },
          "tax_code": {
            "type": "string",
            "nullable": true,
            "description": "Tax code applied to the transaction's categorization. Currently only supported for businesses incorporated in Canada (`country` is `CA`). See `tax_options` for the codes available for this transaction's date.",
            "example": "GST_PST_BC"
          },
          "tax_options": {
            "$ref": "#/components/schemas/ApiBankTransactionTaxOptions",
            "nullable": true,
            "description": "Tax codes available for categorizing this transaction, scoped to the business's country and the transaction's date. Currently only populated for businesses incorporated in Canada (`country` is `CA`); `null` otherwise."
          },
          "projected_income_category": {
            "$ref": "#/components/schemas/ProjectedIncomeCategory"
          },
          "suggested_matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiSuggestedMatch"
            }
          },
          "match": {
            "$ref": "#/components/schemas/ApiMatch"
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the bank transaction (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bank transaction. Can be used to filter when listing bank transactions."
          },
          "document_ids": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "description": "IDs of non-archived documents attached to the bank transaction, such as receipts or invoices."
          }
        }
      },
      "ApiBankTransactionTaxOptions": {
        "type": "object",
        "description": "Tax codes available for a transaction, grouped by country. Currently only populated for Canada.",
        "properties": {
          "canada": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCanadaTaxOption"
            }
          }
        },
        "required": [
          "canada"
        ]
      },
      "ApiCanadaTaxOption": {
        "type": "object",
        "description": "A Canada Revenue Agency tax code that can be applied to a transaction's `tax_code` field.",
        "properties": {
          "code": {
            "type": "string",
            "description": "The tax code value to send in `tax_code` when categorizing.",
            "example": "GST_PST_BC"
          },
          "display_name": {
            "type": "string",
            "description": "Human-readable, locale-aware name for the tax code.",
            "example": "GST/PST BC"
          },
          "type": {
            "$ref": "#/components/schemas/CanadaTaxType"
          },
          "province": {
            "$ref": "#/components/schemas/CanadianProvince",
            "nullable": true,
            "description": "The Canadian province this tax code applies to, if province-specific."
          },
          "total_rate": {
            "type": "string",
            "description": "Sum of all component rates for this tax code, as a percentage.",
            "example": "12.000"
          },
          "effective_from": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Date this tax code became effective. `null` if there is no lower bound."
          },
          "effective_to": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Last date this tax code is effective. `null` if there is no upper bound."
          },
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCanadaTaxComponent"
            }
          }
        },
        "required": [
          "code",
          "display_name",
          "type",
          "total_rate",
          "components"
        ]
      },
      "ApiCanadaTaxComponent": {
        "type": "object",
        "description": "A single tax component (e.g. GST, PST) that makes up a Canada tax code.",
        "properties": {
          "code": {
            "type": "string",
            "example": "PST_BC"
          },
          "type": {
            "$ref": "#/components/schemas/CanadaTaxComponentType"
          },
          "province": {
            "$ref": "#/components/schemas/CanadianProvince",
            "nullable": true
          },
          "rate": {
            "type": "string",
            "description": "Rate for this component, as a percentage.",
            "example": "7.000"
          },
          "recoverable": {
            "type": "boolean",
            "description": "Whether this tax component is recoverable (e.g. as an input tax credit)."
          }
        },
        "required": [
          "code",
          "type",
          "rate",
          "recoverable"
        ]
      },
      "CanadaTaxType": {
        "type": "string",
        "enum": [
          "TAXABLE",
          "EXEMPT",
          "ZERO_RATED",
          "OUT_OF_SCOPE"
        ],
        "example": "TAXABLE"
      },
      "CanadaTaxComponentType": {
        "type": "string",
        "enum": [
          "GST",
          "HST",
          "PST",
          "QST"
        ]
      },
      "CanadianProvince": {
        "type": "string",
        "description": "Canadian province or territory.",
        "enum": [
          "ALBERTA",
          "BRITISH_COLUMBIA",
          "MANITOBA",
          "NEW_BRUNSWICK",
          "NEWFOUNDLAND_AND_LABRADOR",
          "NORTHWEST_TERRITORIES",
          "NOVA_SCOTIA",
          "NUNAVUT",
          "ONTARIO",
          "PRINCE_EDWARD_ISLAND",
          "QUEBEC",
          "SASKATCHEWAN",
          "YUKON"
        ],
        "example": "BRITISH_COLUMBIA"
      },
      "ApiBankTransactionWithRuleSuggestion": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiBankTransaction"
          },
          {
            "type": "object",
            "properties": {
              "update_categorization_rules_suggestion": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/ApiCreateCategorizationRuleForCounterpartySuggestion"
                  }
                ],
                "nullable": true,
                "description": "Rule suggestion returned after categorization when Layer recommends creating a reusable categorization rule."
              }
            }
          }
        ]
      },
      "ApiCreateCategorizationRuleForCounterpartySuggestion": {
        "type": "object",
        "description": "Consumer-facing rule suggestion for creating a categorization rule for a specific counterparty.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Create_Categorization_Rule_For_Counterparty"
            ]
          },
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "new_rule": {
            "$ref": "#/components/schemas/CreateCategorizationRuleParams"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "business_name": {
            "type": "string",
            "nullable": true
          },
          "counterparty": {
            "type": "object",
            "description": "Counterparty associated with the suggestion.",
            "additionalProperties": true
          },
          "suggestion_prompt": {
            "type": "string"
          },
          "transactions_that_will_be_affected": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBankTransactionDataOnly"
            }
          },
          "accepted_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "dismissed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "ACCEPTED",
              "REJECTED"
            ],
            "example": "PENDING"
          }
        },
        "required": [
          "type",
          "id",
          "created_at",
          "suggestion_prompt",
          "new_rule",
          "transactions_that_will_be_affected",
          "status"
        ]
      },
      "UpdateSuggestedCategorizationRuleParams": {
        "type": "object",
        "description": "Fields that can be patched on a suggested categorization rule.",
        "properties": {
          "dismissed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp that marks the suggestion as dismissed. Set to null to clear dismissal."
          }
        }
      },
      "ApiManualLedgerEntry": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Api_Manual_Ledger_Entry`.",
            "example": "Api_Manual_Ledger_Entry"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Universally unique identifier of the manual ledger entry."
          },
          "created_by": {
            "type": "string",
            "description": "Name of the user who created the manual ledger entry."
          },
          "memo": {
            "type": "string",
            "description": "Memo or description for the manual ledger entry."
          },
          "entry_id": {
            "type": "string",
            "description": "ID of the associated ledger entry."
          },
          "customer": {
            "$ref": "#/components/schemas/ApiCustomerData"
          },
          "vendor": {
            "$ref": "#/components/schemas/ApiVendorData"
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          }
        }
      },
      "ApiExternalAccount": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `External_Account`.",
            "example": "External_Account"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the external account."
          },
          "external_account_external_id": {
            "type": "string",
            "description": "Unique ID of the external account in an external system for linking and idempotency.",
            "example": "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq"
          },
          "external_account_source": {
            "$ref": "#/components/schemas/TransactionSource",
            "description": "Source of the external account."
          },
          "external_account_name": {
            "type": "string",
            "description": "Name of the external account.",
            "example": "My external bank account"
          },
          "latest_balance_timestamp": {
            "$ref": "#/components/schemas/ApiBalanceTimestamp",
            "description": "The latest balance timestamp."
          },
          "current_ledger_balance": {
            "type": "integer",
            "format": "int64",
            "description": "Current ledger balance of the external account in cents."
          },
          "uncategorized_transaction_sum": {
            "type": "integer",
            "format": "int64",
            "description": "Sum of uncategorized transactions for this external account in cents."
          },
          "mask": {
            "type": "string",
            "nullable": true,
            "description": "Last 4 digits of the external account number.",
            "example": "4321"
          },
          "institution": {
            "$ref": "#/components/schemas/ApiExternalAccountInstitution",
            "description": "The institution that the external account is associated with."
          },
          "notifications": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiExternalAccountNotification"
            },
            "description": "List of notifications for this external account."
          },
          "connection_needs_repair_as_of": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp indicating when the connection started needing repair."
          },
          "reconnect_with_new_credentials": {
            "type": "boolean",
            "description": "Whether the connection requires reconnection with new credentials."
          },
          "requires_user_confirmation_as_of": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp indicating when user confirmation was required."
          },
          "connection_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Unique identifier for the connection."
          },
          "connection_external_id": {
            "type": "string",
            "nullable": true,
            "description": "Identifier of the connection in the provider's system. For Plaid accounts linked through Layer, this is the Plaid `item_id`. For Plaid accounts linked with a processor token, this is the Plaid `account_id`, not the processor token. For Stripe accounts, this is the Stripe Connect account ID. For custom accounts, this is null."
          },
          "user_created": {
            "type": "boolean",
            "description": "Whether this external account was created by a user."
          },
          "is_syncing": {
            "type": "boolean",
            "description": "Whether the external account is currently syncing.\n\nThis status is based on the historical update status of the business's Plaid Item or Plaid Processor Token, which progresses through the following stages:\n\n- `NOT_READY`: Plaid has not provided any data yet.\n- `INITIAL_UPDATE_COMPLETE`: Plaid has pulled the first 30 days of transactions.\n- `HISTORICAL_UPDATE_COMPLETE`: Plaid has pulled the full 2 years of transactions.\n\n`is_syncing` is `true` until the Plaid Item or Processor Token reaches `HISTORICAL_UPDATE_COMPLETE`, at which point it becomes `false`.\n\n**Note:** In the Plaid Sandbox environment, the Plaid Item or Processor Token always skips directly to `HISTORICAL_UPDATE_COMPLETE`, so `is_syncing` will typically be `false` for sandbox data."
          },
          "ledger_account_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the [ledger account](https://docs.layerfi.com/api-reference/ledger/chart#ledger-account-object) associated with the external account."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp when the external account was archived."
          },
          "show_transactions_on_or_after": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "If set, only transactions on or after this timestamp are visible. Transactions before this date are hidden from user-facing views and API queries. When this value is set or moved forward, any categorized transactions that fall outside the new bounds are automatically uncategorized."
          },
          "show_transactions_on_or_before": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "If set, only transactions on or before this timestamp are visible. Transactions after this date are hidden from user-facing views and API queries. When this value is set or moved backward, any categorized transactions that fall outside the new bounds are automatically uncategorized."
          }
        }
      },
      "SingleApiChartAccount": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Single_Chart_Account`.",
            "example": "Single_Chart_Account"
          },
          "id": {
            "$ref": "#/components/schemas/AccountIdentifier"
          },
          "name": {
            "type": "string",
            "description": "Name of the account.",
            "example": "Current Assets"
          },
          "account_number": {
            "type": "string",
            "nullable": true,
            "description": "Account number if configured.",
            "example": "4000"
          },
          "stable_name": {
            "$ref": "#/components/schemas/AccountStableName"
          },
          "normality": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "account_type": {
            "$ref": "#/components/schemas/ApiLedgerAccountType"
          },
          "account_subtype": {
            "$ref": "#/components/schemas/ApiLedgerAccountSubtype"
          }
        },
        "description": "A single ledger account without nested children."
      },
      "ApiCustomAccount": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Custom_Account`.",
            "example": "Custom_Account"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique ID for the custom account."
          },
          "external_id": {
            "type": "string",
            "description": "Unique ID of the custom account in an external system for linking and idempotency.",
            "example": "ww9wwLgkrbU3jkg3J4J7ckBR3zKQV6sLPQevK"
          },
          "mask": {
            "type": "string",
            "nullable": true,
            "description": "Last 4 digits of the custom account number.",
            "example": "4321"
          },
          "account_name": {
            "type": "string",
            "description": "Name of the account.",
            "example": "My custom account"
          },
          "institution_name": {
            "type": "string",
            "description": "Name of the institution for the custom account.",
            "example": "My custom account institution"
          },
          "account_type": {
            "type": "string",
            "enum": [
              "DEPOSITORY",
              "CREDIT",
              "LOAN"
            ],
            "nullable": true,
            "description": "The type of the custom account.",
            "example": "DEPOSITORY"
          },
          "account_subtype": {
            "type": "string",
            "enum": [
              "CHECKING",
              "SAVINGS",
              "CREDIT CARD",
              "LOAN"
            ],
            "nullable": true,
            "description": "The subtype of the custom account.",
            "example": "checking"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp of when the custom account was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp of when the custom account was last created."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp of when the custom account was archived."
          },
          "ledger_account_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the [ledger account](https://docs.layerfi.com/api-reference/ledger/chart#ledger-account-object) associated with the custom account."
          }
        }
      },
      "ApiLedgerEntryWithTransaction": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Ledger_Entry_With_Transaction`.",
            "example": "Ledger_Entry_With_Transaction"
          },
          "id": {
            "type": "string",
            "description": "Unique identifier of the ledger entry."
          },
          "business_id": {
            "type": "string",
            "format": "uuid"
          },
          "ledger_id": {
            "type": "string"
          },
          "agent": {
            "$ref": "#/components/schemas/ClassifierAgent"
          },
          "entry_type": {
            "$ref": "#/components/schemas/LedgerEntryType"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "entry_at": {
            "type": "string",
            "format": "date-time"
          },
          "reversal_of_id": {
            "type": "string",
            "nullable": true
          },
          "reversal_id": {
            "type": "string",
            "nullable": true
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiLineItem"
            }
          },
          "transaction": {
            "$ref": "#/components/schemas/ApiBankTransaction"
          },
          "invoice": {
            "$ref": "#/components/schemas/ApiInvoice"
          },
          "manual_entry": {
            "$ref": "#/components/schemas/ApiManualLedgerEntry"
          },
          "source": {
            "$ref": "#/components/schemas/LedgerEntrySource"
          }
        }
      },
      "ApiLineItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the ledger account line item."
          },
          "entry_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the Journal entry the ledger account line item was part of."
          },
          "account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "Simplified Ledger Account object containing this line item."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the financial transaction associated with the line item."
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection",
            "description": "Direction of line item."
          },
          "entry_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of the financial transaction associated with the line item."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when ledger entry was added to the ledger account."
          }
        }
      },
      "CreatePayoutParams": {
        "type": "object",
        "required": [
          "external_id",
          "paid_out_amount",
          "fee",
          "completed_at",
          "payments"
        ],
        "properties": {
          "external_id": {
            "type": "string",
            "description": "Unique ID of the payout in your system for linking purposes.",
            "example": "payout-1234"
          },
          "paid_out_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of the payout, in cents. This amount can be negative if refunds and fees exceed payments."
          },
          "fee": {
            "type": "integer",
            "format": "int64",
            "description": "The platform fee associated with the payout. Should be expressed as a positive value."
          },
          "additional_refunds_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of additional refunds associated with the payout, in cents. This should only be used when refunds cannot be individually itemized in the `refunds` array. Should be expressed as a positive value.",
            "default": 0
          },
          "processor": {
            "$ref": "#/components/schemas/PaymentProcessor",
            "nullable": true,
            "description": "Processor used to make the payment. If not null, every payment or refund associated with the payout must have the same processor.",
            "example": "STRIPE"
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "Identifier for the ledger account where the payout deposits. If not specified, the payout deposits to Undeposited Funds."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the payout was completed."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PayoutPaymentInput"
            },
            "description": "List of invoice payments to associate with the payout. Can refer to existing payments by ID or external ID. Alternatively, you can create new payments by specifying the payment amount and payment external ID."
          },
          "refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PayoutRefundInput"
            },
            "description": "List of refund payments to associate with the payout. Can refer to existing payments by ID or external ID, or by their refund's ID or external ID (so long as said refund has exactly one payment). Alternatively, you can create new refund payments by specifying the refund amount and refund external ID.",
            "default": []
          },
          "loan_payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomerPayoutLoanPaymentParams"
            },
            "nullable": true,
            "description": "List of loan payments to associate with the payout, referenced by ID or external ID. If you provide both identifiers they must refer to the same payment, and each payment may be referenced at most once per payout. Optional; omit to create the payout with no loan payments."
          },
          "loan_proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomerPayoutLoanProceedParams"
            },
            "nullable": true,
            "description": "List of loan proceeds to associate with the payout, referenced by ID or external ID. Use this for financing disbursements that arrive in a payout. Counted as money in, so the payout total must account for them. Optional; omit to create the payout with no loan proceeds."
          },
          "other_transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OtherPayoutTransactionInput"
            },
            "description": "A list of other transactions associated with the payout."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the payout (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the payout. Can be used to filter when listing payouts."
          }
        }
      },
      "PayoutPaymentInput": {
        "type": "object",
        "oneOf": [
          {
            "$ref": "#/components/schemas/ReferencingCustomerPayoutPaymentInput",
            "title": "Reference existing payment"
          },
          {
            "$ref": "#/components/schemas/ExplicitCustomerPayoutPaymentInput",
            "title": "Create new payment and invoice"
          }
        ]
      },
      "ExplicitCustomerPayoutPaymentInput": {
        "type": "object",
        "properties": {
          "invoice_payment_external_id": {
            "type": "string",
            "description": "External ID of the invoice payment to associate with the payout.",
            "example": "payment-31415"
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the payout payment, in cents. This amount must be a positive value and greater than the `total_fees`. Use refunds if money is moving back to the customer instead of from the customer."
          },
          "fees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentFeeInput"
            },
            "description": "List of fees associated with this payment. These fees will be the ledger source of truth for any payments that aren't explicitly created with the invoice payments api with a matching `external_id`. If specified, fee totals must equal the total fees on any invoice with a matching payment `external_id`. If fees are specified on a payment `external_id` on both the payout and through the payment API, the payment object takes precedence.",
            "nullable": true
          },
          "payment_paid_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the original payment was completed.",
            "nullable": true
          }
        }
      },
      "ReferencingCustomerPayoutPaymentInput": {
        "type": "object",
        "properties": {
          "invoice_payment_id": {
            "type": "string",
            "description": "ID of the invoice payment to reference for the payout details. Either this or `invoice_payment_external_id` must be specified.",
            "example": "efc07679-58fb-4509-9b69-05559f29b669"
          },
          "invoice_payment_external_id": {
            "type": "string",
            "description": "External ID of the invoice payment to reference for the payout details. Either this or `invoice_payment_id` must be specified.",
            "example": "payment-31415"
          }
        }
      },
      "OtherPayoutTransactionInput": {
        "type": "object",
        "required": [
          "amount",
          "direction",
          "account",
          "description"
        ],
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the transaction, in cents. This amount must be a positive value."
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection",
            "description": "Direction of the transaction."
          },
          "account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Account identifier for the transaction."
          },
          "description": {
            "type": "string",
            "description": "Description of the transaction."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the transaction in your system for linking purposes. **Idempotency key**."
          }
        }
      },
      "ApiPayout": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Payout`.",
            "example": "Payout"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique ID for the Payout. **Idempotency key.**."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the payout in your system for linking purposes.",
            "example": "payout-1234"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the Business that generated the payout."
          },
          "paid_out_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of the payout, in cents."
          },
          "fee": {
            "type": "integer",
            "format": "int64",
            "description": "The platform fee associated with the payout."
          },
          "processor": {
            "$ref": "#/components/schemas/PaymentProcessor",
            "nullable": true,
            "description": "Processor used to make the payment, if any. If not null, every payment or refund associated with the payout must have the same processor.",
            "example": "STRIPE"
          },
          "payment_clearing_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "nullable": true,
            "description": "The ledger account where the payout deposits. If not specified during creation, this is `null` and the payout deposits to Undeposited Funds."
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the payout was imported."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the payout was completed."
          },
          "match": {
            "$ref": "#/components/schemas/ApiMatch",
            "description": "The transaction match associated with the payout.",
            "example": {
              "id": "6b0a3734-f4ef-4fb0-9fc1-3f59b0c1cf99",
              "match_type": "PAYOUT",
              "bank_transaction": {
                "type": "Bank_Transaction_Data",
                "id": "a703c8d6-cfe8-453d-a275-b92eacc6fc6e",
                "business_id": "738ec216-e8e5-48f2-b7f2-cdc89c96b3d4",
                "source": "STRIPE",
                "source_transaction_id": "trxn_1sdOeLQiFAKE2LQBkcvrJw95f",
                "source_account_id": "738ec216-e154-48f2-1111-cdc89c96b3d4",
                "imported_at": "2024-03-19T22:09:53.290591Z",
                "date": "2024-03-06T06:06:40Z",
                "direction": "CREDIT",
                "amount": 87459,
                "counterparty_name": null,
                "description": "Payout (po_1OqnTHISISFAKEiTVBkCiyAERwm).",
                "account_name": "Layer Banking",
                "categorization_status": "MATCHED"
              },
              "details": {
                "type": "Payout_Match",
                "id": "d224508b-b05e-41da-89de-0fbd8a573507",
                "amount": 87459,
                "date": "2024-03-06T00:00:00Z",
                "description": "Payout from STRIPE.",
                "adjustment": null
              }
            }
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiInvoicePayment"
            },
            "description": "A list of invoice payments associated with the payout."
          },
          "refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiRefund"
            },
            "description": "A list of refunds associated with the payout."
          },
          "loan_payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiLoanPayment"
            },
            "description": "A list of [loan payments](/api-reference/loan/loan#loan-payment-object) associated with the payout."
          },
          "loan_proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiLoanProceed"
            },
            "description": "A list of [loan proceeds](/api-reference/loan/loan#loan-proceed-object) associated with the payout."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "A list of tags associated with the payout."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the payout (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the payout. Can be used to filter when listing payouts."
          }
        }
      },
      "UpdatePayoutParams": {
        "type": "object",
        "properties": {
          "paid_out_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of the payout, in cents."
          },
          "fee": {
            "type": "integer",
            "format": "int64",
            "description": "The platform fee associated with the payout. Express as a positive amount."
          },
          "additional_refunds_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of additional refunds associated with the payout, in cents. Express in positive amounts."
          },
          "processor": {
            "$ref": "#/components/schemas/PaymentProcessor",
            "description": "Processor used to make the payment, if any. Any processor name can be provided and will be tracked.",
            "example": "STRIPE"
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "Identifier for the ledger account where the payout deposits. If not specified, the payout deposits to Undeposited Funds."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the payout was completed."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PayoutPaymentInput"
            },
            "description": "List of invoice payments to associate with the payout. Can refer to existing payments by ID or external ID. Alternatively, you can create new payments by specifying the payment amount and payment external ID."
          },
          "refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PayoutRefundInput"
            },
            "description": "List of refund payments to associate with the payout. Can refer to existing payments by ID or external ID, or by their refund's ID or external ID (so long as said refund has exactly one payment). Alternatively, you can create new refund payments by specifying the refund amount and refund external ID."
          },
          "loan_payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomerPayoutLoanPaymentParams"
            },
            "nullable": true,
            "description": "List of loan payments to associate with the payout, referenced by ID or external ID. If you provide both identifiers they must refer to the same payment, and each payment may be referenced at most once per payout. Omit the field (or send `null`) to leave the payout's currently attached loan payments unchanged; send an empty list to detach them all."
          },
          "loan_proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomerPayoutLoanProceedParams"
            },
            "nullable": true,
            "description": "List of loan proceeds to associate with the payout, referenced by ID or external ID. Use this for financing disbursements that arrive in a payout. Counted as money in, so the payout total must account for them. Omit the field (or send `null`) to leave the payout's currently attached loan proceeds unchanged; send an empty list to detach them all."
          },
          "other_transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OtherPayoutTransactionInput"
            },
            "description": "A list of other transactions associated with the payout."
          },
          "overwrite_payment_fees": {
            "type": "boolean",
            "description": "Whether or not to overwrite the fees on the payments associated with the payout. If false, the fees on the payments will be preserved. If true, the fees on the payments will be overwritten with the fees provided in the payments array."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "A list of tags associated with the payout."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the payout (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the payout. Can be used to filter when listing payouts."
          }
        }
      },
      "UpdateTransactionDateRangeParams": {
        "type": "object",
        "description": "Parameters for updating the visible transaction date range on an external account.",
        "properties": {
          "show_transactions_on_or_after": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "If set, only transactions on or after this timestamp will be visible. Set to `null` to remove the lower bound and show all transactions regardless of how old they are."
          },
          "show_transactions_on_or_before": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "If set, only transactions on or before this timestamp will be visible. Set to `null` to remove the upper bound and show all transactions regardless of date."
          }
        }
      },
      "ApiPayoutWithoutTransactions": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique ID for the Payout. **Idempotency key.**."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the payout in your system for linking purposes.",
            "example": "payout-1234"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the Business that generated the payout."
          },
          "paid_out_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of the payout, in cents."
          },
          "fee": {
            "type": "integer",
            "format": "int64",
            "description": "The platform fee associated with the payout."
          },
          "processor": {
            "$ref": "#/components/schemas/PaymentProcessor",
            "description": "Processor used to make the payment, if any. Any processor name can be provided and will be tracked.",
            "example": "STRIPE"
          },
          "payment_clearing_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "nullable": true,
            "description": "The ledger account where the payout deposits. If not specified during creation, this is `null` and the payout deposits to Undeposited Funds."
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the payout was imported."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the payout was completed."
          },
          "match": {
            "$ref": "#/components/schemas/ApiMatch",
            "description": "The transaction match associated with the payout.",
            "example": {
              "id": "6b0a3734-f4ef-4fb0-9fc1-3f59b0c1cf99",
              "match_type": "PAYOUT",
              "bank_transaction": {
                "type": "Bank_Transaction_Data",
                "id": "a703c8d6-cfe8-453d-a275-b92eacc6fc6e",
                "business_id": "738ec216-e8e5-48f2-b7f2-cdc89c96b3d4",
                "source": "STRIPE",
                "source_transaction_id": "trxn_1sdOeLQiFAKE2LQBkcvrJw95f",
                "source_account_id": "738ec216-e154-48f2-1111-cdc89c96b3d4",
                "imported_at": "2024-03-19T22:09:53.290591Z",
                "date": "2024-03-06T06:06:40Z",
                "direction": "CREDIT",
                "amount": 87459,
                "counterparty_name": null,
                "description": "Payout (po_1OqnTHISISFAKEiTVBkCiyAERwm).",
                "account_name": "Layer Banking",
                "categorization_status": "MATCHED"
              },
              "details": {
                "type": "Payout_Match",
                "id": "d224508b-b05e-41da-89de-0fbd8a573507",
                "amount": 87459,
                "date": "2024-03-06T00:00:00Z",
                "description": "Payout from STRIPE.",
                "adjustment": null
              }
            }
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "A list of tags associated with the payout."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the payout (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the payout. Can be used to filter when listing payouts."
          }
        }
      },
      "ApiExternalAccounts": {
        "type": "object",
        "properties": {
          "external_accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiExternalAccount"
            }
          }
        }
      },
      "ApiLedger": {
        "type": "object",
        "properties": {
          "accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NestedApiLedgerAccount"
            }
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiLedgerEntry"
            }
          }
        }
      },
      "PlaidConfigurationInput": {
        "type": "object",
        "properties": {
          "client_id": {
            "type": "string"
          },
          "secret": {
            "type": "string"
          },
          "plaid_env_url_override": {
            "type": "string",
            "enum": [
              "SANDBOX",
              "PRODUCTION"
            ],
            "nullable": true,
            "description": "The Plaid environment to use. If not specified, the default environment is used.",
            "example": "SANDBOX"
          }
        }
      },
      "CreateRetainedEarningsClosingAction": {
        "type": "object",
        "description": "Provide exactly one of year or effective_date.",
        "oneOf": [
          { "required": ["year"] },
          { "required": ["effective_date"] }
        ],
        "example": { "year": 2024, "memo": "Close 2024 earnings" },
        "properties": {
          "year": {
            "type": "integer",
            "description": "Year for the annual retained earnings close."
          },
          "effective_date": {
            "type": "string",
            "format": "date",
            "description": "Specific date in YYYY-MM-DD format. Use instead of year."
          },
          "memo": { "type": "string", "nullable": true },
          "metadata": { "$ref": "#/components/schemas/PlatformDefinedJson" },
          "reference_number": { "type": "string", "nullable": true },
          "ledger_activity_start_timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "Optional start of ledger activity to include. Defaults to the business activation timestamp."
          },
          "retained_earnings_target_account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Account to receive net income. Defaults to the retained earnings account."
          },
          "override_default_tagging_strategy": {
            "type": "array",
            "description": "Tag set to close instead of the business default. Omitting this field uses the default strategy, which may create separate closing actions per entity.",
            "items": { "$ref": "#/components/schemas/TagKeyValue" }
          }
        }
      },
      "ApiRetainedEarningsClosingAction": {
        "type": "object",
        "properties": {
          "type": { "type": "string", "example": "Api_Retained_Earnings_Closing_Action" },
          "id": { "type": "string", "format": "uuid" },
          "business_id": { "type": "string", "format": "uuid" },
          "ledger_id": { "type": "string", "format": "uuid" },
          "closing_date": { "type": "string", "format": "date" },
          "memo": { "type": "string", "nullable": true },
          "metadata": { "$ref": "#/components/schemas/PlatformDefinedJson" },
          "reference_number": { "type": "string", "nullable": true },
          "ledger_activity_start_timestamp": { "type": "string", "format": "date-time", "nullable": true },
          "retained_earnings_target_account": { "$ref": "#/components/schemas/AccountIdentifier" },
          "transaction_tags": { "type": "array", "items": { "$ref": "#/components/schemas/ApiTag" } },
          "created_at": { "type": "string", "format": "date-time" },
          "updated_at": { "type": "string", "format": "date-time", "nullable": true },
          "archived_at": { "type": "string", "format": "date-time", "nullable": true }
        },
        "required": ["id", "business_id", "ledger_id", "closing_date", "created_at"]
      },
      "ApiLedgerEntry": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Ledger_Entry`.",
            "example": "Ledger_Entry"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the journal entry."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the business associated with this journal entry."
          },
          "ledger_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the general ledger containing this journal entry."
          },
          "agent": {
            "$ref": "#/components/schemas/ClassifierAgent",
            "description": "Entity that created the journal entry."
          },
          "entry_type": {
            "$ref": "#/components/schemas/LedgerEntryType",
            "description": "Type of entry."
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Date the ledger entry was recorded at."
          },
          "entry_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of the financial transaction associated with the line item."
          },
          "reversal_of_id": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "ID of the ledger entry this is a reversal of."
          },
          "reversal_id": {
            "type": "string",
            "nullable": true,
            "format": "uuid",
            "description": "ID of the reversal object associated with this entry."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiLineItem"
            },
            "description": "List of child line items associated with this entry."
          }
        }
      },
      "NestedApiChartAccount": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "ID of the account."
          },
          "name": {
            "type": "string",
            "description": "Name of the account.",
            "example": "Rent"
          },
          "stable_name": {
            "$ref": "#/components/schemas/AccountStableName",
            "description": "Stable name associated with the account."
          },
          "normality": {
            "$ref": "#/components/schemas/BankTransactionDirection",
            "description": "Normality of the account."
          },
          "account_type": {
            "$ref": "#/components/schemas/ApiLedgerAccountType",
            "description": "Type of the account."
          },
          "account_subtype": {
            "$ref": "#/components/schemas/ApiLedgerAccountSubtype",
            "description": "Subtype of the account."
          },
          "sub_accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NestedApiChartAccount"
            }
          }
        }
      },
      "CreateLedgerEntryLineItem": {
        "type": "object",
        "properties": {
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "customer_id": {
            "description": "Layer customer ID to associate with the ledger entry. Customer IDs can be specified on the entry or on individual line items, but not both.",
            "type": "string",
            "format": "uuid"
          },
          "customer_external_id": {
            "description": "External ID of the Layer customer to associate with the ledger entry. Can be specified in place of the Layer customer ID. Customer IDs can be specified on the entry or on individual line items, but not both.",
            "type": "string"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          }
        }
      },
      "TagKeyValue": {
        "type": "object",
        "description": "A TagKeyValue holds key=value data related to a tag. This is used when creating or updating taggable entities (transactions, invoices, etc.).",
        "properties": {
          "key": {
            "type": "string",
            "description": "The tag dimension key (e.g., \"department\", \"project\", \"location\").",
            "example": "department"
          },
          "dimension_display_name": {
            "type": "string",
            "nullable": true,
            "description": "If the TagDimension doesn't exist, providing this value specifies the display name upon database insertion. Otherwise, it is left as null on the TagDimension.",
            "example": "Department"
          },
          "value": {
            "type": "string",
            "description": "The tag value (e.g., \"sales\", \"marketing\", \"engineering\").",
            "example": "sales"
          },
          "value_display_name": {
            "type": "string",
            "nullable": true,
            "description": "If the TagValueDefinition doesn't exist, providing this value specifies the display name upon database insertion. Otherwise, it is left as null on the TagValueDefinition.",
            "example": "Sales Department"
          }
        },
        "required": [
          "key",
          "value"
        ]
      },
      "TagStrictness": {
        "type": "string",
        "enum": [
          "BALANCING",
          "NON_BALANCING"
        ],
        "description": "Tag strictness level - BALANCING requires tags to be applied to whole journal entries that balance, NON_BALANCING has no such restriction and can therefore be applied to individual line items of entries, invoices, etc.",
        "example": "NON_BALANCING"
      },
      "ApiTagValueDefinition": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `TagValue`.",
            "example": "TagValue"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the tag value definition."
          },
          "key": {
            "type": "string",
            "description": "The tag dimension key."
          },
          "value": {
            "type": "string",
            "description": "The tag value."
          },
          "display_name": {
            "type": "string",
            "nullable": true,
            "description": "Optional display name for the tag value definition."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp when the tag value definition was archived."
          }
        },
        "required": [
          "id",
          "key",
          "value"
        ]
      },
      "ApiTagValueDefinitionCreateParams": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "description": "Label for the tag value definition. The value for each tag key-value pair."
          },
          "is_archived": {
            "type": "boolean",
            "description": "Whether the tag value definition should be archived."
          }
        },
        "required": [
          "value"
        ]
      },
      "ApiTagValueDefinitionUpdateParams": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Updated label for the tag value definition."
          },
          "display_name": {
            "type": "string",
            "nullable": true,
            "description": "Updated display name for the tag value definition."
          },
          "is_archived": {
            "type": "boolean",
            "description": "Whether the tag value definition should be archived."
          }
        },
        "description": "Parameters for updating a tag value definition. All fields are optional."
      },
      "ApiTagDimension": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the tag dimension."
          },
          "key": {
            "type": "string",
            "description": "The tag dimension key."
          },
          "strictness": {
            "$ref": "#/components/schemas/TagStrictness"
          },
          "display_name": {
            "type": "string",
            "nullable": true,
            "description": "Display name for the tag dimension."
          },
          "defined_values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTagValueDefinition"
            },
            "description": "Predefined values for this tag dimension."
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "user_visible": {
            "type": "boolean",
            "default": false,
            "description": "Whether Layer's embedded components show this dimension to end users."
          }
        },
        "required": [
          "id",
          "key",
          "strictness",
          "defined_values",
          "created_at",
          "updated_at",
          "user_visible"
        ]
      },
      "ApiTagDimensions": {
        "type": "object",
        "properties": {
          "dimensions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTagDimension"
            },
            "description": "List of tag dimensions."
          }
        },
        "required": [
          "dimensions"
        ]
      },
      "TagDimensionCreateParams": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The tag dimension key."
          },
          "display_name": {
            "type": "string",
            "nullable": true,
            "description": "Display name for the tag dimension. Layer shows this as the filter label and the column header when the dimension splits a report."
          },
          "strictness": {
            "$ref": "#/components/schemas/TagStrictness"
          },
          "user_visible": {
            "type": "boolean",
            "default": false,
            "description": "Whether Layer's embedded components show this dimension to end users. Set this to `true` for a dimension that users tag with and filter reports by. The default of `false` keeps the dimension available for tagging and API-level filtering, but hides it in the UI."
          },
          "values": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTagValueDefinitionCreateParams"
            },
            "description": "Predefined values for this tag dimension.",
            "default": []
          }
        },
        "required": [
          "key",
          "strictness"
        ]
      },
      "TagDimensionPatchParams": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The tag dimension key."
          },
          "display_name": {
            "type": "string",
            "nullable": true,
            "description": "Display name for the tag dimension. Layer shows this as the filter label and the column header when the dimension splits a report."
          },
          "strictness": {
            "$ref": "#/components/schemas/TagStrictness"
          },
          "user_visible": {
            "type": "boolean",
            "default": false,
            "description": "Whether Layer's embedded components show this dimension to end users. Set this to `true` for a dimension that users tag with and filter reports by. The default of `false` keeps the dimension available for tagging and API-level filtering, but hides it in the UI."
          }
        },
        "description": "Parameters for updating a tag dimension. All fields are optional."
      },
      "TagDimensionUpdateParams": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The tag dimension key."
          },
          "display_name": {
            "type": "string",
            "nullable": true,
            "description": "Display name for the tag dimension. Layer shows this as the filter label and the column header when the dimension splits a report."
          },
          "strictness": {
            "$ref": "#/components/schemas/TagStrictness"
          },
          "user_visible": {
            "type": "boolean",
            "default": false,
            "description": "Whether Layer's embedded components show this dimension to end users. Set this to `true` for a dimension that users tag with and filter reports by. The default of `false` keeps the dimension available for tagging and API-level filtering, but hides it in the UI."
          }
        },
        "required": [
          "key",
          "strictness"
        ]
      },
      "NewInvoiceLineItem": {
        "type": "object",
        "properties": {
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Account identifier for the line item. If specified, the line item is attributed to that specific account. If omitted, Layer maps the product name to an account using the business or industry accounting configuration."
          },
          "prepayment_account_identifier": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "Ledger account for the line item used for accrual reporting. Should only be specified when this line item is a pre-payment."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the invoice line item in your system."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description for the new invoice line item.",
            "example": "Line item description"
          },
          "product": {
            "type": "string",
            "description": "Name of the product the line item is for.",
            "example": "Widgets"
          },
          "unit_price": {
            "type": "integer",
            "format": "int64"
          },
          "quantity": {
            "type": "number",
            "format": "bigdecimal",
            "nullable": true
          },
          "discount_amount": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          },
          "sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateTaxLineItem"
            },
            "nullable": true,
            "description": "Sales tax obligations for this line item."
          },
          "dedicated_refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateDedicatedRefundParams"
            },
            "description": "Dedicated refunds to associate with this invoice line item."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "List of tags to associate with the invoice line item."
          },
          "time_entry_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "UUID of a time entry to link to this invoice line item. The time entry is automatically unlinked when the line item is deleted or updated to remove it."
          }
        }
      },
      "CreateImmediatePaymentInput": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID for the payment within your platform. **Idempotency key**.",
            "example": "12345"
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "Method used to make the payment."
          },
          "fee": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Fee associated with processing a payment, e.g. credit card processing fees, in cents."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Value of the payment, in cents. If omitted, Layer assumes the payment amount is the full remaining invoice total."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Processor used to make the payment, if any. Any processor name can be provided and will be tracked.",
            "example": "STRIPE"
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The the ledger account to use for the payment (overrides the default determined by the payment method)."
          },
          "dedicated_refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateDedicatedRefundParams"
            },
            "description": "Dedicated refunds to associate with this invoice payment."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the invoice payment (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the invoice payment. Can be used to filter when listing invoice payments."
          }
        }
      },
      "ApiInvoiceTaxLineItem": {
        "type": "object",
        "properties": {
          "tax_account": {
            "$ref": "#/components/schemas/TaxAccountIdentifier",
            "description": "Tax account name or identifier. If not set, account defaults to top level sales tax payable liability account."
          },
          "tax_ledger_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "Ledger account for the tax line item.",
            "example": {
              "id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
              "name": "Sales tax: CALIFORNIA",
              "stable_name": "SALES_TAXES_PAYABLE:CALIFORNIA",
              "normality": "CREDIT",
              "account_type": {
                "value": "LIABILITY",
                "display_name": "Liabilities"
              },
              "account_subtype": {
                "value": "SALES_TAXES_PAYABLE",
                "display_name": "Sales Taxes Payable"
              }
            }
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount, in cents, of tax owed."
          }
        }
      },
      "ApiBillTaxLineItem": {
        "type": "object",
        "properties": {
          "tax_account": {
            "$ref": "#/components/schemas/TaxAccountIdentifier",
            "description": "Tax account name or identifier. If not set, account defaults to the top level sales tax expense account."
          },
          "tax_ledger_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "Ledger account for the tax line item.",
            "example": {
              "id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
              "name": "Sales tax: CALIFORNIA",
              "stable_name": "SALES_TAXES:CALIFORNIA",
              "normality": "CREDIT",
              "account_type": {
                "value": "EXPENSE",
                "display_name": "Expenses"
              },
              "account_subtype": {
                "value": "SALES_TAXES",
                "display_name": "Sales Taxes"
              }
            }
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount, in cents, of tax owed."
          }
        }
      },
      "NewBusinessUnitAccountId": {
        "type": "object",
        "properties": {
          "unit_id": {
            "type": "string"
          },
          "account_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the Unit account.",
            "example": "My Unit account"
          },
          "opening_balance_init_to_zero": {
            "type": "boolean"
          },
          "opening_balance_do_not_init": {
            "type": "boolean"
          }
        }
      },
      "StripeConnectAccountInput": {
        "type": "object",
        "properties": {
          "stripe_id": {
            "type": "string"
          }
        }
      },
      "ApiBankTransactionInterface": {
        "type": "object",
        "required": [
          "id",
          "amount",
          "date"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer's UUID for the bank transaction."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the business the transaction is for."
          },
          "source": {
            "$ref": "#/components/schemas/TransactionSource",
            "description": "Source of the bank transaction."
          },
          "source_transaction_id": {
            "type": "string",
            "description": "External transaction ID from the source platform (e.g, Plaid transaction ID).",
            "example": "g4DlKyjXqGH3Kp5XlaWMtwLRrE4Z9AiE8B4Ko"
          },
          "source_account_id": {
            "type": "string",
            "description": "External account ID from the source platform (e.g, Plaid account ID).",
            "example": "Aaoy8G7VXZHVeqNoL1GvcmkPdqpLRWi9NArdG"
          },
          "external_account_id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer's internal UUID for the linked external account. This is distinct from source_account_id, which is the provider's identifier (e.g., Plaid or Stripe account ID)."
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the transaction was imported."
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the transaction was created."
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection",
            "description": "Direction of the transaction."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the transaction, in cents."
          },
          "counterparty_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the transaction counterparty.",
            "example": "WeWork"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description of the transaction.",
            "example": "WeWork monthly rent payment"
          },
          "account_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the bank account.",
            "example": "Plaid Checking"
          },
          "categorizationStatus": {
            "$ref": "#/components/schemas/CategorizationStatus",
            "description": "The status of the transaction\u2019s categorization in Layer\u2019s systems."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the bank transaction (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bank transaction. Can be used to filter when listing bank transactions."
          }
        }
      },
      "ApiMatchDetails": {
        "type": "object",
        "required": [
          "id",
          "amount",
          "date"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer's ID for the match."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Monetary amount of the matched transaction, in cents."
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Date that the matched transaction occurred."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description of the match.",
            "example": "Transfer from SavingsAccount to CheckingAccount"
          }
        }
      },
      "WriteOffMode": {
        "type": "string",
        "enum": [
          "EXPENSE",
          "REVENUE_REVERSAL"
        ],
        "description": "Mode for writing off an invoice. EXPENSE writes off revenue as expense, REVENUE_REVERSAL reduces recorded revenue proportionally.",
        "example": "EXPENSE"
      },
      "ApiInvoicePaymentAllocationWithPayment": {
        "type": "object",
        "properties": {
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the invoice."
          },
          "payment_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the payment."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the payment allocated towards this invoice."
          },
          "payment": {
            "$ref": "#/components/schemas/ApiInvoicePayment",
            "description": "The full payment details."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags associated with the allocation."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the invoice payment allocation (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the invoice payment allocation."
          }
        }
      },
      "InvoiceCreationResponse": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "MatchedNoChanges"
                ]
              },
              "invoice": {
                "$ref": "#/components/schemas/ApiInvoice"
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "DoesNotMatchExisting"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "Success"
                ]
              },
              "invoice": {
                "$ref": "#/components/schemas/ApiInvoice"
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "MatchedUpdated"
                ]
              },
              "updatedInvoice": {
                "$ref": "#/components/schemas/ApiInvoice"
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "DuplicateLineItemExternalIds"
                ]
              },
              "duplicatedExternalIds": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "LedgerAccountIdNotFound"
                ]
              },
              "accountId": {
                "type": "string"
              },
              "errorMessage": {
                "type": "string",
                "nullable": true
              }
            }
          }
        ]
      },
      "InvoicePaymentCreationResponse": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "AlreadyExists"
                ]
              },
              "payment": {
                "$ref": "#/components/schemas/ApiInvoicePayment"
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "DoesNotMatchExisting"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "Success"
                ]
              },
              "payment": {
                "$ref": "#/components/schemas/ApiInvoicePayment"
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "UpdatedExisting"
                ]
              },
              "updated": {
                "$ref": "#/components/schemas/ApiInvoicePayment"
              }
            }
          }
        ]
      },
      "VoidResult": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "AlreadyVoided"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "Success"
                ]
              },
              "voidedInvoice": {
                "$ref": "#/components/schemas/ApiInvoice"
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "PaymentsMade"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "WriteOffsMade"
                ]
              }
            }
          }
        ]
      },
      "InvoiceDeletionResult": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "Success"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "ValidPaymentsStillExist"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "AlreadyDeleted"
                ]
              }
            }
          }
        ]
      },
      "WriteOffCreationResult": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "AmountExceedsOutstandingBalance"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "DestinationAccountNotExpenseOrContraRevenue"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "DestinationAccountNotFound"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "NoAccountsReceivableAccount"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "NoBadDebtAccount"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "NoOutstandingBalance"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "WriteOffAmountNotPositive"
                ]
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "Success"
                ]
              },
              "writeOff": {
                "$ref": "#/components/schemas/ApiInvoiceWriteOff"
              }
            }
          }
        ]
      },
      "InvoiceStatus": {
        "type": "string",
        "enum": [
          "SENT",
          "PARTIALLY_PAID",
          "PAID",
          "VOIDED",
          "PARTIALLY_WRITTEN_OFF",
          "WRITTEN_OFF",
          "REFUNDED"
        ],
        "example": "SENT"
      },
      "ARAgingReport": {
        "type": "object",
        "description": "AR Aging report showing outstanding invoices grouped by customer and aging buckets.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "AR_Aging_Report"
            ],
            "description": "Type identifier for this response."
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Start date of the report period."
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "End date of the report period."
          },
          "basis": {
            "$ref": "#/components/schemas/ReportingBasis",
            "description": "Accounting basis used for the report."
          },
          "as_of_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The effective date used to calculate aging buckets."
          },
          "customers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerARSummary"
            },
            "description": "List of customers with their AR aging details."
          },
          "totals": {
            "$ref": "#/components/schemas/ARAgingTotals",
            "description": "Total amounts across all customers and aging buckets."
          }
        }
      },
      "CustomerARSummary": {
        "type": "object",
        "description": "AR aging summary for a specific customer.",
        "properties": {
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the customer."
          },
          "customer_name": {
            "type": "string",
            "description": "Name of the customer."
          },
          "current": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ARAgingInvoice"
            },
            "description": "Invoices that are not yet past due."
          },
          "buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ARAgingBucket"
            },
            "description": "Aging buckets containing past due invoices."
          },
          "total_outstanding_balance": {
            "type": "integer",
            "format": "int64",
            "description": "Total outstanding balance for this customer in cents."
          }
        }
      },
      "ARAgingBucket": {
        "type": "object",
        "description": "An aging bucket containing invoices within a specific days-past-due range.",
        "properties": {
          "bucket_start_day": {
            "type": "integer",
            "nullable": true,
            "description": "Start day of the aging bucket (e.g., 1 for 1-30 days). Null for current/not-yet-due invoices."
          },
          "bucket_end_day": {
            "type": "integer",
            "nullable": true,
            "description": "End day of the aging bucket (e.g., 30 for 1-30 days). Null for open-ended buckets (e.g., 90+ days)."
          },
          "invoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ARAgingInvoice"
            },
            "description": "Invoices within this aging bucket."
          }
        }
      },
      "ARAgingInvoice": {
        "type": "object",
        "description": "Invoice details within an AR aging context.",
        "properties": {
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the invoice."
          },
          "customer_name": {
            "type": "string",
            "description": "Name of the customer associated with this invoice."
          },
          "due_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Due date of the invoice."
          },
          "invoice_total": {
            "type": "integer",
            "format": "int64",
            "description": "Total amount of the invoice in cents."
          },
          "outstanding_balance": {
            "type": "integer",
            "format": "int64",
            "description": "Remaining unpaid balance on the invoice in cents."
          }
        }
      },
      "ARAgingTotals": {
        "type": "object",
        "description": "Total amounts across all aging buckets.",
        "properties": {
          "current_total": {
            "type": "integer",
            "format": "int64",
            "description": "Total amount of invoices that are not yet past due in cents."
          },
          "bucket_totals": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ARAgingBucketTotal"
            },
            "description": "Totals for each aging bucket."
          },
          "grand_total": {
            "type": "integer",
            "format": "int64",
            "description": "Total outstanding balance across all invoices in cents."
          }
        }
      },
      "ARAgingBucketTotal": {
        "type": "object",
        "description": "Total for a specific aging bucket.",
        "properties": {
          "bucket_start_day": {
            "type": "integer",
            "nullable": true,
            "description": "Start day of the aging bucket."
          },
          "bucket_end_day": {
            "type": "integer",
            "nullable": true,
            "description": "End day of the aging bucket."
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "Total outstanding balance for this bucket in cents."
          }
        }
      },
      "ARAgingCustomerDetailResponse": {
        "type": "object",
        "description": "Detailed AR aging information for a specific customer.",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "AR_Aging_Customer_Detail"
            ],
            "description": "Type identifier for this response."
          },
          "as_of_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The effective date used to calculate aging buckets."
          },
          "customer": {
            "$ref": "#/components/schemas/ApiCustomerData",
            "description": "The customer details."
          },
          "buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ARAgingCustomerDetailBucket"
            },
            "description": "Detailed breakdown of outstanding balances by aging bucket."
          },
          "current": {
            "type": "integer",
            "format": "int64",
            "description": "Total outstanding balance for invoices not yet past due in cents."
          },
          "days_1_30": {
            "type": "integer",
            "format": "int64",
            "description": "Total outstanding balance for invoices 1-30 days past due in cents."
          },
          "days_31_60": {
            "type": "integer",
            "format": "int64",
            "description": "Total outstanding balance for invoices 31-60 days past due in cents."
          },
          "days_61_90": {
            "type": "integer",
            "format": "int64",
            "description": "Total outstanding balance for invoices 61-90 days past due in cents."
          },
          "days_91_over": {
            "type": "integer",
            "format": "int64",
            "description": "Total outstanding balance for invoices 91+ days past due in cents."
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "Total outstanding balance across all aging buckets in cents."
          }
        }
      },
      "ARAgingCustomerDetailBucket": {
        "type": "object",
        "description": "A bucket containing outstanding balance for a specific aging period.",
        "properties": {
          "start_day_number": {
            "type": "integer",
            "nullable": true,
            "description": "Start day of the aging bucket (e.g., 1 for 1-30 days). Null for current/not-yet-due invoices."
          },
          "end_day_number": {
            "type": "integer",
            "nullable": true,
            "description": "End day of the aging bucket (e.g., 30 for 1-30 days). Null for open-ended buckets (e.g., 91+ days)."
          },
          "outstanding_value": {
            "type": "integer",
            "format": "int64",
            "description": "Outstanding balance for this aging bucket in cents."
          }
        }
      },
      "ApiInvoiceLineItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the invoice line item."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the invoice line item in your system."
          },
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the parent invoice."
          },
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Identifier for the account."
          },
          "ledger_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "Ledger account for the line item."
          },
          "prepayment_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "Ledger account for the line item used for accrual reporting. Should only be specified when this line item is a pre-payment."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description for the invoice line item.",
            "example": "Widget sale"
          },
          "product": {
            "type": "string",
            "description": "Name of the product the invoice line item is for.",
            "example": "Widget"
          },
          "unit_price": {
            "$ref": "#/components/schemas/SignedAmount",
            "description": "The amount in cents of each unit."
          },
          "quantity": {
            "type": "number",
            "format": "bigdecimal",
            "description": "Number of units sold."
          },
          "subtotal": {
            "type": "integer",
            "format": "int64",
            "description": "Subtotal for the invoice line item in cents."
          },
          "discount_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Total discount given to this line item, in cents."
          },
          "sales_taxes_total": {
            "type": "integer",
            "format": "int64",
            "description": "Sum of amounts for all sales taxes for the line item."
          },
          "sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiInvoiceTaxLineItem"
            },
            "description": "List of sales taxes line items.",
            "nullable": true
          },
          "total_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Total amount on the line item."
          },
          "refund_allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiRefundAllocation"
            },
            "description": "Refund allocations associated with this invoice line item.",
            "example": []
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "List of tags on the transaction associated with the invoice line item."
          }
        }
      },
      "ApiInvoicePaymentAllocation": {
        "type": "object",
        "properties": {
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the invoice."
          },
          "payment_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the payment."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the payment allocated towards this invoice. If this amount is the full payment amount, this payment was fully allocated towards this invoice. The amount cannot exceed the invoice total."
          },
          "amount_net_of_refunds": {
            "type": "integer",
            "format": "int64",
            "description": "Amount allocated after applying any refunds, in cents."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "List of tags on the transaction associated with the payment allocation."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the invoice payment allocation (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the invoice payment allocation."
          }
        }
      },
      "ApiInvoicePaymentAllocationToLedgerAccount": {
        "type": "object",
        "description": "Represents a portion of a payment allocated directly to a ledger account, rather than to a specific invoice. This is useful for recording payments that are not associated with a specific invoice, such as overpayments or deposits.",
        "properties": {
          "account_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the ledger account to which this payment is allocated."
          },
          "payment_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the payment this allocation applies from."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Customer payment amount, in cents."
          },
          "amount_net_of_refunds": {
            "type": "integer",
            "format": "int64",
            "description": "Amount allocated after applying any refunds, in cents."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Optional memo for the allocation."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "User-visible identifier for the allocation."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "List of tags on the transaction associated with the payment allocation."
          }
        }
      },
      "PaymentMethod": {
        "type": "string",
        "enum": [
          "CASH",
          "CHECK",
          "CREDIT_CARD",
          "ACH",
          "CREDIT_BALANCE",
          "OTHER"
        ],
        "example": "ACH"
      },
      "PaymentBalanceTransactionType": {
        "type": "string",
        "enum": [
          "charge",
          "payment",
          "refund",
          "payment_refund"
        ],
        "example": "payment"
      },
      "LayerApiSortOrder": {
        "type": "string",
        "enum": [
          "ASC",
          "ASCENDING",
          "DES",
          "DESC",
          "DESCENDING"
        ],
        "example": "ASC"
      },
      "ReportingBasis": {
        "type": "string",
        "enum": [
          "ACCRUAL",
          "CASH"
        ],
        "example": "CASH"
      },
      "CategoryListMode": {
        "type": "string",
        "enum": [
          "ALL_ACCOUNTS",
          "REVENUE_AND_EXPENSES"
        ],
        "example": "ALL_ACCOUNTS"
      },
      "BusinessLedgerProvider": {
        "type": "string",
        "enum": [
          "MODERN_TREASURY",
          "LOCAL",
          "SPLITS_ONLY"
        ],
        "example": "LOCAL"
      },
      "BusinessLedgerStatus": {
        "type": "string",
        "enum": [
          "CREATING",
          "ACTIVE",
          "CREATION_FAILED",
          "MIGRATING"
        ],
        "example": "ACTIVE"
      },
      "PnlTemplates": {
        "type": "string",
        "enum": [
          "DEFAULT",
          "TRUCKING",
          "MEDSPA",
          "MEDSPA_NO_LICENSING",
          "CITRUS",
          "CITRUS_NO_LICENSING",
          "FLORIST"
        ],
        "example": "DEFAULT"
      },
      "ClientStringName": {
        "type": "string",
        "enum": [
          "CAUGHT_UP_LINK_PROMPT",
          "CAUGHT_UP_ONBOARDING_LINK_PROMPT",
          "ONBOARDING_COMPLETE_NOT_CAUGHT_UP",
          "CATEGORIZE_IN_APP_PROMPT"
        ],
        "example": "CAUGHT_UP_LINK_PROMPT"
      },
      "FallbackChildHandling": {
        "type": "string",
        "enum": [
          "LINE_ITEM",
          "OTHER_BUCKET",
          "OMIT",
          "THROW_ERROR"
        ],
        "example": "LINE_ITEM"
      },
      "BusinessUpdatePayload": {
        "type": "object",
        "properties": {
          "legal_name": {
            "type": "string",
            "nullable": true
          },
          "us_state": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/USState"
              }
            ]
          },
          "country": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/Country"
              }
            ]
          },
          "entity_type": {
            "nullable": true,
            "allOf": [
              {
                "$ref": "#/components/schemas/BusinessType"
              }
            ]
          },
          "phone_number": {
            "type": "string",
            "nullable": true
          },
          "sms_enabled": {
            "type": "boolean",
            "nullable": true
          },
          "sms_categorization_start_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "activation_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The activation timestamp represents the time at which Layer should begin displaying accounting data. Data before this time will not be displayed to users. This field is important for businesses migrating over from other accounting platforms. Defaults to Jan 1 of the current year."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "unit_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewBusinessUnitAccountId"
            },
            "nullable": true
          },
          "internal_bank_account_ids": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewBusinessUnitAccountId"
            },
            "nullable": true
          },
          "plaid_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatePlaidItem"
            },
            "description": "List of plaid items to connect to this business. If the business already has plaid items associated with it, they will be removed and replaced with the items in this list.",
            "nullable": true
          },
          "plaid_processor_tokens": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatePlaidProcessorToken"
            },
            "description": "List of plaid processor tokens to connect to this business. If the business already has plaid processor tokens associated with it, they will be removed and replaced with the tokens in this list.",
            "nullable": true
          },
          "stripe_connect_accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/StripeConnectAccountInput"
            },
            "nullable": true
          },
          "free_trial_ends_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The date and time when the business's free trial ends."
          },
          "default_locale": {
            "type": "string",
            "enum": [
              "en-US",
              "fr-CA"
            ],
            "nullable": true,
            "description": "Default locale used to localize the business's content, such as SMS messages.",
            "example": "en-US"
          }
        }
      },
      "ApiExternalAccountInstitution": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "The name of the institution for the external account.",
            "example": "Bank of Generica"
          },
          "logo": {
            "type": "string",
            "nullable": true,
            "description": "The logo of the institution for the external account in base 64.",
            "example": "iVBORw0KGgoAAAANSUhEUgAAAJgAAACYCAMAAAAvHNATAAAAYFBMVEUAAAAAC1ETC"
          }
        }
      },
      "ApiSuggestedMatch": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer's identifier for the suggested match."
          },
          "matchType": {
            "$ref": "#/components/schemas/MatchType",
            "description": "Type of the matched object."
          },
          "details": {
            "$ref": "#/components/schemas/ApiMatchDetails",
            "description": "Details of the suggested match."
          }
        }
      },
      "CategorizationUX": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "nullable": true
          },
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategorizationOption"
            }
          }
        }
      },
      "CategorizationOption": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/CategorizationOption_MenuOption"
          },
          {
            "$ref": "#/components/schemas/CategorizationOption_CategorizeOption"
          },
          {
            "$ref": "#/components/schemas/CategorizationOption_SplitOption"
          },
          {
            "$ref": "#/components/schemas/CategorizationOption_FreeSelectOption"
          }
        ]
      },
      "CategorizationOption_MenuOption": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "display_string": {
            "type": "string"
          },
          "tooltip": {
            "type": "string",
            "nullable": true
          },
          "menu_options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CategorizationOption"
            }
          }
        }
      },
      "CategorizationOption_CategorizeOption": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "display_string": {
            "type": "string"
          },
          "tooltip": {
            "type": "string",
            "nullable": true
          },
          "account": {
            "$ref": "#/components/schemas/ApiCategorization"
          }
        }
      },
      "CategorizationOption_SplitOption": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "default": "SPLIT"
          },
          "display_string": {
            "type": "string",
            "default": "Split"
          },
          "tooltip": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "CategorizationOption_FreeSelectOption": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "default": "FREE_SELECT"
          },
          "display_string": {
            "type": "string",
            "default": "Something else"
          },
          "tooltip": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "ApiCategorizationFlow": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/InputStrategy"
          },
          "category": {
            "$ref": "#/components/schemas/ApiCategorization"
          },
          "suggestions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCategorization"
            },
            "nullable": true
          }
        }
      },
      "StripeConfigurationInput": {
        "type": "object",
        "properties": {
          "secret": {
            "type": "string",
            "description": "Secret to associate with the Stripe Connect account.",
            "example": "adspijzxvXZPIZfakeSecretAPSaspfkng"
          }
        }
      },
      "QuickbooksEnvironmentType": {
        "type": "string",
        "enum": [
          "PRODUCTION",
          "SANDBOX"
        ],
        "description": "Indicates which Quickbooks environment these credentials are intended for (production or sandbox).",
        "example": "SANDBOX"
      },
      "QuickbooksConfigurationInput": {
        "type": "object",
        "properties": {
          "client_id": {
            "type": "string",
            "description": "The client ID issued to your platform by Quickbooks.",
            "example": "ABCD1234FAKECLIENTID"
          },
          "secret": {
            "type": "string",
            "description": "The client secret associated with the provided Quickbooks client ID.",
            "example": "abcd1234FAKESECRET"
          },
          "environment": {
            "$ref": "#/components/schemas/QuickbooksEnvironmentType"
          },
          "redirect_url": {
            "type": "string",
            "format": "uri",
            "description": "The URL to which Quickbooks should redirect after authentication.",
            "example": "https://yourplatform.com/link-quickbooks"
          }
        }
      },
      "NewCustomAccountParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "Unique ID of the custom account in an external system for linking and idempotency.",
            "example": "ww9wwLgkrbU3jkg3J4J7ckBR3zKQV6sLPQevK"
          },
          "mask": {
            "type": "string",
            "description": "Last 4 digits of the custom account number.",
            "example": "4321"
          },
          "account_name": {
            "type": "string",
            "description": "Name of the custom account.",
            "example": "My custom account"
          },
          "institution_name": {
            "type": "string",
            "description": "Name of the institution for the custom account.",
            "example": "My custom account institution"
          },
          "account_type": {
            "type": "string",
            "enum": [
              "DEPOSITORY",
              "CREDIT",
              "LOAN"
            ],
            "nullable": true,
            "description": "The type of the custom account.",
            "example": "DEPOSITORY"
          },
          "account_subtype": {
            "type": "string",
            "enum": [
              "CHECKING",
              "SAVINGS",
              "CREDIT CARD",
              "LOAN"
            ],
            "nullable": true,
            "description": "The subtype of the custom account.",
            "example": "checking"
          }
        }
      },
      "CreateStandaloneInvoicePayment": {
        "type": "object",
        "required": [
          "paid_at",
          "method",
          "amount",
          "invoice_payments"
        ],
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External identifier for the payment, used for idempotency."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Layer ID of the customer to associate with the payment. Lets you tag a payment with a customer even before it is allocated to any invoice (for example, a standalone deposit). When the payment has invoice allocations, the customer must match the customer on every allocated invoice, otherwise the request is rejected with a 400."
          },
          "customer_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the customer to associate with the payment. Can be specified in place of `customer_id`."
          },
          "paid_at": {
            "type": "string",
            "format": "date-time",
            "description": "The timestamp when the payment was made."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "Payment method."
          },
          "fee": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Fee amount in cents."
          },
          "additional_fees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatePaymentFeeParams"
            },
            "description": "Additional fees associated with the payment."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Payment amount in cents."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Payment processor name."
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The ledger account to use for the payment (overrides the default determined by the payment method)."
          },
          "redemption_account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Account to use for credit balance redemptions. Only applicable when method is CREDIT_BALANCE."
          },
          "invoice_payments": {
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/CreateInvoicePaymentAllocation",
                  "description": "Allocates a portion of the payment to a specific invoice.",
                  "title": "Invoice Payment Allocation"
                },
                {
                  "$ref": "#/components/schemas/CreateInvoicePaymentAllocationToLedgerAccount",
                  "description": "Allocates a portion of the payment directly to a ledger account, rather than to an invoice.",
                  "title": "Ledger Account Allocation"
                }
              ]
            },
            "description": "Each element in this array is either an `InvoicePaymentAllocation` (allocating to an invoice) or an `InvoicePaymentAllocationToLedgerAccount` (allocating directly to a ledger account). The type is determined by the fields present: if `account` is provided, it is treated as a ledger account allocation; otherwise, it is treated as an invoice allocation."
          },
          "dedicated_refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateDedicatedRefundParams"
            },
            "description": "Dedicated refunds to associate with this invoice payment."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to apply to the payment."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the payment."
          },
          "metadata": {
            "type": "object",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the payment."
          }
        }
      },
      "CreateInvoicePaymentAllocation": {
        "type": "object",
        "properties": {
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer ID of the invoice to apply payment. Either the invoice_id or invoice_external_id must be provided."
          },
          "invoice_external_id": {
            "type": "string",
            "format": "uuid",
            "description": "External ID of the invoice payment. Either the invoice_id or invoice_external_id must be provided."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount paid towards this invoice in cents."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to apply to the allocation."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the invoice payment allocation (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the invoice payment allocation."
          }
        }
      },
      "CreatePaymentFeeParams": {
        "description": "Parameters for creating an additional fee on an invoice payment. The fee `type` is optional and defaults to `STANDARD`; use `LOAN_REPAYMENT` to record a loan repayment as part of the payment.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/StandardPaymentFeeParams"
          },
          {
            "$ref": "#/components/schemas/LoanRepaymentFeeParams"
          }
        ]
      },
      "CreateInvoicePaymentAllocationToLedgerAccount": {
        "type": "object",
        "description": "Input for allocating a portion of a payment directly to a ledger account, rather than to an invoice. This is useful for recording payments not associated with a specific invoice, such as overpayments or deposits.",
        "required": [
          "account",
          "amount"
        ],
        "properties": {
          "account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The [Account Identifier](/api-reference/ledger/account-identifier) of the ledger account to allocate to. The presence of this field distinguishes a ledger account allocation from an invoice allocation."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount to allocate to this ledger account, in cents."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to apply to the allocation."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Optional memo for the allocation."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "User-visible identifier for the allocation."
          }
        }
      },
      "ApiLedgerAccountLineItem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Ledger_Account_Line_Item`.",
            "example": "Ledger_Account_Line_Item"
          },
          "id": {
            "type": "string"
          },
          "entry_id": {
            "type": "string"
          },
          "account": {
            "$ref": "#/components/schemas/SingleApiChartAccount"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "source": {
            "$ref": "#/components/schemas/LedgerEntrySource"
          },
          "running_balance": {
            "type": "integer",
            "format": "int64"
          },
          "transaction": {
            "$ref": "#/components/schemas/ApiBankTransaction"
          },
          "invoice": {
            "$ref": "#/components/schemas/ApiInvoice"
          }
        }
      },
      "ApiDataSyncValidationReport": {
        "type": "object",
        "description": "Accounting totals for validating sales data synced over a period.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Data_Sync_Validation_Report`.",
            "example": "Data_Sync_Validation_Report"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "The business these totals belong to."
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "description": "The start of the validation period."
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "description": "The end of the validation period."
          },
          "totals": {
            "type": "array",
            "description": "Totals to compare with the source system. Monetary values are in cents.",
            "items": {
              "$ref": "#/components/schemas/ApiDataSyncValidationTotal"
            }
          }
        },
        "required": [
          "business_id",
          "start_date",
          "end_date",
          "totals"
        ]
      },
      "ApiDataSyncValidationTotal": {
        "type": "object",
        "description": "One total used to validate synced sales data.",
        "properties": {
          "field": {
            "$ref": "#/components/schemas/DataSyncValidationField"
          },
          "description": {
            "type": "string",
            "description": "How to calculate the corresponding total in the source system."
          },
          "value": {
            "type": "integer",
            "format": "int64",
            "description": "The total amount in cents."
          },
          "generated_by": {
            "$ref": "#/components/schemas/ApiDataSyncValidationGeneratedBy"
          }
        },
        "required": [
          "field",
          "description",
          "value",
          "generated_by"
        ]
      },
      "ApiDataSyncValidationGeneratedBy": {
        "type": "object",
        "description": "The accounting report and basis used to generate a validation total.",
        "properties": {
          "report": {
            "$ref": "#/components/schemas/DataSyncValidationSourceReport"
          },
          "reporting_basis": {
            "$ref": "#/components/schemas/ReportingBasis"
          }
        },
        "required": [
          "report",
          "reporting_basis"
        ]
      },
      "DataSyncValidationField": {
        "type": "string",
        "description": "The source-system total represented by this value.",
        "enum": [
          "TOTAL_SALES",
          "CUSTOMER_REFUNDS",
          "TIPS",
          "DISCOUNTS",
          "SALES_TAXES",
          "PAYMENT_PROCESSOR_FEES",
          "NET_REVENUE"
        ],
        "example": "TOTAL_SALES"
      },
      "DataSyncValidationSourceReport": {
        "type": "string",
        "description": "The Layer accounting report from which the total was generated.",
        "enum": [
          "PROFIT_AND_LOSS",
          "BALANCE_SHEET"
        ],
        "example": "PROFIT_AND_LOSS"
      },
      "ProfitAndLoss": {
        "type": "object",
        "properties": {
          "business_id": {
            "type": "string",
            "format": "uuid"
          },
          "start_date": {
            "type": "string",
            "format": "date-time"
          },
          "end_date": {
            "type": "string",
            "format": "date-time"
          },
          "income": {
            "$ref": "#/components/schemas/LineItem"
          },
          "cost_of_goods_sold": {
            "$ref": "#/components/schemas/LineItem"
          },
          "gross_profit": {
            "type": "integer",
            "format": "int64"
          },
          "expenses": {
            "$ref": "#/components/schemas/LineItem"
          },
          "profit_before_taxes": {
            "type": "integer",
            "format": "int64"
          },
          "taxes": {
            "$ref": "#/components/schemas/LineItem"
          },
          "net_profit": {
            "type": "integer",
            "format": "int64"
          },
          "other_outflows": {
            "$ref": "#/components/schemas/LineItem",
            "nullable": true
          },
          "personal_expenses": {
            "$ref": "#/components/schemas/LineItem"
          },
          "fully_categorized": {
            "type": "boolean"
          }
        }
      },
      "ApiMonthlyPnlSummaries": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Profit_And_Loss_Summaries`.",
            "example": "Profit_And_Loss_Summaries"
          },
          "monthly_pnl_summaries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MonthlyPnlSummary"
            }
          }
        }
      },
      "MonthlyPnlSummary": {
        "type": "object",
        "properties": {
          "year": {
            "type": "integer",
            "format": "int32",
            "description": "The year for the PnL summary.",
            "example": 2024
          },
          "month": {
            "type": "integer",
            "format": "int32",
            "description": "The month for the PnL summary.",
            "example": 3
          },
          "income": {
            "type": "integer",
            "format": "int64",
            "description": "The business's total income for the month, in cents.",
            "example": 1050000
          },
          "costOfGoodsSold": {
            "type": "integer",
            "format": "int64",
            "description": "The business's cost of goods sold for the month, in cents.",
            "example": 350000
          },
          "grossProfit": {
            "type": "integer",
            "format": "int64",
            "description": "The business's gross profit for the month, in cents.",
            "example": 700000
          },
          "operatingExpenses": {
            "type": "integer",
            "format": "int64",
            "description": "The business's operating expenses for the month, in cents.",
            "example": 300000
          },
          "profitBeforeTaxes": {
            "type": "integer",
            "format": "int64",
            "description": "The business's pre-tax profit for the month, in cents.",
            "example": 400000
          },
          "taxes": {
            "type": "integer",
            "format": "int64",
            "description": "The business's taxes for the month, in cents.",
            "example": 100000
          },
          "netProfit": {
            "type": "integer",
            "format": "int64",
            "description": "The business's net profit for the month, in cents.",
            "example": 300000
          },
          "totalExpenses": {
            "type": "integer",
            "format": "int64",
            "description": "The sum of the business's expenses for the month, in cents.",
            "example": 750000
          },
          "uncategorizedInflows": {
            "type": "integer",
            "format": "int64",
            "description": "The sum of the business's positive uncategorized transactions for the month, in cents.",
            "example": 10
          },
          "uncategorizedOutflows": {
            "type": "integer",
            "description": "The sum of the business's negative uncategorized transactions for the month, in cents.",
            "example": 10
          },
          "fullyCategorized": {
            "type": "boolean",
            "description": "Whether the business has categorized all of their transactions for the month.",
            "example": true
          },
          "uncategorized_transactions": {
            "type": "integer",
            "description": "The number of uncategorized transactions remaining in this month.",
            "format": "int64",
            "example": 1
          }
        }
      },
      "PnlSummary": {
        "type": "object",
        "description": "A profit and loss summary for an arbitrary date range. Unlike MonthlyPnlSummary which represents a single calendar month, this object can represent any time period including all-time when both dates are null.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Pnl_Summary`.",
            "example": "Pnl_Summary"
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The start of the period (ISO 8601 instant). Null indicates all-time from business activation.",
            "example": "2024-01-01T00:00:00Z"
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The end of the period (ISO 8601 instant). Null indicates up to the current time.",
            "example": "2024-12-31T23:59:59Z"
          },
          "income": {
            "type": "integer",
            "format": "int64",
            "description": "The business's total income for the period, in cents.",
            "example": 1050000
          },
          "costOfGoodsSold": {
            "type": "integer",
            "format": "int64",
            "description": "The business's cost of goods sold for the period, in cents.",
            "example": 350000
          },
          "grossProfit": {
            "type": "integer",
            "format": "int64",
            "description": "The business's gross profit for the period, in cents. Calculated as income minus cost of goods sold.",
            "example": 700000
          },
          "operatingExpenses": {
            "type": "integer",
            "format": "int64",
            "description": "The business's operating expenses for the period, in cents.",
            "example": 300000
          },
          "profitBeforeTaxes": {
            "type": "integer",
            "format": "int64",
            "description": "The business's pre-tax profit for the period, in cents.",
            "example": 400000
          },
          "taxes": {
            "type": "integer",
            "format": "int64",
            "description": "The business's taxes for the period, in cents.",
            "example": 100000
          },
          "netProfit": {
            "type": "integer",
            "format": "int64",
            "description": "The business's net profit for the period, in cents.",
            "example": 300000
          },
          "totalExpenses": {
            "type": "integer",
            "format": "int64",
            "description": "The sum of all business expenses (cost of goods sold + operating expenses + taxes) for the period, in cents.",
            "example": 750000
          },
          "uncategorizedInflows": {
            "type": "integer",
            "format": "int64",
            "description": "The sum of positive uncategorized transactions for the period, in cents.",
            "example": 500
          },
          "uncategorizedOutflows": {
            "type": "integer",
            "format": "int64",
            "description": "The sum of negative uncategorized transactions for the period, in cents.",
            "example": 300
          },
          "fullyCategorized": {
            "type": "boolean",
            "description": "Whether all transactions within the period have been categorized.",
            "example": false
          },
          "uncategorized_transactions": {
            "type": "integer",
            "format": "int32",
            "description": "The count of uncategorized transactions within the period.",
            "example": 5
          },
          "categorized_transactions": {
            "type": "integer",
            "format": "int32",
            "description": "The count of categorized transactions within the period.",
            "example": 42
          }
        }
      },
      "ProfitAndLossComparisonRequest": {
        "type": "object",
        "properties": {
          "periods": {
            "$ref": "#/components/schemas/ProfitAndLossComparisonPeriods"
          },
          "tag_filters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagComparisons"
            },
            "nullable": true
          },
          "reporting_basis": {
            "$ref": "#/components/schemas/ReportingBasis",
            "nullable": true
          },
          "structure": {
            "$ref": "#/components/schemas/PnlTemplates",
            "nullable": true
          }
        }
      },
      "ProfitAndLossComparisonPeriods": {
        "type": "object",
        "oneOf": [
          {
            "$ref": "#/components/schemas/Months"
          },
          {
            "$ref": "#/components/schemas/Years"
          },
          {
            "$ref": "#/components/schemas/DateRanges"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "Comparison_Months": "#/components/schemas/Months",
            "Comparison_Years": "#/components/schemas/Years",
            "Comparison_DateRanges": "#/components/schemas/DateRanges"
          }
        }
      },
      "Months": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Comparison_Months"
            ]
          },
          "months": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Month"
            }
          }
        }
      },
      "Month": {
        "type": "object",
        "properties": {
          "year": {
            "type": "integer",
            "format": "int32",
            "example": 2024
          },
          "month": {
            "type": "integer",
            "format": "int32",
            "example": 12
          }
        }
      },
      "Years": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Comparison_Years"
            ]
          },
          "years": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Year"
            }
          }
        }
      },
      "Year": {
        "type": "object",
        "properties": {
          "year": {
            "type": "integer",
            "format": "int32",
            "example": 2024
          }
        }
      },
      "DateRanges": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Comparison_Date_Ranges"
            ]
          },
          "date_ranges": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DateRange"
            }
          }
        }
      },
      "DateRange": {
        "type": "object",
        "properties": {
          "start_date": {
            "type": "string",
            "format": "date-time"
          },
          "end_date": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "TagComparisons": {
        "type": "object",
        "properties": {
          "required_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          }
        }
      },
      "ProfitAndLossComparisonResult": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Comparison_Pnl`.",
            "example": "Comparison_Pnl"
          },
          "pnls": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ComparisonPnlEntry"
            }
          }
        }
      },
      "ComparisonPnlEntry": {
        "type": "object",
        "properties": {
          "period": {
            "$ref": "#/components/schemas/ProfitAndLossComparisonPeriods"
          },
          "tag_filter": {
            "$ref": "#/components/schemas/TagFilter"
          },
          "pnl": {
            "$ref": "#/components/schemas/ProfitAndLoss"
          }
        }
      },
      "TagFilter": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "The tag dimension key to filter on."
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Tag values to include. A row matches if it carries any one of these values."
          }
        },
        "required": [
          "key",
          "values"
        ]
      },
      "ApiLedgerAccount": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "business_id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "stable_name": {
            "$ref": "#/components/schemas/AccountStableName"
          },
          "normality": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "account_type": {
            "$ref": "#/components/schemas/ApiLedgerAccountType"
          },
          "account_subtype": {
            "$ref": "#/components/schemas/ApiLedgerAccountSubtype"
          }
        }
      },
      "SuggestedMatchesWithTransactions": {
        "type": "object",
        "properties": {
          "match_pairs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SuggestedMatchWithTransaction"
            },
            "description": "List of transactions with their suggested match."
          }
        }
      },
      "SuggestedMatchWithTransaction": {
        "type": "object",
        "properties": {
          "transaction_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the transaction to match."
          },
          "suggested_match_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the transaction, invoice payment, etc to match the transaction with."
          }
        }
      },
      "LedgerEntryType": {
        "type": "string",
        "enum": [
          "BANK",
          "MANUAL",
          "OPENING_BALANCE",
          "CLOSING_ACTION_RETAINED_EARNINGS"
        ],
        "example": "BANK"
      },
      "ApiLedgerAccountType": {
        "type": "object",
        "properties": {
          "value": {
            "$ref": "#/components/schemas/LedgerAccountType",
            "description": "Type of the account."
          },
          "display_name": {
            "type": "string",
            "description": "Display name of the account type.",
            "example": "Asset"
          }
        }
      },
      "LedgerAccountType": {
        "type": "string",
        "enum": [
          "ASSET",
          "LIABILITY",
          "EQUITY",
          "REVENUE",
          "EXPENSE"
        ],
        "example": "ASSET"
      },
      "ApiLedgerAccountSubtype": {
        "type": "object",
        "properties": {
          "value": {
            "$ref": "#/components/schemas/LedgerAccountSubtype"
          },
          "display_name": {
            "type": "string",
            "description": "Display name of the account subtype.",
            "example": "Current Assets"
          }
        }
      },
      "LedgerAccountSubtype": {
        "type": "string",
        "enum": [
          "BANK_ACCOUNTS",
          "ACCOUNTS_RECEIVABLE",
          "INVENTORY",
          "PAYMENT_PROCESSOR_CLEARING_ACCOUNT",
          "FIXED_ASSET",
          "ACCUMULATED_DEPRECIATION",
          "CASH",
          "UNDEPOSITED_FUNDS",
          "CURRENT_ASSET",
          "NON_CURRENT_ASSET",
          "PREPAID_EXPENSES",
          "DEVELOPMENT_COSTS",
          "LOANS_RECEIVABLE",
          "INTANGIBLE_ASSET",
          "ACCOUNTS_PAYABLE",
          "CREDIT_CARD",
          "TAXES_PAYABLE",
          "INCOME_TAXES_PAYABLE",
          "SALES_TAXES_PAYABLE",
          "OTHER_TAXES_PAYABLE",
          "PAYROLL_TAXES_PAYABLE",
          "UNEARNED_REVENUE",
          "PAYROLL_LIABILITY",
          "PAYROLL_CLEARING",
          "LINE_OF_CREDIT",
          "TIPS",
          "REFUND_LIABILITIES",
          "UNDEPOSITED_OUTFLOWS",
          "OUTGOING_PAYMENT_CLEARING_ACCOUNT",
          "OTHER_CURRENT_LIABILITY",
          "LOANS_PAYABLE",
          "NOTES_PAYABLE",
          "SHAREHOLDER_LOAN",
          "NON_CURRENT_LIABILITY",
          "CONTRIBUTIONS",
          "DISTRIBUTIONS",
          "COMMON_STOCK",
          "PREFERRED_STOCK",
          "ADDITIONAL_PAID_IN_CAPITAL",
          "RETAINED_EARNINGS",
          "ACCUMULATED_ADJUSTMENTS",
          "OPENING_BALANCE_EQUITY",
          "OTHER_EQUITY",
          "SALES",
          "UNCATEGORIZED_REVENUE",
          "RETURNS_ALLOWANCES",
          "DIVIDEND_INCOME",
          "INTEREST_INCOME",
          "OTHER_INCOME",
          "COGS",
          "OPERATING_EXPENSES",
          "PAYROLL",
          "TAXES_LICENSES",
          "UNCATEGORIZED_EXPENSE",
          "CHARITABLE_CONTRIBUTIONS",
          "LOAN_EXPENSES",
          "FINANCE_COSTS",
          "INTEREST_EXPENSES",
          "DEPRECIATION",
          "AMORTIZATION",
          "BAD_DEBT",
          "OTHER_EXPENSES"
        ],
        "example": "BANK_ACCOUNTS"
      },
      "CategoryList": {
        "type": "object",
        "description": "List of the categories available for a business.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'Category_List'.",
            "example": "Category_List"
          },
          "categories": {
            "description": "Array of categories in a business, where each category is a polymorphic type that can be an Account, OptionalAccount, or an Exclusion. For more details, see [Account Identifiers](/api-reference/ledger/account-identifier) and [Categorization](/api-reference/v1/categorize-bank-transaction#request-body-single-category-or-split).",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NestedApiCategorization"
            }
          }
        }
      },
      "AccountIdentifier": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/AccountId",
            "description": "ID of the account.",
            "title": "Account ID"
          },
          {
            "$ref": "#/components/schemas/AccountStableName",
            "description": "Stable name associated with the account.",
            "title": "Account Stable Name"
          }
        ]
      },
      "AccountId": {
        "type": "object",
        "required": [
          "type",
          "id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "AccountId"
            ],
            "description": "Resource type. Value will be `AccountId`.",
            "example": "AccountId"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the account."
          }
        }
      },
      "AccountStableName": {
        "type": "object",
        "required": [
          "type",
          "stable_name"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "StableName"
            ],
            "description": "Resource type. Value will be `StableName`.",
            "example": "StableName"
          },
          "stable_name": {
            "type": "string",
            "example": "CURRENT_ASSETS",
            "description": "Stable name of the account."
          }
        }
      },
      "BankTransactionPnlEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "business_id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "$ref": "#/components/schemas/TransactionSource"
          },
          "source_transaction_id": {
            "type": "string"
          },
          "source_account_id": {
            "type": "string"
          },
          "imported_at": {
            "type": "string",
            "format": "date-time"
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Date of the transaction in PNL entry."
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "counterparty_name": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "account_name": {
            "type": "string",
            "nullable": true
          },
          "categorizationStatus": {
            "$ref": "#/components/schemas/CategorizationStatus",
            "description": "The status of the transaction\u2019s categorization in Layer\u2019s systems."
          },
          "category": {
            "$ref": "#/components/schemas/ApiCategorization",
            "description": "The category assigned to the transaction. Only populated for transactions that have a finalized category."
          },
          "categorization_method": {
            "$ref": "#/components/schemas/ClassifierAgent"
          },
          "projected_income_category": {
            "$ref": "#/components/schemas/ProjectedIncomeCategory"
          }
        }
      },
      "SplitBankTransactionPnlEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "business_id": {
            "type": "string",
            "format": "uuid"
          },
          "source": {
            "$ref": "#/components/schemas/TransactionSource"
          },
          "source_transaction_id": {
            "type": "string"
          },
          "source_account_id": {
            "type": "string"
          },
          "imported_at": {
            "type": "string",
            "format": "date-time"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "counterparty_name": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "account_name": {
            "type": "string",
            "nullable": true
          },
          "categorizationStatus": {
            "$ref": "#/components/schemas/CategorizationStatus",
            "description": "The status of the transaction\u2019s categorization in Layer\u2019s systems."
          },
          "category": {
            "$ref": "#/components/schemas/ApiCategorization",
            "description": "The category assigned to the transaction. Only populated for transactions that have a finalized category."
          },
          "categorization_method": {
            "$ref": "#/components/schemas/ClassifierAgent"
          },
          "projected_income_category": {
            "$ref": "#/components/schemas/ProjectedIncomeCategory"
          }
        }
      },
      "NewCustomTransactionParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "Unique ID of the custom transaction in an external system for linking and idempotency.",
            "example": "custom-transaction-id-1234"
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the external transaction, in cents."
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection",
            "description": "Direction of the custom transaction."
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "The date that the custom transaction occurred. ISO 8601 format required."
          },
          "merchant_name": {
            "type": "string",
            "nullable": true,
            "description": "Counterparty name for the custom transaction.",
            "example": "My example merchant"
          },
          "merchant_category_code": {
            "type": "string",
            "nullable": true,
            "description": "MCC for the custom transaction.",
            "example": "4072"
          },
          "description": {
            "type": "string",
            "description": "Original description for the custom transaction.",
            "example": "Original description"
          },
          "display_description": {
            "type": "string",
            "nullable": true,
            "description": "Description to display to users which can include enrichment beyond.",
            "example": "Current description to display with details"
          },
          "currency_code": {
            "$ref": "#/components/schemas/CurrencyCode",
            "description": "Currency code that the custom transaction's amount is denominated in.",
            "nullable": true,
            "example": "USD"
          },
          "balance": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Balance for the custom account after the transaction in cents."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the transaction (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the custom transaction. Can be used to filter when listing bank transactions."
          }
        }
      },
      "ApiBankTransactionDataOnly": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the bank transaction."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier of the business the bank transaction is associated with."
          },
          "source": {
            "$ref": "#/components/schemas/TransactionSource",
            "description": "Source of the transaction."
          },
          "source_transaction_id": {
            "type": "string",
            "description": "External transaction ID from the source platform (e.g, Plaid transaction ID).",
            "example": "g4DlKyjXqGH3Kp5XlaWMtwLRrE4Z9AiE8B4Ko"
          },
          "source_account_id": {
            "type": "string",
            "description": "External account ID from the source platform (e.g, Plaid account ID).",
            "example": "Aaoy8G7VXZHVeqNoL1GvcmkPdqpLRWi9NArdG"
          },
          "external_account_id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer's internal UUID for the linked external account. This is distinct from source_account_id, which is the provider's identifier (e.g., Plaid or Stripe account ID)."
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the transaction was imported."
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Date of the transaction."
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection",
            "description": "Direction of the transaction."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Transaction amount in cents."
          },
          "counterparty_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the transaction counterparty.",
            "example": "WeWork"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description of the transaction.",
            "example": "WeWork monthly rent payment"
          },
          "account_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the bank account.",
            "example": "Plaid Checking"
          },
          "categorizationStatus": {
            "$ref": "#/components/schemas/CategorizationStatus",
            "description": "The status of the transaction\u2019s categorization in Layer\u2019s systems."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the bank transaction (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the bank transaction. Can be used to filter when listing bank transactions."
          }
        }
      },
      "SignedAmount": {
        "type": "integer",
        "format": "int64"
      },
      "ExclusionClassification": {
        "$ref": "#/components/schemas/Exclusion",
        "description": "The type of exclusion classification."
      },
      "Exclusion": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Exclusion"
            ],
            "description": "Resource type. Value will be `Exclusion`."
          },
          "exclusion_type": {
            "$ref": "#/components/schemas/ExclusionType"
          }
        },
        "required": [
          "type",
          "exclusion_type"
        ]
      },
      "ExclusionType": {
        "type": "string",
        "description": "Type of exclusion for a bank transaction.",
        "enum": [
          "PERSONAL_EXPENSES",
          "PERSONAL_INFLOWS",
          "DUPLICATE_TRANSACTION",
          "OTHER_EXCLUSION"
        ],
        "x-displayStrings": {
          "PERSONAL_EXPENSES": "Personal transactions",
          "PERSONAL_INFLOWS": "Personal income sources",
          "DUPLICATE_TRANSACTION": "Duplicate transaction",
          "OTHER_EXCLUSION": "Other exclusion"
        },
        "example": "PERSONAL_EXPENSES"
      },
      "ApiCategorization": {
        "description": "Base schema for categorization of API entities.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/AccountCategorization",
            "title": "Account"
          },
          {
            "$ref": "#/components/schemas/ExclusionCategorization",
            "title": "Exclusion"
          },
          {
            "$ref": "#/components/schemas/SplitCategorization",
            "title": "Split"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "Account": "#/components/schemas/AccountCategorization",
            "Exclusion": "#/components/schemas/ExclusionCategorization",
            "Split_Categorization": "#/components/schemas/SplitCategorization"
          }
        }
      },
      "AccountCategorization": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The ID of the Account."
          },
          "stable_name": {
            "type": "string",
            "nullable": true,
            "description": "The stable name for the account.",
            "example": "RENT"
          },
          "category": {
            "type": "string",
            "description": "The account ID or stable name, whichever is present.",
            "example": "RENT"
          },
          "display_name": {
            "type": "string",
            "description": "The display name for the account.",
            "example": "Rent"
          }
        },
        "required": [
          "id",
          "category",
          "display_name"
        ]
      },
      "ExclusionCategorization": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The ID of the exclusion type.",
            "enum": [
              "PERSONAL_EXPENSES",
              "PERSONAL_INFLOWS",
              "DUPLICATE_TRANSACTION",
              "OTHER_EXCLUSION"
            ],
            "example": "PERSONAL_EXPENSES"
          },
          "category": {
            "type": "string",
            "description": "The category of the exclusion type.",
            "enum": [
              "PERSONAL_EXPENSES",
              "PERSONAL_INFLOWS",
              "DUPLICATE_TRANSACTION",
              "OTHER_EXCLUSION"
            ],
            "example": "PERSONAL_EXPENSES"
          },
          "display_name": {
            "type": "string",
            "description": "The display name of the exclusion type.",
            "enum": [
              "Personal spending",
              "Personal income sources",
              "Duplicate transaction",
              "Other exclusion"
            ],
            "example": "Personal spending"
          }
        },
        "required": [
          "id",
          "category",
          "display_name"
        ]
      },
      "SplitCategorizationEntry": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the parent transaction for this split entry."
          },
          "category": {
            "description": "Category for this split entry. May be an account categorization or an exclusion categorization.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/AccountCategorization",
                "title": "Account"
              },
              {
                "$ref": "#/components/schemas/ExclusionCategorization",
                "title": "Exclusion"
              }
            ]
          },
          "tax_code": {
            "type": "string",
            "nullable": true,
            "description": "Tax code applied to this split entry. Currently only supported for businesses incorporated in Canada (`country` is `CA`)."
          }
        }
      },
      "SplitCategorization": {
        "type": "object",
        "properties": {
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SplitCategorizationEntry"
            }
          }
        },
        "required": [
          "entries"
        ]
      },
      "NestedApiCategorization": {
        "type": "object",
        "oneOf": [
          {
            "title": "AccountNested",
            "$ref": "#/components/schemas/NestedAccountCategorization"
          },
          {
            "title": "OptionalAccountNested",
            "$ref": "#/components/schemas/NestedOptionalCatetoryCategorization"
          },
          {
            "title": "ExclusionNested",
            "$ref": "#/components/schemas/NestedExclusionCategorization"
          }
        ]
      },
      "NestedApiSubCategories": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/NestedApiCategorization"
        },
        "nullable": true
      },
      "NestedAccountCategorization": {
        "type": "object",
        "description": "A category that represents a required template account in the business's chart of accounts.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will always be `AccountNested`.",
            "example": "AccountNested"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The ID of the account.",
            "example": "e95c8640-f87b-43bf-a9c6-cabc7ebfdec6"
          },
          "stable_name": {
            "type": "string",
            "nullable": true,
            "description": "The stable name of the account.",
            "example": "EXPENSES"
          },
          "display_name": {
            "type": "string",
            "description": "The display name of the account.",
            "example": "Expenses"
          },
          "subCategories": {
            "$ref": "#/components/schemas/NestedApiSubCategories",
            "description": "The subcategories of the account, in case there are more specific sub-categories of the account."
          }
        }
      },
      "NestedOptionalCatetoryCategorization": {
        "type": "object",
        "description": "A category that represents an optional template account in the business's chart of accounts.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will always be `OptionalAccountNested`.",
            "example": "OptionalAccountNested"
          },
          "stable_name": {
            "type": "string",
            "description": "The stable name of the optional account."
          },
          "display_name": {
            "type": "string",
            "description": "The display name of the optional account."
          },
          "subCategories": {
            "$ref": "#/components/schemas/NestedApiSubCategories",
            "description": "The subcategories of the account."
          }
        }
      },
      "NestedExclusionCategorization": {
        "type": "object",
        "description": "A category that represents an exclusion type in the business's chart of accounts.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will always be `ExclusionNested`.",
            "example": "ExclusionNested"
          },
          "id": {
            "type": "string",
            "description": "The ID of the exclusion type. This is not a UUID and is equivalent to the `category` field.",
            "enum": [
              "PERSONAL_EXPENSES",
              "PERSONAL_INFLOWS",
              "DUPLICATE_TRANSACTION",
              "OTHER_EXCLUSION"
            ],
            "example": "PERSONAL_EXPENSES"
          },
          "category": {
            "type": "string",
            "description": "The category of the exclusion type. This is equivalent to the `id` field.",
            "enum": [
              "PERSONAL_EXPENSES",
              "PERSONAL_INFLOWS",
              "DUPLICATE_TRANSACTION",
              "OTHER_EXCLUSION"
            ],
            "example": "PERSONAL_EXPENSES"
          },
          "display_name": {
            "type": "string",
            "description": "The display name of the exclusion type.",
            "enum": [
              "Personal spending",
              "Personal income sources",
              "Duplicate transaction",
              "Other exclusion"
            ],
            "example": "Personal spending"
          }
        }
      },
      "AccountName": {
        "type": "string"
      },
      "Account": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "accountStableName": {
            "$ref": "#/components/schemas/AccountStableName"
          },
          "number": {
            "type": "integer"
          },
          "name": {
            "$ref": "#/components/schemas/AccountName"
          },
          "subAccounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Account"
            },
            "nullable": true
          },
          "normality": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "balance": {
            "type": "integer",
            "format": "int64"
          },
          "selfOnlyBalance": {
            "type": "integer",
            "format": "int64"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiLineItem"
            }
          }
        }
      },
      "ConfirmMatch": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Polymorphic discriminator, this must be set as `Confirm_Match`.",
            "example": "Confirm_Match"
          },
          "match_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the suggested match to confirm."
          }
        }
      },
      "CreateTaxLineItem": {
        "type": "object",
        "required": [
          "amount"
        ],
        "properties": {
          "tax_account": {
            "$ref": "#/components/schemas/TaxAccountIdentifier",
            "description": "Tax identifier for this line item. Use a `Tax_Name` object to have Layer create or reuse a tax account by name, or use an `AccountId` or `StableName` account identifier when you want to target a specific ledger account."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount, in cents, of tax owed."
          }
        }
      },
      "TaxAccountIdentifier": {
        "type": "object",
        "oneOf": [
          {
            "$ref": "#/components/schemas/TaxName",
            "title": "Tax Name"
          },
          {
            "$ref": "#/components/schemas/AccountId",
            "title": "Ledger Account ID"
          },
          {
            "$ref": "#/components/schemas/AccountStableName",
            "title": "Ledger Account Stable Name"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "AccountId": "#/components/schemas/AccountId",
            "StableName": "#/components/schemas/AccountStableName",
            "Tax_Name": "#/components/schemas/TaxName"
          }
        }
      },
      "LedgerAccountIdentifier": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'Ledger_Account_Identifier'.",
            "example": "Ledger_Account_Identifier"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the ledger account."
          }
        },
        "required": [
          "id"
        ]
      },
      "TaxName": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'Tax_Name'.",
            "example": "Tax_Name"
          },
          "name": {
            "type": "string",
            "description": "Name of the ledger account.",
            "example": "CALIFORNIA_VAT"
          }
        },
        "required": [
          "name"
        ]
      },
      "NestedApiLedgerAccount": {
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/AccountId"
          },
          "name": {
            "type": "string",
            "description": "Name of the ledger account.",
            "example": "Current Assets"
          },
          "stable_name": {
            "$ref": "#/components/schemas/AccountStableName"
          },
          "normality": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "account_type": {
            "$ref": "#/components/schemas/ApiLedgerAccountType",
            "description": "Type of the ledger account."
          },
          "account_subtype": {
            "$ref": "#/components/schemas/ApiLedgerAccountSubtype",
            "description": "Subtype of the ledger account."
          },
          "balance": {
            "type": "integer",
            "format": "int64"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiLineItem"
            }
          },
          "sub_accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NestedApiLedgerAccount"
            }
          }
        }
      },
      "ApiBalanceTimestamp": {
        "type": "object",
        "properties": {
          "external_account_external_id": {
            "type": "string",
            "description": "Unique ID of the external account in an external system for linking and idempotency.",
            "example": "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq"
          },
          "external_account_source": {
            "$ref": "#/components/schemas/TransactionSource",
            "description": "Source of the external account."
          },
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "The current balance of the bank account, in cents."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "The time the balance was recorded."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the balance timestamp was created."
          }
        }
      },
      "LedgerEntrySource": {
        "type": "object",
        "oneOf": [
          {
            "$ref": "#/components/schemas/TransactionLedgerEntrySource"
          },
          {
            "$ref": "#/components/schemas/InvoiceLedgerEntrySource"
          },
          {
            "$ref": "#/components/schemas/ManualLedgerEntrySource"
          },
          {
            "$ref": "#/components/schemas/InvoicePaymentLedgerEntrySource"
          },
          {
            "$ref": "#/components/schemas/BillLedgerEntrySource"
          },
          {
            "$ref": "#/components/schemas/BillPaymentLedgerEntrySource"
          },
          {
            "$ref": "#/components/schemas/RefundPaymentLedgerEntrySource"
          },
          {
            "$ref": "#/components/schemas/OpeningBalanceLedgerEntrySource"
          },
          {
            "$ref": "#/components/schemas/PayoutLedgerEntrySource"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "Transaction_Ledger_Entry_Source": "#/components/schemas/TransactionLedgerEntrySource",
            "Invoice_Ledger_Entry_Source": "#/components/schemas/InvoiceLedgerEntrySource",
            "Bill_Ledger_Entry_Source": "#/components/schemas/BillLedgerEntrySource",
            "Manual_Ledger_Entry_Source": "#/components/schemas/ManualLedgerEntrySource",
            "Bill_Payment_Ledger_Entry_Source": "#/components/schemas/BillPaymentLedgerEntrySource",
            "Invoice_Payment_Ledger_Entry_Source": "#/components/schemas/InvoicePaymentLedgerEntrySource",
            "Refund_Ledger_Entry_Source": "#/components/schemas/RefundPaymentLedgerEntrySource",
            "Opening_Balance_Ledger_Entry_Source": "#/components/schemas/OpeningBalanceLedgerEntrySource",
            "Payout_Ledger_Entry_Source": "#/components/schemas/PayoutLedgerEntrySource"
          }
        }
      },
      "TransactionLedgerEntrySource": {
        "type": "object",
        "properties": {
          "transaction_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string"
          },
          "account_name": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "counterparty": {
            "type": "string",
            "nullable": true
          },
          "entity_name": {
            "type": "string",
            "default": "Bank Transaction"
          },
          "display_description": {
            "type": "string",
            "default": "Generated display description based on account name and date"
          }
        }
      },
      "InvoiceLedgerEntrySource": {
        "type": "object",
        "properties": {
          "invoice_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string",
            "nullable": true
          },
          "invoice_number": {
            "type": "string",
            "nullable": true
          },
          "recipient_name": {
            "type": "string"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "entity_name": {
            "type": "string",
            "default": "Invoice"
          },
          "display_description": {
            "type": "string",
            "default": "Generated display description based on invoice number and date"
          }
        }
      },
      "ManualLedgerEntrySource": {
        "type": "object",
        "properties": {
          "manual_entry_id": {
            "type": "string",
            "format": "uuid"
          },
          "memo": {
            "type": "string"
          },
          "created_by": {
            "type": "string"
          },
          "entity_name": {
            "type": "string",
            "default": "Manual Entry"
          },
          "display_description": {
            "type": "string",
            "default": "Manual Entry"
          }
        }
      },
      "InvoicePaymentLedgerEntrySource": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true
          },
          "invoice_id": {
            "type": "string",
            "format": "uuid"
          },
          "invoice_number": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "entity_name": {
            "type": "string",
            "default": "Invoice Payment"
          },
          "display_description": {
            "type": "string",
            "default": "Payment on invoice based on invoice number"
          }
        }
      },
      "RefundPaymentLedgerEntrySource": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true
          },
          "refund_id": {
            "type": "string",
            "format": "uuid"
          },
          "refunded_to_customer_amount": {
            "type": "integer",
            "format": "int64"
          },
          "recipient_name": {
            "type": "string"
          },
          "entity_name": {
            "type": "string",
            "default": "Refund"
          },
          "display_description": {
            "type": "string",
            "default": "Refund of amount based on customer details"
          }
        }
      },
      "OpeningBalanceLedgerEntrySource": {
        "type": "object",
        "properties": {
          "account_name": {
            "type": "string"
          },
          "entity_name": {
            "type": "string",
            "default": "Opening Balance Entry"
          },
          "display_description": {
            "type": "string",
            "default": "Opening balance for specified account"
          }
        }
      },
      "PayoutLedgerEntrySource": {
        "type": "object",
        "properties": {
          "payout_id": {
            "type": "string",
            "format": "uuid"
          },
          "external_id": {
            "type": "string",
            "nullable": true
          },
          "paid_out_amount": {
            "type": "integer",
            "format": "int64"
          },
          "processor": {
            "type": "string"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time"
          },
          "entity_name": {
            "type": "string",
            "default": "Payout"
          },
          "display_description": {
            "type": "string",
            "default": "Payout processed by specified processor on specified date"
          }
        }
      },
      "BankTransactionCategorization": {
        "description": "Categorization payload for a bank transaction. Use `Category` for one category, or `Split` for multiple category entries that sum to the transaction amount.",
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "Category": "#/components/schemas/Category",
            "Split": "#/components/schemas/ApiSplitInput"
          }
        },
        "oneOf": [
          {
            "$ref": "#/components/schemas/Category",
            "title": "Category"
          },
          {
            "$ref": "#/components/schemas/ApiSplitInput",
            "title": "Split"
          }
        ]
      },
      "BulkMatchOrCategorizeRequest": {
        "type": "object",
        "required": [
          "transactions"
        ],
        "properties": {
          "transactions": {
            "type": "object",
            "description": "Map of transaction IDs to either a match action or a categorize action.",
            "additionalProperties": {
              "$ref": "#/components/schemas/BulkMatchOrCategorizeAction"
            },
            "example": {
              "7c77e464-2a55-4e48-8d71-4f8d2a30c205": {
                "type": "match",
                "suggested_match_id": "8a6fb574-915d-459a-9f5d-2e0a5cf4d3e0"
              },
              "2fe323fc-2f0a-41bf-8f67-768ec955dc59": {
                "type": "categorize",
                "categorization": {
                  "type": "Category",
                  "category": {
                    "type": "StableName",
                    "stable_name": "MEALS"
                  }
                }
              }
            }
          },
          "categorization_source": {
            "type": "string",
            "description": "Optional source to attribute the request to. Accepted values for this endpoint are `API_DIRECT`, `API_FROM_COMPONENT`, `LAYER_BOOKKEEPING`, `API_CONFIRM_MATCH_DIRECT`, `API_CONFIRM_MATCH_FROM_COMPONENT`, and `LAYER_BOOKKEEPING_CONFIRM_MATCH`."
          }
        }
      },
      "BulkMatchOrCategorizeAction": {
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "match": "#/components/schemas/BulkMatchOrCategorizeMatchAction",
            "categorize": "#/components/schemas/BulkMatchOrCategorizeCategorizeAction"
          }
        },
        "oneOf": [
          {
            "$ref": "#/components/schemas/BulkMatchOrCategorizeMatchAction",
            "title": "Match"
          },
          {
            "$ref": "#/components/schemas/BulkMatchOrCategorizeCategorizeAction",
            "title": "Categorize"
          }
        ]
      },
      "BulkMatchOrCategorizeMatchAction": {
        "type": "object",
        "required": [
          "type",
          "suggested_match_id"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "match"
            ],
            "description": "Discriminator for a match action."
          },
          "suggested_match_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the suggested match to confirm for this transaction."
          }
        }
      },
      "BulkMatchOrCategorizeCategorizeAction": {
        "type": "object",
        "required": [
          "type",
          "categorization"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "categorize"
            ],
            "description": "Discriminator for a categorize action."
          },
          "categorization": {
            "$ref": "#/components/schemas/BankTransactionCategorization",
            "description": "How to categorize this transaction."
          }
        }
      },
      "BulkCategorizationRequest": {
        "type": "object",
        "required": [
          "transactions"
        ],
        "properties": {
          "transactions": {
            "type": "array",
            "description": "List of transactions to categorize.",
            "items": {
              "$ref": "#/components/schemas/TransactionCategorizationInput"
            }
          }
        }
      },
      "TransactionCategorizationInput": {
        "type": "object",
        "required": [
          "transaction_id",
          "categorization"
        ],
        "properties": {
          "transaction_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the transaction to categorize."
          },
          "categorization": {
            "$ref": "#/components/schemas/BankTransactionCategorization"
          }
        }
      },
      "BulkCategorizationResponse": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "description": "Results for each transaction categorization.",
            "items": {
              "$ref": "#/components/schemas/CategorizationResult"
            }
          }
        }
      },
      "CategorizationResult": {
        "type": "object",
        "properties": {
          "transaction_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the transaction."
          },
          "success": {
            "type": "boolean",
            "description": "Whether the categorization was successful."
          },
          "transaction": {
            "$ref": "#/components/schemas/ApiBankTransactionWithRuleSuggestion",
            "description": "Categorized bank transaction. Present when success is true."
          },
          "error": {
            "type": "string",
            "description": "Error message if categorization failed."
          }
        }
      },
      "BulkUncategorizeRequest": {
        "type": "object",
        "required": [
          "transaction_ids"
        ],
        "properties": {
          "transaction_ids": {
            "type": "array",
            "description": "List of transaction IDs to uncategorize.",
            "items": {
              "type": "string",
              "format": "uuid"
            }
          }
        }
      },
      "BulkUncategorizeResponse": {
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "description": "Results for each transaction.",
            "items": {
              "$ref": "#/components/schemas/UncategorizeResult"
            }
          }
        }
      },
      "UncategorizeResult": {
        "type": "object",
        "properties": {
          "transaction_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the transaction."
          },
          "success": {
            "type": "boolean",
            "description": "Whether the uncategorization was successful."
          },
          "error": {
            "type": "string",
            "description": "Error message if uncategorization failed."
          }
        }
      },
      "Category": {
        "type": "object",
        "description": "Single-category categorization payload.",
        "required": [
          "type",
          "category"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Category"
            ],
            "description": "Discriminator for a single-category payload."
          },
          "category": {
            "$ref": "#/components/schemas/BankTransactionClassification",
            "description": "A single-category classification to apply to the full transaction amount."
          },
          "tax_code": {
            "type": "string",
            "nullable": true,
            "description": "Tax code to apply to the categorization. Currently only supported for businesses incorporated in Canada (`country` is `CA`) and cannot be used with an `Exclusion` category. Use a `code` from `tax_options` on the [Bank Transaction](/api-reference/bank-transaction/bank-transaction) object that is valid for the transaction's date.",
            "example": "GST_PST_BC"
          }
        }
      },
      "SplitEntry": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount in cents for this split entry."
          },
          "category": {
            "$ref": "#/components/schemas/BankTransactionClassification",
            "description": "Category classification for this split entry amount."
          },
          "tax_code": {
            "type": "string",
            "nullable": true,
            "description": "Tax code to apply to this split entry. Currently only supported for businesses incorporated in Canada (`country` is `CA`) and cannot be used with an `Exclusion` category."
          }
        }
      },
      "BankTransactionClassification": {
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "AccountId": "#/components/schemas/AccountId",
            "StableName": "#/components/schemas/AccountStableName",
            "Exclusion": "#/components/schemas/Exclusion"
          }
        },
        "oneOf": [
          {
            "$ref": "#/components/schemas/AccountId",
            "title": "Account ID"
          },
          {
            "$ref": "#/components/schemas/AccountStableName",
            "title": "Account Stable Name"
          },
          {
            "$ref": "#/components/schemas/Exclusion",
            "title": "Exclusion"
          }
        ]
      },
      "ApiSplitInput": {
        "type": "object",
        "description": "Split categorization payload. Provide one or more entries whose amounts sum exactly to the transaction amount.",
        "required": [
          "type",
          "entries"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "Split"
            ],
            "description": "Discriminator for a split categorization payload."
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SplitEntry"
            },
            "description": "Split entries. Each entry includes a category and amount in cents."
          }
        }
      },
      "AuthToken": {
        "type": "object",
        "properties": {
          "access_token": {
            "type": "string",
            "description": "The business-scoped access token for the Layer API.",
            "example": "eyJraWQiOiJaM1BNWbkhFakeAccessTokenKMGExb0ppUm5sRStlbytI6ImFjY2VzcyIsInNjb3BlIjoiaHR0cHM6XC9cLN5-TG3ktXvNe5B9hU9rQgZQ"
          },
          "expires_in": {
            "type": "integer",
            "format": "int64",
            "description": "Number of seconds until the access token expires.",
            "example": "12345"
          },
          "token_type": {
            "type": "string",
            "description": "Type of the access token, currently always Bearer.",
            "example": "Bearer"
          }
        }
      },
      "NewBusinessAuthTokenParams": {
        "type": "object",
        "properties": {
          "session_duration": {
            "type": "integer",
            "format": "int64",
            "description": "Length, in seconds, this token will be valid. Default is (3600) 1 hour.",
            "example": "3600"
          }
        }
      },
      "LineItem": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "value": {
            "type": "integer",
            "format": "int64"
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItem"
            }
          },
          "is_contra": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "display_name",
          "value",
          "is_contra"
        ]
      },
      "ApiTypedActivity": {
        "type": "object",
        "required": [
          "createdAt"
        ],
        "properties": {
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when this activity was created."
          }
        },
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "Categorize_Transaction_Activity": "#/components/schemas/ApiCategorizeBankTransactionActivity",
            "Load_PnL_Activity": "#/components/schemas/ApiLoadPnlActivity"
          }
        },
        "oneOf": [
          {
            "$ref": "#/components/schemas/ApiCategorizeBankTransactionActivity",
            "title": "Categorize Transaction"
          },
          {
            "$ref": "#/components/schemas/ApiLoadPnlActivity",
            "title": "Load PnL"
          }
        ]
      },
      "ApiCategorizeBankTransactionActivity": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'Categorize_Transaction_Activity'.",
            "example": "Categorize_Transaction_Activity"
          },
          "transactionId": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the transaction to categorize in this activity."
          },
          "categorizationMethod": {
            "$ref": "#/components/schemas/ClassifierAgent",
            "description": "The categorization method for this activity."
          },
          "categorization": {
            "$ref": "#/components/schemas/BankTransactionCategorization",
            "description": "The categorization for the transaction."
          }
        },
        "required": [
          "transactionId",
          "categorizationMethod",
          "categorization"
        ]
      },
      "ApiLoadPnlActivity": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'Load_PnL_Activity'.",
            "example": "Load_PnL_Activity"
          },
          "pnlStartDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The start date for the PnL to load in this activity."
          },
          "pnlEndDate": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The end date for the PnL to load in this activity."
          }
        },
        "required": [
          "createdAt"
        ]
      },
      "FlatUnitTransactionInput": {
        "type": "object",
        "properties": {
          "unit_transaction_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "transaction_type": {
            "type": "string"
          },
          "unit_account_id": {
            "type": "string"
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "balance": {
            "type": "integer",
            "format": "int64"
          },
          "tags": {
            "type": "string",
            "nullable": true
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "merchant_type": {
            "type": "string",
            "nullable": true
          },
          "merchant_location": {
            "type": "string",
            "nullable": true
          },
          "processed_counterparty_name": {
            "type": "string",
            "nullable": true
          },
          "card_last_4_digits": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "sec_code": {
            "type": "string",
            "nullable": true
          },
          "auto_categorize": {
            "type": "boolean",
            "default": true
          },
          "opening_balance_do_not_init": {
            "type": "boolean"
          },
          "opening_balance_init_to_zero": {
            "type": "boolean"
          },
          "init_external_transaction_mappings": {
            "type": "boolean"
          }
        }
      },
      "FlatUnitTransactionResult": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "externalTransactionMappingId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "unit_transaction_id": {
            "type": "string"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "transaction_type": {
            "type": "string"
          },
          "unit_account_id": {
            "type": "string"
          },
          "business_id": {
            "type": "string",
            "format": "uuid"
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection"
          },
          "balance": {
            "type": "integer",
            "format": "int64"
          },
          "amount": {
            "type": "integer",
            "format": "int64"
          },
          "merchant_type": {
            "type": "string",
            "nullable": true
          },
          "tags": {
            "type": "string",
            "nullable": true
          },
          "merchant_location": {
            "type": "string",
            "nullable": true
          },
          "processed_counterparty_name": {
            "type": "string",
            "nullable": true
          },
          "card_last_4_digits": {
            "type": "string",
            "nullable": true
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "sec_code": {
            "type": "string",
            "nullable": true
          },
          "category": {
            "$ref": "#/components/schemas/ApiCategorization",
            "nullable": true
          },
          "categorizationStatus": {
            "$ref": "#/components/schemas/CategorizationStatus",
            "nullable": true
          },
          "previouslyImported": {
            "type": "boolean"
          }
        }
      },
      "ApiInvoiceWriteOff": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Api_Invoice_Write_Off`.",
            "example": "Api_Invoice_Write_Off"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the write-off."
          },
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the invoice the write-off is for."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the write-off in your system for linking and idempotency."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount written off. This amount counts towards the invoice total and decreases the outstanding balance of the invoice. The amount is optional if omitted, default to the entire outstanding balance of the invoice. If specified, the amount must be a positive value and cannot exceed the current outstanding balance of the invoice."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "User-specified memo indicating the reason for the write-off."
          },
          "destination_ledger_account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Expense or contra-arevenue account where write off amount is recorded."
          },
          "write_off_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the write off should be recognized in the general ledger."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "List of tags on the invoice write-off."
          }
        }
      },
      "CreateInvoiceWriteOff": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the write-off in your system for linking and idempotency."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount written off. This amount counts towards the invoice total and decreases the outstanding balance of the invoice. The amount is optional if omitted, default to the entire outstanding balance of the invoice. If specified, the amount must be a positive value and cannot exceed the current outstanding balance of the invoice."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "User-specified memo indicating the reason for the write-off. Recommended but not required."
          },
          "destination_ledger_account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Expense or contra-revenue account where write off amount is recorded. See [AccountIdentifier](/api-reference/ledger/account-identifier) for more details. This field is optional and defaults to the bad debt expense account. If the write-off is for a different reason, such as a charitable donation, a different ledger expense account can be specified here."
          },
          "write_off_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the write off should be recognized in the general ledger."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          }
        }
      },
      "CreateCustomJournalEntryLineItem": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID for the line item within your platform."
          },
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Account identifier for the line item."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount for the line item in cents."
          },
          "direction": {
            "$ref": "#/components/schemas/LedgerEntryDirection",
            "description": "Direction of the ledger entry."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Optional memo field for adding notes about the line item."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the customer to associate with the line item."
          },
          "customer_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the customer to associate with the line item."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the vendor to associate with the line item."
          },
          "vendor_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the vendor to associate with the line item."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the line item."
          }
        },
        "required": [
          "account_identifier",
          "amount",
          "direction"
        ]
      },
      "CreateCustomJournalEntry": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID for the journal entry within your platform. **Idempotency key**."
          },
          "entry_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the journal entry should be recorded effective in the ledger."
          },
          "created_by": {
            "type": "string",
            "description": "Identifier of the user or system that created the journal entry."
          },
          "memo": {
            "type": "string",
            "description": "Description or memo of the journal entry."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomJournalEntryLineItem"
            },
            "description": "Line items for the journal entry. The credits and debits must balance."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the customer to associate with the journal entry."
          },
          "customer_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the customer to associate with the journal entry."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the vendor to associate with the journal entry."
          },
          "vendor_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the vendor to associate with the journal entry."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the journal entry."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the custom journal entry. Can be used to filter when listing custom journal entries."
          }
        },
        "required": [
          "entry_at",
          "created_by",
          "memo",
          "line_items"
        ]
      },
      "CreateCustomJournalEntries": {
        "type": "object",
        "properties": {
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomJournalEntry"
            },
            "description": "List of journal entries to create."
          }
        },
        "required": [
          "entries"
        ]
      },
      "ApiCustomJournalEntryLineItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the line item."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the line item in your system."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Optional memo for the line item."
          },
          "line_item_id": {
            "type": "string",
            "description": "ID of the line item in the ledger."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags associated with the line item."
          }
        },
        "required": [
          "id",
          "line_item_id"
        ]
      },
      "ApiCustomJournalEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the journal entry."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the journal entry in your system."
          },
          "created_by": {
            "type": "string",
            "description": "Identifier of the user or system that created the journal entry."
          },
          "memo": {
            "type": "string",
            "description": "Description or memo of the journal entry."
          },
          "entry_id": {
            "type": "string",
            "description": "ID of the ledger entry."
          },
          "customer": {
            "$ref": "#/components/schemas/ApiCustomerData",
            "nullable": true,
            "description": "The customer associated with this journal entry, if any."
          },
          "vendor": {
            "$ref": "#/components/schemas/ApiVendorData",
            "nullable": true,
            "description": "The vendor associated with this journal entry, if any."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCustomJournalEntryLineItem"
            },
            "description": "Line items for the journal entry."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags associated with the journal entry."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the custom journal entry. Can be used to filter when listing custom journal entries."
          }
        },
        "required": [
          "id",
          "created_by",
          "memo",
          "entry_id",
          "line_items",
          "transaction_tags"
        ]
      },
      "ApiCustomJournalEntryWithEntry": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Custom_Journal_Entry_With_Entry_Details`.",
            "example": "Custom_Journal_Entry_With_Entry_Details"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the journal entry."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the journal entry in your system."
          },
          "created_by": {
            "type": "string",
            "description": "Identifier of the user or system that created the journal entry."
          },
          "memo": {
            "type": "string",
            "description": "Description or memo of the journal entry."
          },
          "entry_id": {
            "type": "string",
            "description": "ID of the ledger entry."
          },
          "customer": {
            "$ref": "#/components/schemas/ApiCustomerData",
            "nullable": true,
            "description": "The customer associated with this journal entry, if any."
          },
          "vendor": {
            "$ref": "#/components/schemas/ApiVendorData",
            "nullable": true,
            "description": "The vendor associated with this journal entry, if any."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCustomJournalEntryLineItem"
            },
            "description": "Line items for the journal entry."
          },
          "entry": {
            "$ref": "#/components/schemas/ApiLedgerEntry",
            "description": "The ledger entry associated with this journal entry."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags associated with the journal entry."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the custom journal entry. Can be used to filter when listing custom journal entries."
          }
        },
        "required": [
          "id",
          "created_by",
          "memo",
          "entry_id",
          "entry",
          "transaction_tags"
        ]
      },
      "ApiCustomJournalEntries": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Custom_Journal_Entries`.",
            "example": "Custom_Journal_Entries"
          },
          "entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCustomJournalEntryWithEntry"
            },
            "description": "List of journal entries."
          }
        },
        "required": [
          "entries"
        ]
      },
      "ApiTrialBalancesImportResult": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Trial_Balances_Import_Result`.",
            "example": "Trial_Balances_Import_Result"
          },
          "opening_balances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiOpeningBalance"
            },
            "description": "Opening balances created from the earliest trial balance in the import, one entry per ledger account with a non-zero balance."
          },
          "manual_entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCustomJournalEntryWithEntry"
            },
            "description": "Manual journal entries created from each subsequent trial balance in the import, capturing the net change from the prior period."
          }
        },
        "required": [
          "opening_balances",
          "manual_entries"
        ]
      },
      "LedgerEntryDirection": {
        "type": "string",
        "enum": [
          "CREDIT",
          "DEBIT"
        ],
        "description": "Direction of the ledger entry (credit or debit).",
        "example": "DEBIT"
      },
      "ApiAccountingConfiguration": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the accounting configuration."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the business."
          },
          "default_reporting_basis": {
            "$ref": "#/components/schemas/ReportingBasis",
            "nullable": true,
            "description": "The default reporting basis for the business."
          },
          "category_list_type": {
            "$ref": "#/components/schemas/CategoryListMode",
            "nullable": true,
            "description": "The default subset of accounts that are fetched by the /businesses/:businessId/categories endpoint."
          },
          "closing_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The timestamp of when the books are closed as of. If present, attempts to create ledger entries before this date will fail. This should only ever be set at the business level (rather than the platform level)."
          },
          "match_rounding_threshold": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "The maximum difference in cents allowed between bank transactions and invoice payments, bill payments, refund payments, or payouts. Defaults to 1 (one cent) if null."
          },
          "match_adjustment_threshold": {
            "type": "number",
            "example": 0.1,
            "nullable": true,
            "description": "The maximum percentage difference allowed between bank transactions and invoice/bill payments for matches to be suggested. Defaults to 0.10 (10%) if null."
          },
          "disable_adjustment_match_suggestions": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the system will suggest matches with adjustments up to a maximum percentage (default of 10%) for invoice and bill payments. Defaults to false (meaning adjustments are enabled) if null."
          },
          "enable_tax_estimates": {
            "type": "boolean",
            "description": "Whether tax estimates are enabled for the business."
          }
        }
      },
      "AccountingConfigurationUpdateParams": {
        "type": "object",
        "properties": {
          "default_reporting_basis": {
            "$ref": "#/components/schemas/ReportingBasis",
            "nullable": true,
            "description": "The default reporting basis for the business."
          },
          "category_list_type": {
            "$ref": "#/components/schemas/CategoryListMode",
            "nullable": true,
            "description": "The default subset of accounts that are fetched by the /businesses/:businessId/categories endpoint."
          },
          "closing_date": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Setting this date means closing the books before this date. If present, attempts to create ledger entries before this date will fail. This should only ever be set at the business level (rather than the platform level)."
          },
          "match_rounding_threshold": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "The maximum difference in cents allowed between bank transactions and invoice payments, bill payments, refund payments, or payouts. Defaults to 1 (one cent) if null."
          },
          "match_adjustment_threshold": {
            "type": "number",
            "nullable": true,
            "example": 0.1,
            "description": "The maximum percentage difference allowed between bank transactions and invoice/bill payments for matches to be suggested. Defaults to 0.10 (10%) if null."
          },
          "disable_adjustment_match_suggestions": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the system will suggest matches with adjustments up to a maximum percentage (default of 10%) for invoice and bill payments. Defaults to false (meaning adjustments are enabled) if null."
          },
          "enable_tax_estimates": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether tax estimates are enabled for the business."
          }
        }
      },
      "VendorCreditLineItemCreateParams": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount for the line item in cents."
          },
          "expense_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Identifier for the expense account for the vendor credit line item. It is suggested but not required that this should point to an expense account (as opposed to revenue/asset/liability/equity)."
          },
          "memo": {
            "type": "string",
            "description": "Description for the line item."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor credit line item."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "List of tags associated with this vendor credit line item."
          }
        },
        "required": [
          "amount",
          "expense_account_identifier"
        ]
      },
      "VendorCreditAllocationCreateParams": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount for the allocation in cents."
          },
          "bill_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the bill the vendor credit allocation is for."
          }
        },
        "required": [
          "amount",
          "bill_id"
        ]
      },
      "VendorCreditCreateParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "External identifier for the vendor credit."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the vendor this credit is associated with."
          },
          "vendor_external_id": {
            "type": "string",
            "description": "External identifier of the vendor this credit is associated with."
          },
          "received_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the vendor credit was received."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VendorCreditLineItemCreateParams"
            },
            "description": "List of line items for this vendor credit."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VendorCreditAllocationCreateParams"
            },
            "description": "List of allocations for this vendor credit."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "List of tags associated with this vendor credit."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor credit (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor credit. Can be used to filter when listing vendor credits."
          }
        },
        "required": [
          "received_at",
          "line_items"
        ]
      },
      "VendorCreditUpdateParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "External identifier for the vendor credit."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the vendor this credit is associated with."
          },
          "vendor_external_id": {
            "type": "string",
            "description": "External identifier of the vendor this credit is associated with."
          },
          "received_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the vendor credit was received."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VendorCreditLineItemCreateParams"
            },
            "description": "List of line items for this vendor credit."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VendorCreditAllocationCreateParams"
            },
            "description": "List of allocations for this vendor credit."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "List of tags associated with this vendor credit."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor credit (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor credit. Can be used to filter when listing vendor credits."
          }
        }
      },
      "ApiVendorCreditLineItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the vendor credit line item."
          },
          "ledger_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "Ledger account for this line item."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount for the line item in cents."
          },
          "memo": {
            "type": "string",
            "description": "Description for the line item."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor credit line item."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "List of tags associated with this vendor credit line item."
          }
        },
        "required": [
          "id",
          "amount"
        ]
      },
      "ApiVendorCreditAllocation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the vendor credit allocation."
          },
          "vendor_credit_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the vendor credit this allocation belongs to."
          },
          "bill_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the bill this allocation is for."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount for the allocation in cents."
          }
        },
        "required": [
          "id",
          "vendor_credit_id",
          "bill_payment_id",
          "amount"
        ]
      },
      "ApiVendorCreditAllocationWithVendorCredit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the vendor credit allocation."
          },
          "vendor_credit_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the vendor credit this allocation belongs to."
          },
          "bill_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the bill this allocation is for."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount for the allocation in cents."
          },
          "vendor_credit": {
            "$ref": "#/components/schemas/ApiVendorCredit",
            "description": "The vendor credit associated with this allocation."
          }
        },
        "required": [
          "id",
          "vendor_credit_id",
          "bill_payment_id",
          "amount",
          "vendor_credit"
        ]
      },
      "ApiVendorCredit": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Vendor_Credit`.",
            "example": "Vendor_Credit"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the vendor credit."
          },
          "external_id": {
            "type": "string",
            "description": "External identifier for the vendor credit."
          },
          "vendor": {
            "$ref": "#/components/schemas/ApiVendorData",
            "description": "The vendor associated with this credit."
          },
          "received_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the vendor credit was received."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiVendorCreditLineItem"
            },
            "description": "List of line items for this vendor credit."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiVendorCreditAllocation"
            },
            "description": "List of allocations for this vendor credit."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the vendor credit was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the vendor credit was last updated."
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the vendor credit was deleted, if applicable."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "List of tags associated with this vendor credit."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor credit (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor credit. Can be used to filter when listing vendor credits."
          }
        },
        "required": [
          "id",
          "vendor",
          "received_at",
          "line_items",
          "created_at",
          "updated_at",
          "transaction_tags"
        ]
      },
      "CustomerCreditLineItemCreateParams": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount for the line item in cents."
          },
          "revenue_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Identifier for the revenue account for the customer credit line item. It is suggested but not required that this should point to a revenue account (as opposed to expense/asset/liability/equity)."
          },
          "memo": {
            "type": "string",
            "description": "Description for the line item."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the customer credit. Can be used to filter when listing customer credits."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "List of tags associated with this customer credit line item."
          }
        },
        "required": [
          "amount",
          "revenue_account_identifier"
        ]
      },
      "CustomerCreditAllocationCreateParams": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount for the allocation in cents."
          },
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the invoice the customer credit allocation is for."
          }
        },
        "required": [
          "amount",
          "invoice_id"
        ]
      },
      "CustomerCreditCreateParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "External identifier for the customer credit."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the customer this credit is associated with."
          },
          "customer_external_id": {
            "type": "string",
            "description": "External identifier of the customer this credit is associated with."
          },
          "sent_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the customer credit was sent."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerCreditLineItemCreateParams"
            },
            "description": "List of line items for this customer credit."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerCreditAllocationCreateParams"
            },
            "description": "List of allocations for this customer credit."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "List of tags associated with this customer credit."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the customer credit (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the customer credit. Can be used to filter when listing customer credits."
          }
        },
        "required": [
          "received_at",
          "line_items"
        ]
      },
      "CustomerCreditUpdateParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "External identifier for the customer credit."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the customer this credit is associated with."
          },
          "customer_external_id": {
            "type": "string",
            "description": "External identifier of the customer this credit is associated with."
          },
          "sent_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the customer credit was sent."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerCreditLineItemCreateParams"
            },
            "description": "List of line items for this customer credit."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CustomerCreditAllocationCreateParams"
            },
            "description": "List of allocations for this customer credit."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "List of tags associated with this customer credit."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the customer credit (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the customer credit. Can be used to filter when listing customer credits."
          }
        }
      },
      "ApiCustomerCreditLineItem": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the customer credit line item."
          },
          "ledger_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "Ledger account for this line item.",
            "example": {
              "id": "c4007474-f604-4d57-9690-b7f40f7a1cee",
              "name": "Sales tax: CALIFORNIA",
              "stable_name": "SALES_TAXES_PAYABLE:CALIFORNIA",
              "normality": "CREDIT",
              "account_type": {
                "value": "LIABILITY",
                "display_name": "Liabilities"
              },
              "account_subtype": {
                "value": "SALES_TAXES_PAYABLE",
                "display_name": "Sales Taxes Payable"
              }
            }
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount for the line item in cents."
          },
          "memo": {
            "type": "string",
            "description": "Description for the line item."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the customer credit line item."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "List of tags associated with this customer credit line item."
          }
        },
        "required": [
          "id",
          "amount"
        ]
      },
      "ApiCustomerCreditAllocation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the customer credit allocation."
          },
          "customer_credit_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the customer credit this allocation belongs to."
          },
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the invoice this allocation is for."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount for the allocation in cents."
          }
        },
        "required": [
          "id",
          "customer_credit_id",
          "invoice_payment_id",
          "amount"
        ]
      },
      "ApiCustomerCreditAllocationWithCustomerCredit": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the customer credit allocation."
          },
          "customer_credit_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the customer credit this allocation belongs to."
          },
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the invoice this allocation is for."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount for the allocation in cents."
          },
          "customer_credit": {
            "$ref": "#/components/schemas/ApiCustomerCredit",
            "description": "The customer credit associated with this allocation."
          }
        },
        "required": [
          "id",
          "customer_credit_id",
          "invoice_payment_id",
          "amount",
          "customer_credit"
        ]
      },
      "ApiCustomerCredit": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Customer_Credit`.",
            "example": "Customer_Credit"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the customer credit."
          },
          "external_id": {
            "type": "string",
            "description": "External identifier for the customer credit."
          },
          "customer": {
            "$ref": "#/components/schemas/ApiCustomerData",
            "description": "The customer associated with this credit."
          },
          "sent_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the customer credit was sent."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCustomerCreditLineItem"
            },
            "description": "List of line items for this customer credit."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCustomerCreditAllocation"
            },
            "description": "List of allocations for this customer credit."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the customer credit was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the customer credit was last updated."
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the customer credit was deleted, if applicable."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "List of tags associated with this customer credit."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the customer credit (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the customer credit. Can be used to filter when listing customer credits."
          }
        },
        "required": [
          "id",
          "customer",
          "received_at",
          "line_items",
          "created_at",
          "updated_at",
          "transaction_tags"
        ]
      },
      "CreateDedicatedRefundParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "description": "Unique ID of the refund in your system for linking purposes. **Idempotency key**.",
            "example": "31415926535"
          },
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "Optional account identifier to override what ledger account the dedicated refund comes out of."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateCustomerRefundAllocationLineItemParams"
            },
            "nullable": true,
            "description": "Detailed line items for the refund allocation. Use this for itemized refunds where you need to specify the exact amounts and accounts."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the dedicated refund was given and paid."
          },
          "refund_processing_fee": {
            "type": "integer",
            "format": "int64",
            "description": "Fee charged to the business for processing the refund."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "processor": {
            "type": "string",
            "nullable": true
          },
          "refunded_payment_fees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RefundedPaymentFeeInput"
            },
            "description": "List of fees associated with the payment for this dedicated refund. These are refunded from the payment processor rather than the business."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "List of tags associated with this dedicated refund."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the refund (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the refund. Can be used to filter when listing refunds."
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "Optional account identifier to specify the clearing account for inferred refund payments. Only used when the system automatically generates a payment for the dedicated refund."
          }
        }
      },
      "PlatformDefinedJson": {
        "type": "object",
        "description": "Arbitrary JSON data defined by the caller, with a 1KB size constraint.",
        "additionalProperties": true,
        "example": {
          "custom_field": "value",
          "any valid json": "below 1kb",
          "nested": {
            "meaning of life": 42,
            "array": []
          }
        }
      },
      "ApiVendorRefund": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Vendor_Refund`.",
            "example": "Vendor_Refund"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the vendor refund."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the vendor refund in your system for linking purposes. **Idempotency key**.",
            "example": "vendor-refund-123"
          },
          "refunded_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount refunded to the business in cents."
          },
          "status": {
            "type": "string",
            "description": "Status of the vendor refund.",
            "example": "PAID"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time when the vendor refund was completed."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiVendorRefundAllocation"
            },
            "description": "Allocations associated with this vendor refund."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiVendorRefundPayment"
            },
            "description": "Payments associated with this vendor refund."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor refund (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor refund. Can be used to filter when listing vendor refunds."
          }
        },
        "description": "A vendor refund represents a transaction where a vendor returns value to a business. A specific bill can be refunded or a general refund can be applied to a vendor."
      },
      "ApiVendorRefundAllocation": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the vendor refund allocation."
          },
          "bill_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the bill this allocation is associated with."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the allocation in cents."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiVendorRefundAllocationLineItem"
            },
            "description": "Line items that make up this allocation."
          },
          "bill_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the bill this allocation is associated with."
          },
          "bill_line_item_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the bill line item this allocation is associated with. If specified, must not refer to a different bill than `bill_id` or `bill_external_id`."
          },
          "bill_line_item_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the bill line item to refund. If specified alongside `bill_line_item_id`, they must refer to the same bill line item."
          },
          "bill_payment_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the bill payment this allocation is associated with."
          },
          "bill_payment_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the bill payment this allocation is associated with."
          },
          "vendor": {
            "$ref": "#/components/schemas/ApiVendorData"
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor refund allocation (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor refund allocation."
          }
        }
      },
      "ApiVendorRefundAllocationLineItem": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External identifier for the line item."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the line item in cents."
          },
          "ledger_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "nullable": true,
            "description": "The ledger account associated with this line item."
          },
          "prepayment_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "nullable": true,
            "description": "The prepayment account associated with this line item, if applicable."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the line item."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor refund allocation line item."
          }
        }
      },
      "ApiVendorRefundPayment": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Vendor_Refund_Payment`.",
            "example": "Vendor_Refund_Payment"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the payment."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the payment in your system for linking purposes. **Idempotency key**.",
            "example": "payment-456"
          },
          "refunded_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount refunded to the business in cents."
          },
          "refund_processing_fee": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Fee charged for the refund processing in cents."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time when the payment was completed."
          },
          "method": {
            "type": "string",
            "description": "Method of the payment.",
            "example": "ACH"
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Processor used for the payment.",
            "example": "STRIPE"
          },
          "payment_clearing_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "description": "The the ledger account to use for the payment (overrides the default determined by the payment method), if specified."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor refund payment (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor refund payment. Can be used to filter when listing vendor refund payments."
          }
        },
        "description": "A payment represents a transaction that moves value from a vendor to a business. A specific bill can be refunded or a general refund can be applied to a vendor."
      },
      "SimpleVendorRefundCreateParams": {
        "title": "Simple Vendor Refund",
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An external identifier for the vendor refund transaction."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "The time the vendor refund was completed."
          },
          "bill_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the bill to refund."
          },
          "bill_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the bill to refund."
          },
          "bill_line_item_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the bill line item to refund."
          },
          "bill_line_item_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the bill line item to refund."
          },
          "bill_payment_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the bill payment to refund."
          },
          "bill_payment_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the bill payment to refund."
          },
          "refund_processing_fee": {
            "type": "integer",
            "format": "int64",
            "default": 0,
            "description": "The fee charged to the business for processing the refund in cents."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "The payment method used for the refund."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "The payment processor used to process the refund.",
            "example": "STRIPE"
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the vendor refund."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor refund (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor refund. Can be used to filter when listing vendor refunds."
          }
        },
        "required": [
          "completed_at",
          "method"
        ],
        "description": "Simple vendor refund creation parameters. The system will automatically calculate the refund amount based on the specified target (bill, line item, or payment). At least one target identifier must be provided."
      },
      "PatchVendorRefundParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An external identifier for the vendor refund transaction."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "The time the vendor refund was completed."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateVendorRefundAllocationParams"
            },
            "description": "The targets of the vendor refund. If provided, all existing allocations will be replaced with these new allocations. Each allocation specifies how much of the refund should be applied to a specific bill, line item, payment, or vendor."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateVendorRefundPaymentParams"
            },
            "description": "The payment methods and amounts used to process the vendor refund. If provided, all existing payments will be replaced with these new payments."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the vendor refund. If provided, all existing tags will be replaced."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor refund (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor refund. Can be used to filter when listing vendor refunds."
          }
        },
        "description": "Parameters for partially updating a vendor refund. All fields are optional. If allocations or payments are provided, they will fully replace the existing allocations or payments respectively."
      },
      "ItemizedVendorRefundCreateParams": {
        "title": "Itemized Vendor Refund",
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An external identifier for the vendor refund transaction."
          },
          "refunded_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The total amount of the vendor refund in cents. This value must be positive and equal to the sum of all allocation amounts."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "The time the vendor refund was completed."
          },
          "allocations": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateVendorRefundAllocationParams"
            },
            "description": "The targets of the vendor refund. Each allocation specifies how much of the refund should be applied to a specific bill, line item, payment, or vendor."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateVendorRefundPaymentParams"
            },
            "description": "The payment methods and amounts used to process the vendor refund."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the vendor refund."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor refund (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor refund. Can be used to filter when listing vendor refunds."
          }
        },
        "required": [
          "refunded_amount",
          "completed_at",
          "allocations",
          "payments"
        ],
        "description": "Itemized vendor refund creation parameters. Provides full control over refund allocations and payments. The sum of allocation amounts must equal the refunded_amount."
      },
      "CreateVendorRefundAllocationParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An external identifier for the vendor refund allocation."
          },
          "total_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The total amount of this allocation in cents. Must equal the sum of all line item amounts."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateVendorRefundAllocationLineItemParams"
            },
            "description": "The line items that make up this allocation."
          },
          "bill_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the bill to refund."
          },
          "bill_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the bill to refund."
          },
          "bill_line_item_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the bill line item to refund."
          },
          "bill_line_item_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the bill line item to refund."
          },
          "bill_payment_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the bill payment to refund."
          },
          "bill_payment_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the bill payment to refund."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The ID of the vendor to refund."
          },
          "vendor_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the vendor to refund."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the allocation."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor refund allocation."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor refund allocation."
          }
        },
        "required": [
          "total_amount",
          "line_items"
        ],
        "description": "Parameters for creating a vendor refund allocation. At least one target identifier (bill, line item, payment, or vendor) must be provided."
      },
      "CreateVendorRefundAllocationLineItemParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An external identifier for the line item."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of this line item in cents."
          },
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Identifier of the ledger account for this line item."
          },
          "prepayment_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "Identifier of the prepayment ledger account for this line item."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the line item."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the line item."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor refund allocation line item."
          }
        },
        "required": [
          "amount",
          "account_identifier"
        ],
        "description": "Parameters for creating a vendor refund allocation line item."
      },
      "CreateVendorRefundPaymentParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the payment in your system for linking purposes. **Idempotency key**.",
            "example": "payment-456"
          },
          "refunded_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount refunded to the business in cents."
          },
          "refund_processing_fee": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Fee charged to the business for processing the refund in cents."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time when the payment was completed."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "Payment method used for the refund."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Processor used to make the payment, if any. Any processor name can be provided and will be tracked. Supported processors (e.g. `STRIPE`) will have additional asset balance tracking.",
            "example": "STRIPE"
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The the ledger account to use for the payment (overrides the default determined by the payment method)."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "Tags to associate with the payment."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor refund payment."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor refund payment. Can be used to filter when listing vendor refund payments."
          }
        },
        "description": "Parameters for creating a vendor refund payment."
      },
      "CreateVendorPayoutParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the vendor payout in your system for linking purposes.",
            "example": "vendor-payout-1234"
          },
          "paid_out_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of the vendor payout, in cents. This amount can be negative if vendor refunds exceed bill payments."
          },
          "processor": {
            "$ref": "#/components/schemas/PaymentProcessor",
            "nullable": true,
            "description": "Processor used to make the payment. If not null, every bill payment or vendor refund payment associated with the vendor payout must have the same processor.",
            "example": "STRIPE"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the vendor payout was completed."
          },
          "bill_payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VendorPayoutPaymentInput"
            },
            "description": "List of bill payments to associate with the vendor payout."
          },
          "vendor_refund_payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VendorPayoutRefundInput"
            },
            "description": "List of vendor refund payments to associate with the vendor payout."
          },
          "other_transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OtherVendorPayoutTransactionInput"
            },
            "description": "A list of other transactions associated with the vendor payout."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor payout (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor payout. Can be used to filter when listing vendor payouts."
          }
        }
      },
      "UpdateVendorPayoutParams": {
        "type": "object",
        "properties": {
          "paid_out_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of the vendor payout, in cents."
          },
          "processor": {
            "$ref": "#/components/schemas/PaymentProcessor",
            "nullable": true,
            "description": "Processor used to make the payment, if any. Any processor name can be provided and will be tracked."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the vendor payout was completed."
          },
          "bill_payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VendorPayoutPaymentInput"
            },
            "description": "A list of bill payments associated with the vendor payout."
          },
          "vendor_refund_payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/VendorPayoutRefundInput"
            },
            "description": "A list of vendor refund payments associated with the vendor payout."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "description": "A list of tags associated with the vendor payout."
          },
          "other_transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OtherVendorPayoutTransactionInput"
            },
            "description": "A list of other transactions associated with the vendor payout."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor payout (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor payout. Can be used to filter when listing vendor payouts."
          }
        }
      },
      "VendorPayoutPaymentInput": {
        "type": "object",
        "properties": {
          "bill_payment_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "UUID of the bill payment to associate with the vendor payout."
          },
          "bill_payment_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the bill payment to associate with the vendor payout."
          }
        },
        "description": "At least one of bill_payment_id or bill_payment_external_id must be specified."
      },
      "VendorPayoutRefundInput": {
        "type": "object",
        "properties": {
          "vendor_refund_payment_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "UUID of the vendor refund payment to associate with the vendor payout."
          },
          "vendor_refund_payment_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the vendor refund payment to associate with the vendor payout."
          }
        },
        "description": "At least one of vendor_refund_payment_id or vendor_refund_payment_external_id must be specified."
      },
      "OtherVendorPayoutTransactionInput": {
        "type": "object",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the transaction, in cents. This amount must be a positive value."
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection",
            "description": "Direction of the transaction."
          },
          "account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Account identifier for the transaction."
          },
          "description": {
            "type": "string",
            "description": "Description of the transaction."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the transaction in your system for linking purposes."
          }
        }
      },
      "ApiOtherVendorPayoutTransaction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique ID for the other vendor payout transaction."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the transaction, in cents."
          },
          "direction": {
            "$ref": "#/components/schemas/BankTransactionDirection",
            "description": "Direction of the transaction."
          },
          "account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Account identifier for the transaction."
          },
          "description": {
            "type": "string",
            "description": "Description of the transaction."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the transaction."
          }
        }
      },
      "ApiVendorPayout": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Vendor_Payout`.",
            "example": "Vendor_Payout"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique ID for the Vendor Payout. **Idempotency key.**."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the vendor payout in your system for linking purposes.",
            "example": "vendor-payout-1234"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the Business that generated the vendor payout."
          },
          "paid_out_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of the vendor payout, in cents."
          },
          "processor": {
            "$ref": "#/components/schemas/PaymentProcessor",
            "nullable": true,
            "description": "Processor used to make the payment, if any. If not null, every bill payment or vendor refund payment associated with the vendor payout must have the same processor.",
            "example": "STRIPE"
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the vendor payout was imported."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the vendor payout was completed."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBillPayment"
            },
            "description": "A list of bill payments associated with the vendor payout."
          },
          "refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiVendorRefund"
            },
            "description": "A list of vendor refund payments associated with the vendor payout."
          },
          "other_transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiOtherVendorPayoutTransaction"
            },
            "description": "A list of other transactions associated with the vendor payout."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "A list of tags associated with the vendor payout."
          },
          "match": {
            "$ref": "#/components/schemas/ApiMatch",
            "nullable": true,
            "description": "The transaction match associated with the vendor payout."
          },
          "suggested_matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiSuggestedMatch"
            },
            "description": "A list of suggested matches for the vendor payout."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor payout (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor payout. Can be used to filter when listing vendor payouts."
          }
        }
      },
      "ApiVendorPayoutWithoutTransactions": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique ID for the Vendor Payout. **Idempotency key.**."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the vendor payout in your system for linking purposes.",
            "example": "vendor-payout-1234"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the Business that generated the vendor payout."
          },
          "paid_out_amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount of the vendor payout, in cents."
          },
          "processor": {
            "$ref": "#/components/schemas/PaymentProcessor",
            "nullable": true,
            "description": "Processor used to make the payment, if any. Any processor name can be provided and will be tracked."
          },
          "imported_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the vendor payout was imported."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of when the vendor payout was completed."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "A list of tags associated with the vendor payout."
          },
          "match": {
            "$ref": "#/components/schemas/ApiMatch",
            "nullable": true,
            "description": "The transaction match associated with the vendor payout."
          },
          "suggested_matches": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiSuggestedMatch"
            },
            "description": "A list of suggested matches for the vendor payout."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for any text you would like to associate with the vendor payout (for example, to display to end users)."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier you would like to associate with the vendor payout. Can be used to filter when listing vendor payouts."
          }
        }
      },
      "PatchApiLedgerAccount": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Account name."
          },
          "account_number": {
            "type": "string",
            "nullable": true,
            "description": "Optional account number for the ledger account.",
            "example": "4000"
          },
          "normality": {
            "$ref": "#/components/schemas/LedgerEntryDirection",
            "description": "Account normality."
          },
          "parent_id": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The [Account Identifier](/api-reference/ledger/account-identifier) of the parent account under which this ledger account is categorized."
          },
          "stable_name": {
            "$ref": "#/components/schemas/AccountStableName",
            "description": "The [Stable Name](/api-reference/ledger/account-identifier#stable-name) for the account."
          },
          "account_type": {
            "$ref": "#/components/schemas/ApiLedgerAccountType",
            "description": "Type of the ledger account."
          },
          "account_subtype": {
            "$ref": "#/components/schemas/ApiLedgerAccountSubtype",
            "description": "Subtype of the ledger account."
          }
        },
        "description": "Parameters for partially updating a ledger account (PATCH operation). All fields are optional."
      },
      "ApiProfitAndLoss": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Profit_And_Loss`.",
            "example": "Profit_And_Loss"
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "description": "Start date of the P&L period."
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "description": "End date of the P&L period."
          },
          "reporting_basis": {
            "type": "string",
            "enum": [
              "ACCRUAL",
              "CASH"
            ],
            "description": "Accounting basis used for the report.",
            "example": "CASH"
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiPnlLineItem"
            },
            "description": "P&L line items."
          },
          "total_revenue": {
            "type": "integer",
            "description": "Total revenue in cents."
          },
          "total_expenses": {
            "type": "integer",
            "description": "Total expenses in cents."
          },
          "net_income": {
            "type": "integer",
            "description": "Net income in cents."
          }
        }
      },
      "ApiBalanceSheet": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Balance_Sheet`.",
            "example": "Balance_Sheet"
          },
          "effective_date": {
            "type": "string",
            "format": "date-time",
            "description": "Effective date of the balance sheet."
          },
          "reporting_basis": {
            "type": "string",
            "enum": [
              "ACCRUAL",
              "CASH"
            ],
            "description": "Accounting basis used for the report.",
            "example": "CASH"
          },
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBalanceSheetSection"
            },
            "description": "Asset accounts."
          },
          "liabilities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBalanceSheetSection"
            },
            "description": "Liability accounts."
          },
          "equity": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBalanceSheetSection"
            },
            "description": "Equity accounts."
          },
          "total_assets": {
            "type": "integer",
            "description": "Total assets in cents."
          },
          "total_liabilities": {
            "type": "integer",
            "description": "Total liabilities in cents."
          },
          "total_equity": {
            "type": "integer",
            "description": "Total equity in cents."
          }
        }
      },
      "ApiCashflowStatement": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Cashflow_Statement`.",
            "example": "Cashflow_Statement"
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "description": "Start date of the cashflow period."
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "description": "End date of the cashflow period."
          },
          "reporting_basis": {
            "type": "string",
            "enum": [
              "ACCRUAL",
              "CASH"
            ],
            "description": "Accounting basis used for the report.",
            "example": "CASH"
          },
          "operating_activities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCashflowLineItem"
            },
            "description": "Operating activities."
          },
          "investing_activities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCashflowLineItem"
            },
            "description": "Investing activities."
          },
          "financing_activities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiCashflowLineItem"
            },
            "description": "Financing activities."
          },
          "net_cash_flow": {
            "type": "integer",
            "description": "Net cash flow in cents."
          }
        }
      },
      "ApiPnlLineItem": {
        "type": "object",
        "properties": {
          "account_name": {
            "type": "string",
            "description": "Name of the account."
          },
          "amount": {
            "type": "integer",
            "description": "Amount in cents."
          },
          "account_type": {
            "type": "string",
            "description": "Type of account."
          }
        }
      },
      "ApiBalanceSheetSection": {
        "type": "object",
        "properties": {
          "account_name": {
            "type": "string",
            "description": "Name of the account."
          },
          "balance": {
            "type": "integer",
            "description": "Account balance in cents."
          },
          "account_type": {
            "type": "string",
            "description": "Type of account."
          }
        }
      },
      "ApiCashflowLineItem": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "description": "Description of the cashflow item."
          },
          "amount": {
            "type": "integer",
            "description": "Amount in cents."
          }
        }
      },
      "ApiLedgerLineItemWithSource": {
        "type": "object",
        "description": "A ledger line item with its source information.",
        "required": [
          "id",
          "entry_id",
          "account",
          "amount",
          "direction",
          "date"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for this line item.",
            "example": "li_abc123def456"
          },
          "entry_id": {
            "type": "string",
            "description": "ID of the parent ledger entry.",
            "example": "550e8400-e29b-41d4-a716-446655440000"
          },
          "account": {
            "$ref": "#/components/schemas/SingleApiChartAccount"
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount in cents (or smallest currency unit).",
            "example": 125050
          },
          "direction": {
            "$ref": "#/components/schemas/LedgerEntryDirection"
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Date of this line item entry.",
            "example": "2024-03-15T14:30:00Z"
          },
          "source": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TransactionLedgerEntrySource"
              },
              {
                "$ref": "#/components/schemas/InvoiceLedgerEntrySource"
              },
              {
                "$ref": "#/components/schemas/ManualLedgerEntrySource"
              },
              {
                "$ref": "#/components/schemas/InvoicePaymentLedgerEntrySource"
              },
              {
                "$ref": "#/components/schemas/InvoiceWriteOffLedgerEntrySource"
              }
            ],
            "nullable": true,
            "description": "Source information for this ledger entry (transaction, invoice, manual entry, etc.).",
            "discriminator": {
              "propertyName": "entity_name"
            }
          }
        }
      },
      "InvoiceWriteOffLedgerEntrySource": {
        "type": "object",
        "description": "Source information for an invoice write-off ledger entry.",
        "required": [
          "entity_name",
          "display_description",
          "invoice_id",
          "customer_description",
          "date",
          "write_off_amount",
          "invoice_identifiers"
        ],
        "properties": {
          "entity_name": {
            "type": "string",
            "description": "Type of entity (discriminator).",
            "default": "Invoice Write-Off"
          },
          "display_description": {
            "type": "string",
            "description": "Human-readable description."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "External system identifier."
          },
          "invoice_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the invoice being written off."
          },
          "invoice_number": {
            "type": "string",
            "nullable": true,
            "description": "Invoice number."
          },
          "recipient_name": {
            "type": "string",
            "nullable": true,
            "description": "Invoice recipient name."
          },
          "customer_description": {
            "type": "string",
            "description": "Customer description."
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Write-off date."
          },
          "write_off_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount written off in cents."
          },
          "invoice_identifiers": {
            "type": "object",
            "description": "Invoice identification information.",
            "properties": {
              "external_id": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Optional memo/note."
          },
          "metadata": {
            "type": "object",
            "nullable": true,
            "description": "Platform-defined JSON metadata."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for this entry."
          }
        }
      },
      "ApiPnlLineItemDetailReport": {
        "type": "object",
        "description": "Detailed report for a specific P&L line item showing all ledger entries that contribute to it.",
        "required": [
          "business_id",
          "start_date",
          "end_date",
          "pnl_structure_line_item_name",
          "pnl_structure_line_item_display_name",
          "reporting_basis",
          "lines"
        ],
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Profit_And_Loss_Line_Item_Detail_Report`.",
            "example": "Profit_And_Loss_Line_Item_Detail_Report"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of the business for this report.",
            "example": "550e8400-e29b-41d4-a716-446655440000"
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "description": "Start date of the report period (ISO 8601 timestamp).",
            "example": "2024-01-01T00:00:00Z"
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "description": "End date of the report period (ISO 8601 timestamp).",
            "example": "2024-12-31T23:59:59.999Z"
          },
          "pnl_structure_line_item_name": {
            "type": "string",
            "description": "Internal name of the P&L structure line item.",
            "example": "operating_expenses"
          },
          "pnl_structure_line_item_display_name": {
            "type": "string",
            "description": "Display-friendly name of the P&L structure line item.",
            "example": "Operating Expenses"
          },
          "reporting_basis": {
            "$ref": "#/components/schemas/ReportingBasis"
          },
          "pnl_structure": {
            "$ref": "#/components/schemas/PnlTemplates",
            "nullable": true,
            "description": "Optional P&L template structure used for this report."
          },
          "tag_filter": {
            "$ref": "#/components/schemas/TagFilter",
            "nullable": true,
            "description": "Optional tag filter applied to this report."
          },
          "lines": {
            "type": "array",
            "description": "List of ledger line items that contribute to this P&L line item.",
            "items": {
              "$ref": "#/components/schemas/ApiLedgerLineItemWithSource"
            }
          }
        }
      },
      "TaxPacketCreateRequest": {
        "type": "object",
        "properties": {
          "year": {
            "type": "integer",
            "description": "Tax year for the packet (alternative to start_date/end_date)."
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "description": "Start date for custom date range (alternative to year)."
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "description": "End date for custom date range (alternative to year)."
          },
          "include_general_ledger": {
            "type": "boolean",
            "default": true,
            "description": "Whether to include general ledger details."
          },
          "include_account_transactions": {
            "type": "boolean",
            "default": true,
            "description": "Whether to include account transaction details."
          }
        }
      },
      "TaxPacketCreateResponse": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Tax_Packet_Request`.",
            "example": "Tax_Packet_Request"
          },
          "id": {
            "type": "string",
            "description": "Unique identifier for the tax packet request."
          },
          "business_id": {
            "type": "string",
            "description": "Business ID the tax packet belongs to."
          },
          "year": {
            "type": "integer",
            "description": "Tax year for the packet."
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "description": "Start date of the tax packet period."
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "description": "End date of the tax packet period."
          },
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "PROCESSING",
              "COMPLETED",
              "FAILED"
            ],
            "description": "Status of the tax packet generation.",
            "example": "PENDING"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the tax packet request was created."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the tax packet generation was completed."
          },
          "download_urls": {
            "type": "object",
            "properties": {
              "profit_and_loss": {
                "type": "string",
                "description": "Pre-signed URL for P&L report."
              },
              "general_ledger": {
                "type": "string",
                "description": "Pre-signed URL for general ledger."
              },
              "account_transactions": {
                "type": "string",
                "description": "Pre-signed URL for account transactions."
              }
            },
            "description": "Download URLs for tax packet components."
          }
        }
      },
      "ScheduleCReport": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Schedule_C_Report`.",
            "example": "Schedule_C_Report"
          },
          "business_id": {
            "type": "string",
            "description": "The UUID of the business this report belongs to.",
            "example": "550e8400-e29b-41d4-a716-446655440000"
          },
          "year": {
            "type": "integer",
            "description": "The tax year for this Schedule C report.",
            "example": 2025
          },
          "reporting_basis": {
            "$ref": "#/components/schemas/ReportingBasis",
            "description": "The accounting basis used for this report."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScheduleCLineItem"
            },
            "description": "The line items that make up the Schedule C report."
          }
        },
        "required": [
          "business_id",
          "year",
          "reporting_basis",
          "line_items"
        ]
      },
      "ScheduleCLineItem": {
        "type": "object",
        "properties": {
          "line_number": {
            "type": "string",
            "description": "The IRS Schedule C line number (e.g., '1', '8', '16a').",
            "example": "1"
          },
          "line_name": {
            "type": "string",
            "description": "The name/description of the line item as it appears on Schedule C.",
            "example": "Gross receipts or sales"
          },
          "part": {
            "type": "string",
            "description": "The part of Schedule C this line item belongs to.",
            "enum": [
              "Part I - Income",
              "Part II - Expenses",
              "Part III - Cost of Goods Sold",
              "Part V - Other Expenses",
              "Schedule A"
            ],
            "example": "Part I - Income"
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "The amount in cents for this line item.",
            "example": 15000000
          }
        },
        "required": [
          "line_number",
          "line_name",
          "part",
          "amount"
        ]
      },
      "PaymentsTraceReportRequest": {
        "type": "object",
        "properties": {
          "start_date": {
            "type": "string",
            "format": "date-time",
            "description": "Start date for the payments trace report."
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "description": "End date for the payments trace report."
          },
          "include_refunds": {
            "type": "boolean",
            "default": true,
            "description": "Whether to include refund information."
          },
          "payment_method_filter": {
            "type": "string",
            "description": "Filter by payment method."
          }
        },
        "required": [
          "start_date",
          "end_date"
        ]
      },
      "PaymentsTraceReportResponse": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Payments_Trace_Report`.",
            "example": "Payments_Trace_Report"
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "description": "Start date of the report period."
          },
          "end_date": {
            "type": "string",
            "format": "date-time",
            "description": "End date of the report period."
          },
          "payments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PaymentTraceItem"
            },
            "description": "Payment trace items."
          },
          "total_payments": {
            "type": "integer",
            "description": "Total payment amount in cents."
          },
          "total_refunds": {
            "type": "integer",
            "description": "Total refund amount in cents."
          }
        }
      },
      "PaymentTraceItem": {
        "type": "object",
        "properties": {
          "payment_id": {
            "type": "string",
            "description": "Unique payment identifier."
          },
          "transaction_date": {
            "type": "string",
            "format": "date-time",
            "description": "Date of the payment transaction."
          },
          "amount": {
            "type": "integer",
            "description": "Payment amount in cents."
          },
          "payment_method": {
            "type": "string",
            "description": "Payment method used."
          },
          "status": {
            "type": "string",
            "description": "Payment status."
          },
          "description": {
            "type": "string",
            "description": "Payment description."
          }
        }
      },
      "ApiBalanceHistory": {
        "type": "object",
        "properties": {
          "before_first_balance": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBalanceEvent"
            },
            "description": "Balance events that occurred before the first recorded balance."
          },
          "segments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBalanceSegment"
            },
            "description": "Balance segments between recorded balance timestamps."
          },
          "after_last_balance": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBalanceEvent"
            },
            "description": "Balance events that occurred after the last recorded balance."
          },
          "unexplained_transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBalanceEvent"
            },
            "description": "Transactions that could not be reconciled with balance changes."
          },
          "unreconciled_balances": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBalanceTimestamp"
            },
            "description": "Balance timestamps that could not be reconciled."
          }
        }
      },
      "ApiBalanceSegment": {
        "type": "object",
        "properties": {
          "start_balance": {
            "$ref": "#/components/schemas/ApiBalanceTimestamp",
            "description": "Starting balance timestamp for this segment."
          },
          "end_balance": {
            "$ref": "#/components/schemas/ApiBalanceTimestamp",
            "description": "Ending balance timestamp for this segment."
          },
          "transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBalanceEvent"
            },
            "description": "Transactions that occurred within this balance segment."
          }
        }
      },
      "ApiBalanceEvent": {
        "type": "object",
        "properties": {
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "Account balance at the time of this event in cents."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when this balance event occurred."
          },
          "transaction": {
            "$ref": "#/components/schemas/ApiBankTransactionDataOnly",
            "description": "Transaction associated with this balance event."
          }
        }
      },
      "ExternalAccountConfirmOptions": {
        "type": "object",
        "properties": {
          "is_relevant": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the external account is relevant to the business."
          },
          "is_unique": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the external account is unique (not a duplicate)."
          }
        },
        "description": "Options for confirming an external account. At least one of is_relevant or is_unique must be true."
      },
      "ExternalAccountExcludeOptions": {
        "type": "object",
        "properties": {
          "is_irrelevant": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the external account is irrelevant to the business."
          },
          "is_duplicate": {
            "type": "boolean",
            "nullable": true,
            "description": "Whether the external account is a duplicate."
          }
        },
        "description": "Options for excluding an external account. At least one of is_irrelevant or is_duplicate must be true."
      },
      "OpeningBalanceInput": {
        "type": "object",
        "properties": {
          "effective_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp for when the account had this balance."
          },
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "Opening balance of the account in cents."
          }
        },
        "required": [
          "effective_at",
          "balance"
        ],
        "description": "Input parameters for creating or updating an opening balance."
      },
      "ApiExternalAccountNotificationType": {
        "type": "string",
        "enum": [
          "OPENING_BALANCE_MISSING",
          "CONFIRM_RELEVANT",
          "CONFIRM_UNIQUE"
        ],
        "description": "Type of notification for external account.",
        "example": "OPENING_BALANCE_MISSING"
      },
      "ApiExternalAccountNotificationScope": {
        "type": "string",
        "enum": [
          "USER"
        ],
        "description": "Scope of the external account notification.",
        "example": "USER"
      },
      "ApiExternalAccountNotification": {
        "type": "object",
        "properties": {
          "type": {
            "$ref": "#/components/schemas/ApiExternalAccountNotificationType",
            "description": "Type of notification."
          },
          "scope": {
            "$ref": "#/components/schemas/ApiExternalAccountNotificationScope",
            "description": "Scope of the notification."
          }
        },
        "required": [
          "type"
        ],
        "description": "Notification for external account requiring user attention."
      },
      "TripPurpose": {
        "type": "string",
        "enum": [
          "UNREVIEWED",
          "BUSINESS",
          "PERSONAL"
        ],
        "description": "The purpose classification of a trip. UNREVIEWED indicates the trip has not been categorized yet, BUSINESS indicates a business-related trip eligible for mileage deduction, and PERSONAL indicates a personal trip not eligible for deduction.",
        "example": "BUSINESS"
      },
      "ApiVehicle": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The unique identifier of the vehicle."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the business this vehicle belongs to."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An optional external identifier for the vehicle, used for idempotency."
          },
          "make_and_model": {
            "type": "string",
            "description": "The make and model of the vehicle (e.g., 'Toyota Camry')."
          },
          "year": {
            "type": "integer",
            "description": "The model year of the vehicle."
          },
          "license_plate": {
            "type": "string",
            "nullable": true,
            "description": "The license plate number of the vehicle."
          },
          "vin": {
            "type": "string",
            "nullable": true,
            "description": "The Vehicle Identification Number (VIN)."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "An optional description or notes about the vehicle."
          },
          "is_primary": {
            "type": "boolean",
            "description": "Whether this is the primary vehicle for the business. Only one vehicle can be primary at a time."
          },
          "is_eligible_for_deletion": {
            "type": "boolean",
            "description": "Whether the vehicle can be deleted. A vehicle cannot be deleted if it has trips or is archived."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the vehicle was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the vehicle was last updated."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp when the vehicle was archived, or null if not archived."
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp when the vehicle was deleted, or null if not deleted."
          }
        },
        "required": [
          "id",
          "business_id",
          "make_and_model",
          "year",
          "is_primary",
          "is_eligible_for_deletion",
          "created_at",
          "updated_at"
        ]
      },
      "CreateVehicleParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An optional external identifier for the vehicle. If provided and a vehicle with this external_id already exists, the existing vehicle will be updated instead of creating a new one."
          },
          "make_and_model": {
            "type": "string",
            "description": "The make and model of the vehicle (e.g., 'Toyota Camry')."
          },
          "year": {
            "type": "integer",
            "description": "The model year of the vehicle."
          },
          "license_plate": {
            "type": "string",
            "nullable": true,
            "description": "The license plate number of the vehicle."
          },
          "vin": {
            "type": "string",
            "nullable": true,
            "description": "The Vehicle Identification Number (VIN)."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "An optional description or notes about the vehicle."
          },
          "is_primary": {
            "type": "boolean",
            "default": false,
            "description": "Whether this should be the primary vehicle. If true, any existing primary vehicle will be demoted."
          }
        },
        "required": [
          "make_and_model",
          "year"
        ]
      },
      "PatchVehicleParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An optional external identifier for the vehicle."
          },
          "make_and_model": {
            "type": "string",
            "description": "The make and model of the vehicle."
          },
          "year": {
            "type": "integer",
            "description": "The model year of the vehicle."
          },
          "license_plate": {
            "type": "string",
            "nullable": true,
            "description": "The license plate number of the vehicle."
          },
          "vin": {
            "type": "string",
            "nullable": true,
            "description": "The Vehicle Identification Number (VIN)."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "An optional description or notes about the vehicle."
          },
          "is_primary": {
            "type": "boolean",
            "description": "Whether this should be the primary vehicle."
          }
        },
        "description": "All fields are optional. Only provided fields will be updated."
      },
      "BulkCreateVehiclesRequest": {
        "type": "object",
        "properties": {
          "vehicles": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateVehicleParams"
            },
            "maxItems": 100,
            "description": "List of vehicles to create. Maximum of 100 vehicles per request."
          }
        },
        "required": [
          "vehicles"
        ]
      },
      "ApiTrip": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The unique identifier of the trip."
          },
          "vehicle": {
            "$ref": "#/components/schemas/ApiVehicle",
            "description": "The vehicle used for this trip."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An optional external identifier for the trip, used for idempotency."
          },
          "distance": {
            "type": "string",
            "description": "The distance traveled in miles, as a decimal string."
          },
          "distance_source": {
            "$ref": "#/components/schemas/TripDistanceSource",
            "description": "How the trip distance was determined."
          },
          "trip_date": {
            "type": "string",
            "format": "date",
            "description": "The date of the trip (YYYY-MM-DD)."
          },
          "purpose": {
            "$ref": "#/components/schemas/TripPurpose",
            "description": "The purpose classification of the trip."
          },
          "start_address": {
            "type": "string",
            "nullable": true,
            "description": "The starting address of the trip."
          },
          "end_address": {
            "type": "string",
            "nullable": true,
            "description": "The ending address of the trip."
          },
          "google_start_place_id": {
            "type": "string",
            "nullable": true,
            "description": "Google Maps place ID of the trip start address, from the address suggestion endpoints."
          },
          "google_end_place_id": {
            "type": "string",
            "nullable": true,
            "description": "Google Maps place ID of the trip end address, from the address suggestion endpoints."
          },
          "start_latitude": {
            "type": "string",
            "nullable": true,
            "description": "Latitude of the start address, as a decimal string."
          },
          "start_longitude": {
            "type": "string",
            "nullable": true,
            "description": "Longitude of the start address, as a decimal string."
          },
          "end_latitude": {
            "type": "string",
            "nullable": true,
            "description": "Latitude of the end address, as a decimal string."
          },
          "end_longitude": {
            "type": "string",
            "nullable": true,
            "description": "Longitude of the end address, as a decimal string."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "An optional description or notes about the trip."
          },
          "mileage_deduction_rate": {
            "type": "string",
            "description": "The IRS standard mileage rate in cents per mile applicable for the trip date."
          },
          "estimated_deduction": {
            "type": "integer",
            "format": "int64",
            "description": "The estimated tax deduction in cents. Only calculated for BUSINESS trips; returns 0 for PERSONAL and UNREVIEWED trips."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the trip was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the trip was last updated."
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp when the trip was deleted, or null if not deleted."
          }
        },
        "required": [
          "id",
          "vehicle",
          "distance",
          "distance_source",
          "trip_date",
          "purpose",
          "mileage_deduction_rate",
          "estimated_deduction",
          "created_at",
          "updated_at"
        ]
      },
      "CreateTripParams": {
        "type": "object",
        "properties": {
          "vehicle_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the vehicle used for this trip."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An optional external identifier for the trip. If provided and a trip with this external_id already exists, the existing trip will be updated instead of creating a new one."
          },
          "distance": {
            "type": "string",
            "description": "The distance traveled in miles, as a decimal string. Optional when both `google_start_place_id` and `google_end_place_id` are provided; the driving distance is then computed automatically. Providing a distance always takes precedence and marks the trip distance as `MANUAL`."
          },
          "trip_date": {
            "type": "string",
            "format": "date",
            "description": "The date of the trip (YYYY-MM-DD)."
          },
          "purpose": {
            "$ref": "#/components/schemas/TripPurpose",
            "default": "UNREVIEWED",
            "description": "The purpose classification of the trip."
          },
          "start_address": {
            "type": "string",
            "nullable": true,
            "description": "The starting address of the trip."
          },
          "end_address": {
            "type": "string",
            "nullable": true,
            "description": "The ending address of the trip."
          },
          "google_start_place_id": {
            "type": "string",
            "nullable": true,
            "description": "Google Maps place ID of the trip start address, from the address suggestion endpoints."
          },
          "google_end_place_id": {
            "type": "string",
            "nullable": true,
            "description": "Google Maps place ID of the trip end address, from the address suggestion endpoints."
          },
          "start_latitude": {
            "type": "string",
            "nullable": true,
            "description": "Latitude of the start address, as a decimal string."
          },
          "start_longitude": {
            "type": "string",
            "nullable": true,
            "description": "Longitude of the start address, as a decimal string."
          },
          "end_latitude": {
            "type": "string",
            "nullable": true,
            "description": "Latitude of the end address, as a decimal string."
          },
          "end_longitude": {
            "type": "string",
            "nullable": true,
            "description": "Longitude of the end address, as a decimal string."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "An optional description or notes about the trip."
          }
        },
        "required": [
          "vehicle_id",
          "trip_date"
        ]
      },
      "PatchTripParams": {
        "type": "object",
        "properties": {
          "vehicle_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the vehicle used for this trip."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An optional external identifier for the trip."
          },
          "distance": {
            "type": "string",
            "description": "The distance traveled in miles, as a decimal string. Providing a distance always takes precedence and marks the trip distance as `MANUAL`."
          },
          "trip_date": {
            "type": "string",
            "format": "date",
            "description": "The date of the trip (YYYY-MM-DD)."
          },
          "purpose": {
            "$ref": "#/components/schemas/TripPurpose",
            "description": "The purpose classification of the trip."
          },
          "start_address": {
            "type": "string",
            "nullable": true,
            "description": "The starting address of the trip."
          },
          "end_address": {
            "type": "string",
            "nullable": true,
            "description": "The ending address of the trip."
          },
          "google_start_place_id": {
            "type": "string",
            "nullable": true,
            "description": "Google Maps place ID of the trip start address, from the address suggestion endpoints."
          },
          "google_end_place_id": {
            "type": "string",
            "nullable": true,
            "description": "Google Maps place ID of the trip end address, from the address suggestion endpoints."
          },
          "start_latitude": {
            "type": "string",
            "nullable": true,
            "description": "Latitude of the start address, as a decimal string."
          },
          "start_longitude": {
            "type": "string",
            "nullable": true,
            "description": "Longitude of the start address, as a decimal string."
          },
          "end_latitude": {
            "type": "string",
            "nullable": true,
            "description": "Latitude of the end address, as a decimal string."
          },
          "end_longitude": {
            "type": "string",
            "nullable": true,
            "description": "Longitude of the end address, as a decimal string."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "An optional description or notes about the trip."
          }
        },
        "description": "All fields are optional. Only provided fields will be updated. If `google_start_place_id` or `google_end_place_id` change and no `distance` is provided, the driving distance is recomputed automatically; changing them to an incomplete pair without a distance returns a 400."
      },
      "BulkCreateTripsRequest": {
        "type": "object",
        "properties": {
          "trips": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateTripParams"
            },
            "maxItems": 100,
            "description": "List of trips to create. Maximum of 100 trips per request."
          }
        },
        "required": [
          "trips"
        ]
      },
      "ApiMileageMonth": {
        "type": "object",
        "properties": {
          "month": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12,
            "description": "The month number (1-12)."
          },
          "miles": {
            "type": "string",
            "description": "Total miles traveled in this month, as a decimal string."
          },
          "business_miles": {
            "type": "string",
            "description": "Total business miles traveled in this month, as a decimal string."
          },
          "personal_miles": {
            "type": "string",
            "description": "Total personal miles traveled in this month, as a decimal string."
          },
          "uncategorized_miles": {
            "type": "string",
            "description": "Total uncategorized/unreviewed miles traveled in this month, as a decimal string."
          },
          "estimated_deduction": {
            "type": "integer",
            "format": "int64",
            "description": "Estimated tax deduction for business miles in this month, in cents."
          },
          "trips": {
            "type": "integer",
            "description": "Total number of trips in this month."
          },
          "business_trips": {
            "type": "integer",
            "description": "Number of business trips in this month."
          },
          "personal_trips": {
            "type": "integer",
            "description": "Number of personal trips in this month."
          },
          "uncategorized_trips": {
            "type": "integer",
            "description": "Number of uncategorized/unreviewed trips in this month."
          },
          "deduction_rate": {
            "type": "integer",
            "format": "int64",
            "description": "The IRS standard mileage rate in cents per mile for this month."
          }
        },
        "required": [
          "month",
          "miles",
          "business_miles",
          "personal_miles",
          "uncategorized_miles",
          "estimated_deduction",
          "trips",
          "business_trips",
          "personal_trips",
          "uncategorized_trips",
          "deduction_rate"
        ]
      },
      "ApiMileageYear": {
        "type": "object",
        "properties": {
          "year": {
            "type": "integer",
            "description": "The year."
          },
          "miles": {
            "type": "string",
            "description": "Total miles traveled in this year, as a decimal string."
          },
          "business_miles": {
            "type": "string",
            "description": "Total business miles traveled in this year, as a decimal string."
          },
          "personal_miles": {
            "type": "string",
            "description": "Total personal miles traveled in this year, as a decimal string."
          },
          "uncategorized_miles": {
            "type": "string",
            "description": "Total uncategorized/unreviewed miles traveled in this year, as a decimal string."
          },
          "estimated_deduction": {
            "type": "integer",
            "format": "int64",
            "description": "Estimated tax deduction for business miles in this year, in cents."
          },
          "trips": {
            "type": "integer",
            "description": "Total number of trips in this year."
          },
          "business_trips": {
            "type": "integer",
            "description": "Number of business trips in this year."
          },
          "personal_trips": {
            "type": "integer",
            "description": "Number of personal trips in this year."
          },
          "uncategorized_trips": {
            "type": "integer",
            "description": "Number of uncategorized/unreviewed trips in this year."
          },
          "months": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiMileageMonth"
            },
            "description": "Monthly breakdown of mileage statistics for this year."
          }
        },
        "required": [
          "year",
          "miles",
          "business_miles",
          "personal_miles",
          "uncategorized_miles",
          "estimated_deduction",
          "trips",
          "business_trips",
          "personal_trips",
          "uncategorized_trips",
          "months"
        ]
      },
      "ApiMileageSummary": {
        "type": "object",
        "properties": {
          "years": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiMileageYear"
            },
            "description": "Yearly breakdown of mileage statistics, sorted by year descending."
          }
        },
        "required": [
          "years"
        ]
      },
      "ApiTaxOverview": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type.",
            "example": "Tax_Overview"
          },
          "year": {
            "type": "integer",
            "format": "int32",
            "description": "The tax year for this overview.",
            "example": 2025
          },
          "excludes_pending_transactions": {
            "type": "boolean",
            "description": "Whether pending transactions are excluded from the calculations."
          },
          "taxable_income_estimate": {
            "type": "integer",
            "format": "int64",
            "description": "Taxable income estimate to date, in cents."
          },
          "total_income": {
            "type": "integer",
            "format": "int64",
            "description": "Total business income, in cents."
          },
          "total_deductions": {
            "type": "integer",
            "format": "int64",
            "description": "Total deductions, in cents."
          },
          "estimated_taxes_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Total estimated tax liability, in cents."
          },
          "taxes_due_date": {
            "type": "string",
            "format": "date",
            "description": "Next tax deadline in ISO-8601 date format.",
            "example": "2025-04-15"
          }
        },
        "description": "High-level tax summary for dashboard display. Use GET /v1/businesses/{businessId}/tax-estimates/details for itemized breakdowns."
      },
      "ApiTaxDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type.",
            "example": "Tax_Details"
          },
          "year": {
            "type": "integer",
            "format": "int32",
            "description": "The tax year for this details breakdown.",
            "example": 2025
          },
          "filing_status": {
            "type": "string",
            "description": "Tax filing status.",
            "example": "SINGLE"
          },
          "adjusted_gross_income": {
            "$ref": "#/components/schemas/ApiAdjustedGrossIncome"
          },
          "taxes": {
            "$ref": "#/components/schemas/ApiTaxes"
          },
          "quarterly_estimates": {
            "$ref": "#/components/schemas/ApiQuarterlyEstimates"
          }
        },
        "description": "Detailed breakdown of tax calculations including adjusted gross income, deductions, and federal taxes."
      },
      "ApiQuarterlyEstimates": {
        "type": "object",
        "properties": {
          "q1": {
            "$ref": "#/components/schemas/ApiQuarterEstimate"
          },
          "q2": {
            "$ref": "#/components/schemas/ApiQuarterEstimate"
          },
          "q3": {
            "$ref": "#/components/schemas/ApiQuarterEstimate"
          },
          "q4": {
            "$ref": "#/components/schemas/ApiQuarterEstimate"
          }
        },
        "description": "Quarterly tax estimates breakdown."
      },
      "ApiQuarterEstimate": {
        "type": "object",
        "properties": {
          "us_federal": {
            "nullable": true,
            "$ref": "#/components/schemas/ApiQuarterFederalTax"
          },
          "us_state": {
            "nullable": true,
            "$ref": "#/components/schemas/ApiQuarterStateTax"
          }
        },
        "description": "Tax estimate for a single quarter including federal and state taxes."
      },
      "ApiQuarterFederalTax": {
        "type": "object",
        "properties": {
          "due_date": {
            "type": "string",
            "format": "date",
            "description": "Due date for this quarter's payment.",
            "example": "2025-04-15"
          },
          "owed": {
            "type": "integer",
            "format": "int64",
            "description": "Amount owed for this quarter, in cents."
          },
          "paid": {
            "type": "integer",
            "format": "int64",
            "description": "Amount already paid for this quarter, in cents."
          },
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "Remaining balance for this quarter (owed - paid), in cents."
          }
        },
        "description": "Federal tax details for a single quarter."
      },
      "ApiAdjustedGrossIncome": {
        "type": "object",
        "properties": {
          "income": {
            "$ref": "#/components/schemas/ApiIncome"
          },
          "deductions": {
            "$ref": "#/components/schemas/ApiDeductions"
          },
          "total_adjusted_gross_income": {
            "type": "integer",
            "format": "int64",
            "description": "Total adjusted gross income, in cents."
          }
        },
        "description": "Adjusted gross income breakdown including income and deductions."
      },
      "ApiIncome": {
        "type": "object",
        "properties": {
          "w2_income": {
            "type": "integer",
            "format": "int64",
            "description": "W-2 wage income, in cents."
          },
          "w2_withholding": {
            "type": "integer",
            "format": "int64",
            "description": "W-2 tax withholding, in cents."
          },
          "business_revenue": {
            "type": "integer",
            "format": "int64",
            "description": "Business revenue from Schedule C, in cents."
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "Total income, in cents."
          }
        },
        "description": "Income breakdown."
      },
      "ApiDeductions": {
        "type": "object",
        "properties": {
          "business_expenses": {
            "type": "integer",
            "format": "int64",
            "description": "Total business expenses, in cents."
          },
          "vehicle_expense": {
            "$ref": "#/components/schemas/ApiVehicleExpense"
          },
          "home_office": {
            "$ref": "#/components/schemas/ApiHomeOffice"
          },
          "qualified_tip_deduction": {
            "type": "integer",
            "format": "int64",
            "description": "Qualified tip income deduction, in cents."
          },
          "qualified_overtime_deduction": {
            "type": "integer",
            "format": "int64",
            "description": "Qualified overtime income deduction, in cents."
          },
          "self_employment_tax_deduction": {
            "type": "integer",
            "format": "int64",
            "description": "Deductible portion of self-employment tax, in cents."
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "Total deductions, in cents."
          }
        },
        "description": "Deductions breakdown."
      },
      "ApiVehicleExpense": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "description": "Vehicle expense calculation method.",
            "example": "MILEAGE"
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Vehicle expense deduction amount, in cents."
          }
        },
        "description": "Vehicle expense deduction details."
      },
      "ApiHomeOffice": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "description": "Home office deduction calculation method.",
            "example": "SIMPLIFIED"
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Home office deduction amount, in cents."
          }
        },
        "description": "Home office deduction details."
      },
      "ApiTaxes": {
        "type": "object",
        "properties": {
          "us_federal": {
            "nullable": true,
            "$ref": "#/components/schemas/ApiUsFederalTax"
          },
          "us_state": {
            "nullable": true,
            "$ref": "#/components/schemas/ApiUsStateTax"
          }
        },
        "description": "Tax calculations breakdown including federal and state taxes."
      },
      "ApiUsFederalTax": {
        "type": "object",
        "properties": {
          "federal_income_tax": {
            "$ref": "#/components/schemas/ApiFederalIncomeTax"
          },
          "social_security_tax": {
            "$ref": "#/components/schemas/ApiSocialSecurityTax"
          },
          "medicare_tax": {
            "$ref": "#/components/schemas/ApiMedicareTax"
          },
          "medicare_surtax": {
            "$ref": "#/components/schemas/ApiMedicareSurtax"
          },
          "total_federal_tax": {
            "$ref": "#/components/schemas/ApiTotalFederalTax"
          }
        },
        "description": "US Federal tax breakdown."
      },
      "ApiFederalIncomeTax": {
        "type": "object",
        "properties": {
          "federal_deductions": {
            "type": "integer",
            "format": "int64",
            "description": "Federal deductions (standard deduction), in cents."
          },
          "qualified_business_income_deduction": {
            "type": "integer",
            "format": "int64",
            "description": "Qualified Business Income (QBI) deduction, in cents."
          },
          "qbi_effective_rate": {
            "type": "string",
            "description": "Effective QBI deduction rate after phase-out.",
            "example": "0.20"
          },
          "taxable_income": {
            "type": "integer",
            "format": "int64",
            "description": "Taxable income after deductions, in cents."
          },
          "effective_federal_tax_rate": {
            "type": "string",
            "description": "Effective federal income tax rate.",
            "example": "0.22"
          },
          "federal_income_tax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Federal income tax owed, in cents."
          }
        },
        "description": "Federal income tax calculation details."
      },
      "ApiSocialSecurityTax": {
        "type": "object",
        "properties": {
          "social_security_income": {
            "type": "integer",
            "format": "int64",
            "description": "Income subject to Social Security tax, in cents."
          },
          "social_security_tax_rate": {
            "type": "string",
            "description": "Social Security tax rate.",
            "example": "0.124"
          },
          "social_security_tax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Social Security tax owed, in cents."
          }
        },
        "description": "Social Security tax calculation details."
      },
      "ApiMedicareTax": {
        "type": "object",
        "properties": {
          "medicare_income": {
            "type": "integer",
            "format": "int64",
            "description": "Income subject to Medicare tax, in cents."
          },
          "medicare_tax_rate": {
            "type": "string",
            "description": "Medicare tax rate.",
            "example": "0.029"
          },
          "medicare_tax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Medicare tax owed, in cents."
          }
        },
        "description": "Medicare tax calculation details."
      },
      "ApiMedicareSurtax": {
        "type": "object",
        "properties": {
          "medicare_surtax_income": {
            "type": "integer",
            "format": "int64",
            "description": "Income subject to Medicare surtax (above threshold), in cents."
          },
          "medicare_surtax_rate": {
            "type": "string",
            "description": "Medicare surtax rate (0.9% for high earners).",
            "example": "0.009"
          },
          "medicare_surtax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Medicare surtax owed, in cents."
          }
        },
        "description": "Medicare surtax calculation details for high earners."
      },
      "ApiTotalFederalTax": {
        "type": "object",
        "properties": {
          "federal_income_tax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Federal income tax owed, in cents."
          },
          "social_security_tax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Social Security tax owed, in cents."
          },
          "medicare_tax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Medicare tax owed, in cents."
          },
          "medicare_surtax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Medicare surtax owed, in cents."
          },
          "w2_withholdings": {
            "type": "integer",
            "format": "int64",
            "description": "W-2 tax withholdings already paid, in cents."
          },
          "total_federal_tax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Total federal tax owed after withholdings, in cents. Can be negative if refund is due."
          }
        },
        "description": "Total federal tax summary."
      },
      "ApiUsStateTax": {
        "type": "object",
        "properties": {
          "state_code": {
            "type": "string",
            "description": "Two-letter state code.",
            "example": "CA"
          },
          "state_name": {
            "type": "string",
            "description": "Full state name.",
            "example": "California"
          },
          "filing_status": {
            "type": "string",
            "description": "State tax filing status.",
            "example": "SINGLE"
          },
          "state_income_tax": {
            "$ref": "#/components/schemas/ApiStateIncomeTax"
          },
          "additional_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiStateAdditionalTax"
            },
            "description": "Additional state-specific taxes (e.g., SDI, mental health tax)."
          },
          "total_state_tax": {
            "$ref": "#/components/schemas/ApiTotalStateTax"
          }
        },
        "description": "US State tax breakdown."
      },
      "ApiStateIncomeTax": {
        "type": "object",
        "properties": {
          "state_agi": {
            "type": "integer",
            "format": "int64",
            "description": "State adjusted gross income, in cents."
          },
          "state_deductions": {
            "type": "integer",
            "format": "int64",
            "description": "State deductions (standard or itemized), in cents."
          },
          "state_taxable_income": {
            "type": "integer",
            "format": "int64",
            "description": "State taxable income after deductions, in cents."
          },
          "effective_state_tax_rate": {
            "type": "string",
            "description": "Effective state income tax rate.",
            "example": "0.093"
          },
          "state_income_tax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "State income tax owed, in cents."
          }
        },
        "description": "State income tax calculation details."
      },
      "ApiStateAdditionalTax": {
        "type": "object",
        "properties": {
          "tax_name": {
            "type": "string",
            "description": "Name of the additional tax.",
            "example": "CA SDI"
          },
          "tax_rate": {
            "type": "string",
            "description": "Tax rate for this additional tax.",
            "example": "0.011"
          },
          "taxable_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount subject to this tax, in cents."
          },
          "tax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of this additional tax owed, in cents."
          }
        },
        "description": "Additional state-specific tax details."
      },
      "ApiTotalStateTax": {
        "type": "object",
        "properties": {
          "state_income_tax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "State income tax owed, in cents."
          },
          "additional_taxes_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Total additional state taxes owed, in cents."
          },
          "state_withholdings": {
            "type": "integer",
            "format": "int64",
            "description": "State tax withholdings already paid, in cents."
          },
          "total_state_tax_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Total state tax owed after withholdings, in cents. Can be negative if refund is due."
          }
        },
        "description": "Total state tax summary."
      },
      "ApiQuarterStateTax": {
        "type": "object",
        "properties": {
          "state_code": {
            "type": "string",
            "description": "Two-letter state code.",
            "example": "CA"
          },
          "due_date": {
            "type": "string",
            "format": "date",
            "description": "Due date for this quarter's state payment.",
            "example": "2025-04-15"
          },
          "owed": {
            "type": "integer",
            "format": "int64",
            "description": "State tax amount owed for this quarter, in cents."
          },
          "paid": {
            "type": "integer",
            "format": "int64",
            "description": "State tax amount already paid for this quarter, in cents."
          },
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "Remaining state tax balance for this quarter (owed - paid), in cents."
          }
        },
        "description": "State tax details for a single quarter."
      },
      "ApiTaxChecklist": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type.",
            "example": "Tax_Checklist"
          },
          "year": {
            "type": "integer",
            "format": "int32",
            "description": "The tax year for this checklist.",
            "example": 2025
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxChecklistItem"
            },
            "description": "List of actionable items requiring attention."
          }
        },
        "description": "Actionable items that need user attention for tax preparation."
      },
      "TaxChecklistItem": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "UNCATEGORIZED_DEDUCTIONS",
              "UNCATEGORIZED_DEPOSITS",
              "MISSING_PROFILE"
            ],
            "description": "The type of checklist item.",
            "example": "UNCATEGORIZED_DEDUCTIONS"
          },
          "description": {
            "type": "string",
            "description": "Human-readable description of the item."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Associated amount in cents, if applicable."
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Number of items, if applicable."
          },
          "action_url": {
            "type": "string",
            "nullable": true,
            "description": "Deep link URL to resolve this item."
          }
        },
        "description": "A single actionable item in the tax checklist."
      },
      "ApiTaxEstimates": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type.",
            "example": "Tax_Estimates"
          },
          "country": {
            "type": "string",
            "pattern": "^[A-Z]{2}$",
            "nullable": true,
            "description": "The ISO 3166-1 alpha-2 country code.",
            "example": "US"
          },
          "state": {
            "type": "string",
            "pattern": "^[A-Z]{2}$",
            "nullable": true,
            "description": "The two-character state (or Province) abbreviation for which tax needs to be calculated on.",
            "example": "CA"
          },
          "year": {
            "type": "integer",
            "format": "int32",
            "description": "Tax year for which tax needs to be calculated on.",
            "example": 2025
          },
          "us_estimates": {
            "$ref": "#/components/schemas/UsTaxEstimates",
            "nullable": true
          },
          "ca_estimates": {
            "type": "object",
            "nullable": true,
            "description": "Canadian-specific tax estimates (future use)."
          }
        },
        "description": "Tax estimate summary for a business."
      },
      "UsTaxEstimates": {
        "type": "object",
        "nullable": true,
        "description": "US-specific tax estimates with inputs and results.",
        "properties": {
          "inputs": {
            "type": "object",
            "nullable": true,
            "description": "Input values used for tax calculation.",
            "properties": {
              "federal_filing_status": {
                "type": "string",
                "enum": [
                  "SINGLE",
                  "MARRIED",
                  "MARRIED_SEPARATELY",
                  "HEAD",
                  "WIDOWER"
                ],
                "nullable": true,
                "description": "The tax filing status code at the federal level."
              },
              "state_filing_status": {
                "type": "string",
                "enum": [
                  "SINGLE",
                  "MARRIED",
                  "MARRIED_SEPARATELY",
                  "HEAD",
                  "WIDOWER"
                ],
                "nullable": true,
                "description": "The tax filing status code at the state level."
              },
              "w2_income": {
                "type": "number",
                "format": "double",
                "nullable": true,
                "description": "The year-to-date W2 income total for which tax needs to be calculated on."
              },
              "business_income": {
                "type": "number",
                "format": "double",
                "nullable": true,
                "description": "The year-to-date business income for which tax needs to be calculated on."
              },
              "other_income": {
                "type": "number",
                "format": "double",
                "nullable": true,
                "description": "Total taxable income from sources other than wages, tips, and business."
              },
              "expenses": {
                "type": "number",
                "format": "double",
                "nullable": true,
                "description": "The year-to-date actual expense total (deductible and non-deductible) for P&L purposes."
              },
              "deductible_expenses": {
                "type": "number",
                "format": "double",
                "nullable": true,
                "description": "The year-to-date deductible expense total for which tax needs to be calculated on."
              },
              "deductible_mileage_expenses": {
                "type": "number",
                "format": "double",
                "nullable": true,
                "description": "The year-to-date deductible expense total originating from mileage."
              },
              "deductible_non_mileage_expenses": {
                "type": "number",
                "format": "double",
                "nullable": true,
                "description": "The year-to-date deductible expense total not originating from mileage."
              }
            }
          },
          "results": {
            "type": "object",
            "nullable": true,
            "description": "High-level summary of tax results across federal and state.",
            "properties": {
              "overall_tax": {
                "type": "number",
                "format": "double",
                "nullable": true,
                "description": "Total tax amount (federal + state + self-employment)."
              },
              "overall_tax_savings": {
                "type": "number",
                "format": "double",
                "nullable": true,
                "description": "Total amount saved by tracking expenses."
              },
              "overall_tax_unpaid": {
                "type": "number",
                "format": "double",
                "nullable": true,
                "description": "Total remaining tax amount to be paid (federal + state)."
              },
              "annual_payment_due_date": {
                "type": "string",
                "format": "date-time",
                "nullable": true,
                "description": "Yearly due date for this year's tax season."
              },
              "after_tax_income": {
                "type": "number",
                "format": "double",
                "nullable": true,
                "description": "Income remaining after all taxes collected."
              }
            }
          },
          "federal_tax": {
            "$ref": "#/components/schemas/UsFederalTaxEstimate"
          },
          "state_tax": {
            "$ref": "#/components/schemas/UsStateTaxEstimate"
          },
          "quarterly_estimates": {
            "$ref": "#/components/schemas/UsQuarterlyEstimates"
          }
        }
      },
      "TaxAmount": {
        "type": "object",
        "properties": {
          "owed": {
            "type": "integer",
            "format": "int64",
            "description": "Amount owed, in cents."
          },
          "paid": {
            "type": "integer",
            "format": "int64",
            "description": "Amount already paid, in cents."
          }
        },
        "description": "Tax amount with owed and paid breakdown."
      },
      "TaxDeadline": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "description": "Deadline date in ISO-8601 format.",
            "example": "2025-04-15"
          },
          "description": {
            "type": "string",
            "description": "Description of the deadline.",
            "example": "Q1 estimated tax due"
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount due by this deadline, in cents."
          }
        },
        "description": "A tax deadline with date, description, and amount."
      },
      "UsFederalTaxEstimate": {
        "type": "object",
        "nullable": true,
        "description": "US Federal tax estimate details.",
        "properties": {
          "w2_marginal_tax_rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Marginal tax rate for W-2 income."
          },
          "business_marginal_tax_rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Marginal tax rate for self-employed income."
          },
          "adjusted_gross_income": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Adjusted gross income."
          },
          "business_income_deduction": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Deduction amount applied to business income."
          },
          "business_income_deduction_effective_rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Effective rate of deduction applied to business income."
          },
          "federal_deduction": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Deduction amount applied to federal taxes."
          },
          "qualified_tip_deduction": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Qualified tip deduction."
          },
          "qualified_overtime_deduction": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Qualified overtime deduction."
          },
          "taxable_income": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Federal taxable income."
          },
          "federal_effective_tax_rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Effective tax rate on federal taxable income."
          },
          "federal_tax_amount": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Tax on federal taxable income."
          },
          "medicare_surtax": {
            "$ref": "#/components/schemas/MedicareSurtaxEstimate"
          },
          "self_employment_tax": {
            "$ref": "#/components/schemas/SelfEmploymentTaxEstimate"
          },
          "employment_tax": {
            "$ref": "#/components/schemas/EmploymentTaxEstimate"
          },
          "alternative_minimum_tax": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Alternative minimum tax."
          },
          "tax_amount_without_tax_credit": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Federal tax amount prior to any tax credits being applied."
          },
          "dependent_tax_credit": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Total amount of federal dependent tax credits that the user qualifies for."
          },
          "total_tax_credit": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Total of all federal tax credits that the user qualifies for."
          },
          "total_tax_credit_applied_to_tax": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Total of all federal tax credits applied."
          },
          "tax_before_withholding": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Total taxes due federally before withholding is applied."
          },
          "effective_tax_rate_before_withholding": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Effective tax rate from all taxes due federally before withholding is applied including medicare and social security."
          },
          "withholding_applied_to_tax": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Amount of withholding applied to taxes."
          },
          "tax_amount": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Total taxes due federally."
          },
          "tax_unpaid": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Remaining federal tax amount to be paid (after withholding and payments)."
          },
          "effective_tax_rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Effective tax rate from all taxes due federally including medicare and social security."
          }
        }
      },
      "UsStateTaxEstimate": {
        "type": "object",
        "nullable": true,
        "description": "US State tax estimate details.",
        "properties": {
          "w2_marginal_tax_rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Marginal tax rate for W-2 income."
          },
          "business_marginal_tax_rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Marginal tax rate for self-employed income."
          },
          "adjusted_gross_income": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Adjusted gross income."
          },
          "state_deduction": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Deduction amount applied to state taxes."
          },
          "taxable_income": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "State taxable income."
          },
          "pre_credit_effective_tax_rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Effective tax rate before any credits are applied."
          },
          "tax_amount_without_tax_credit": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "State tax amount prior to any tax credits being applied."
          },
          "total_tax_credit": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Total of all state tax credits that the user qualifies for."
          },
          "total_tax_credit_applied_to_tax": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Total of all state tax credits applied."
          },
          "tax_before_withholding": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Taxes due to the state before withholding."
          },
          "effective_tax_rate_before_withholding": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Effective tax rate of taxes due to the state before withholding."
          },
          "withholding_applied_to_tax": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Amount of withholding applied to taxes."
          },
          "tax_amount": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Total taxes due to the state."
          },
          "tax_unpaid": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Remaining state tax amount to be paid (after withholding and payments)."
          },
          "effective_tax_rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Effective tax rate of taxes due to the state."
          }
        }
      },
      "ApiTaxPayments": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type.",
            "example": "Tax_Payments"
          },
          "year": {
            "type": "integer",
            "format": "int32",
            "description": "The tax year for these payments.",
            "example": 2025
          },
          "quarters": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TaxPaymentQuarter"
            },
            "description": "Quarterly payment breakdown."
          }
        },
        "description": "Quarterly tax payment history and tracking."
      },
      "TaxPaymentQuarter": {
        "type": "object",
        "properties": {
          "quarter": {
            "type": "integer",
            "format": "int32",
            "minimum": 1,
            "maximum": 4,
            "description": "Quarter number (1-4)."
          },
          "owed_rolled_over_from_previous": {
            "type": "integer",
            "format": "int64",
            "description": "Amount owed rolled over from previous quarter, in cents. Positive means still owed, negative means overpaid."
          },
          "owed_this_quarter": {
            "type": "integer",
            "format": "int64",
            "description": "Amount owed this quarter, in cents."
          },
          "total_paid": {
            "type": "integer",
            "format": "int64",
            "description": "Total amount paid this quarter, in cents."
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "Net balance for the quarter, in cents."
          }
        },
        "description": "Tax payment information for a single quarter."
      },
      "UsQuarterlyEstimates": {
        "type": "object",
        "nullable": true,
        "description": "US quarterly tax estimates.",
        "properties": {
          "q1": {
            "$ref": "#/components/schemas/QuarterlyEstimate"
          },
          "q2": {
            "$ref": "#/components/schemas/QuarterlyEstimate"
          },
          "q3": {
            "$ref": "#/components/schemas/QuarterlyEstimate"
          },
          "q4": {
            "$ref": "#/components/schemas/QuarterlyEstimate"
          }
        }
      },
      "QuarterlyEstimate": {
        "type": "object",
        "nullable": true,
        "description": "Tax estimate for a single quarter.",
        "properties": {
          "due_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Due date for this quarter's payment."
          },
          "federal_tax": {
            "$ref": "#/components/schemas/QuarterlyTaxAmount"
          },
          "state_tax": {
            "$ref": "#/components/schemas/QuarterlyTaxAmount"
          }
        }
      },
      "QuarterlyTaxAmount": {
        "type": "object",
        "nullable": true,
        "description": "Tax amount details for a quarter.",
        "properties": {
          "amount": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Tax amount for this quarter."
          },
          "paid": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Amount already paid for this quarter."
          },
          "remaining": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Remaining amount due for this quarter."
          }
        }
      },
      "MedicareSurtaxEstimate": {
        "type": "object",
        "nullable": true,
        "description": "Medicare surtax estimate details.",
        "properties": {
          "amount": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Medicare surtax amount."
          },
          "rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Medicare surtax rate."
          }
        }
      },
      "SelfEmploymentTaxEstimate": {
        "type": "object",
        "nullable": true,
        "description": "Self-employment tax estimate details.",
        "properties": {
          "amount": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Self-employment tax amount."
          },
          "rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Self-employment tax rate."
          },
          "social_security_tax": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Social security portion of self-employment tax."
          },
          "medicare_tax": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Medicare portion of self-employment tax."
          }
        }
      },
      "EmploymentTaxEstimate": {
        "type": "object",
        "nullable": true,
        "description": "Employment tax estimate details.",
        "properties": {
          "social_security_taxable_income": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Taxable income for social security."
          },
          "social_security_effective_tax_rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Social security effective tax rate."
          },
          "social_security_tax": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Social security tax estimate paid by employer."
          },
          "medicare_taxable_income": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Taxable income for medicare."
          },
          "medicare_effective_tax_rate": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Medicare effective tax rate."
          },
          "medicare_tax": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Medicare tax estimate paid by employer."
          },
          "tax_amount": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Overall employment tax amount."
          }
        }
      },
      "ApiTaxProfile": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type.",
            "example": "Tax_Profile"
          },
          "tax_country_code": {
            "type": "string",
            "pattern": "^[A-Z]{2}$",
            "nullable": true,
            "description": "The ISO 3166-1 alpha-2 country code.",
            "example": "US"
          },
          "us_configuration": {
            "type": "object",
            "nullable": true,
            "description": "US-specific tax configuration.",
            "properties": {
              "federal": {
                "type": "object",
                "nullable": true,
                "description": "Federal tax configuration.",
                "properties": {
                  "filing_status": {
                    "type": "string",
                    "enum": [
                      "SINGLE",
                      "MARRIED",
                      "MARRIED_SEPARATELY",
                      "HEAD",
                      "WIDOWER"
                    ],
                    "nullable": true,
                    "description": "The Tax Federal Filing Status."
                  },
                  "annual_w2_income": {
                    "type": "integer",
                    "format": "int64",
                    "nullable": true,
                    "description": "The annual W-2 income total for which tax needs to be calculated on, in cents."
                  },
                  "tip_income": {
                    "type": "integer",
                    "format": "int64",
                    "nullable": true,
                    "description": "The year-to-date amount of W-2 income that the filer has earned from tips, in cents."
                  },
                  "overtime_income": {
                    "type": "integer",
                    "format": "int64",
                    "nullable": true,
                    "description": "The year-to-date amount of W-2 income that the filer has earned from overtime, in cents."
                  },
                  "withholding": {
                    "type": "object",
                    "nullable": true,
                    "description": "Federal withholding configuration.",
                    "properties": {
                      "use_custom_withholding": {
                        "type": "boolean",
                        "nullable": true,
                        "description": "Should be set to true if the user wants to specify their own W-2 Withholding amounts.",
                        "example": true
                      },
                      "amount": {
                        "type": "integer",
                        "format": "int64",
                        "nullable": true,
                        "description": "Federal W-2 Withholding amount, if the user wants to specify their own custom amount, in cents."
                      }
                    }
                  }
                }
              },
              "state": {
                "type": "object",
                "nullable": true,
                "description": "State tax configuration.",
                "properties": {
                  "tax_state": {
                    "type": "string",
                    "pattern": "^[A-Z]{2}$",
                    "nullable": true,
                    "description": "The two-character State (or Province) abbreviation for which tax needs to be calculated on.",
                    "example": "CA"
                  },
                  "filing_status": {
                    "type": "string",
                    "enum": [
                      "SINGLE",
                      "MARRIED",
                      "MARRIED_SEPARATELY",
                      "HEAD",
                      "WIDOWER"
                    ],
                    "nullable": true,
                    "description": "The Tax State Filing Status."
                  },
                  "num_exemptions": {
                    "type": "integer",
                    "format": "int32",
                    "nullable": true,
                    "description": "The number of state personal exemptions the tax filer qualifies for."
                  },
                  "withholding": {
                    "type": "object",
                    "nullable": true,
                    "description": "State withholding configuration.",
                    "properties": {
                      "use_custom_withholding": {
                        "type": "boolean",
                        "nullable": true,
                        "description": "Should be set to true if the user wants to specify their own W-2 Withholding amounts.",
                        "example": true
                      },
                      "amount": {
                        "type": "integer",
                        "format": "int64",
                        "nullable": true,
                        "description": "State W-2 Withholding amount, if the user wants to specify their own custom amount, in cents."
                      }
                    }
                  }
                }
              },
              "deductions": {
                "type": "object",
                "nullable": true,
                "description": "Tax deductions configuration.",
                "properties": {
                  "home_office": {
                    "type": "object",
                    "nullable": true,
                    "description": "Home office deduction configuration.",
                    "properties": {
                      "use_home_office_deduction": {
                        "type": "boolean",
                        "nullable": true,
                        "description": "If the user wants to use the Simplified Home Office Deduction, this should be set to true.",
                        "example": true
                      },
                      "home_office_area": {
                        "type": "number",
                        "format": "double",
                        "nullable": true,
                        "description": "Size of home office in sq. ft; required if using the Simplified Home Office Deduction."
                      }
                    }
                  },
                  "vehicle": {
                    "type": "object",
                    "nullable": true,
                    "description": "Vehicle and mileage deduction configuration.",
                    "properties": {
                      "use_mileage_deduction": {
                        "type": "boolean",
                        "nullable": true,
                        "description": "The IRS dictates that you can only use the Standard Mileage Rate or Actual Auto Expenses. Set this to true if the user will be using the Standard Mileage Rate.",
                        "example": false
                      },
                      "vehicle_business_percent": {
                        "type": "number",
                        "format": "double",
                        "nullable": true,
                        "description": "Canadian users can provide their own business vehicle percentage (instead of using the mileage numbers to determine percentage)."
                      },
                      "mileage": {
                        "type": "object",
                        "nullable": true,
                        "description": "Mileage estimation configuration.",
                        "properties": {
                          "use_user_estimated_business_mileage": {
                            "type": "boolean",
                            "nullable": true,
                            "description": "If the user wants to use their own annual business mileage estimate, this should be set to true."
                          },
                          "user_estimated_business_mileage": {
                            "type": "number",
                            "format": "double",
                            "nullable": true,
                            "description": "Annual business mileage estimate, in miles; required if using user-estimated business mileage."
                          }
                        }
                      }
                    }
                  }
                }
              },
              "business_estimates": {
                "type": "object",
                "nullable": true,
                "description": "Business income and expense estimates.",
                "properties": {
                  "expenses": {
                    "type": "object",
                    "nullable": true,
                    "description": "Business expense estimates.",
                    "properties": {
                      "use_user_estimated_business_expenses": {
                        "type": "boolean",
                        "nullable": true,
                        "description": "If the user wants to use their own annual business expenses estimate, this should be set to true."
                      },
                      "user_estimated_business_expenses": {
                        "type": "integer",
                        "format": "int64",
                        "nullable": true,
                        "description": "Annual business expenses estimate in cents, required if using user-estimated business expenses."
                      }
                    }
                  },
                  "revenue": {
                    "type": "object",
                    "nullable": true,
                    "description": "Business revenue estimates.",
                    "properties": {
                      "use_user_estimated_business_revenue": {
                        "type": "boolean",
                        "nullable": true,
                        "description": "If the user wants to use their own annual business income estimate, this should be set to true."
                      },
                      "user_estimated_business_revenue": {
                        "type": "integer",
                        "format": "int64",
                        "nullable": true,
                        "description": "Annual business income estimate in cents, required if using user-estimated business income."
                      }
                    }
                  }
                }
              }
            }
          },
          "ca_configuration": {
            "type": "object",
            "nullable": true,
            "description": "Canadian-specific tax configuration (future use)."
          },
          "user_has_saved_tax_profile": {
            "type": "boolean",
            "description": "Whether the user has explicitly saved their tax profile configuration."
          }
        },
        "description": "Tax profile configuration for a business."
      },
      "ApiTaxSummary": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type.",
            "example": "Tax_Summary"
          },
          "year": {
            "type": "integer",
            "description": "The tax year for this summary.",
            "example": 2024
          },
          "projected_taxes_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Total projected taxes owed in cents (federal + state)."
          },
          "taxes_due_at": {
            "type": "string",
            "format": "date",
            "description": "Date when the next quarterly estimated tax payment is due.",
            "example": "2024-04-15"
          },
          "uncategorized_tax_payments": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of tax payments that have not been categorized as federal or state in cents."
          },
          "sections": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTaxSummarySection"
            },
            "description": "Breakdown of taxes by component (federal income & self-employment tax, state income tax)."
          }
        },
        "required": [
          "year",
          "projected_taxes_owed",
          "taxes_due_at",
          "uncategorized_tax_payments",
          "sections"
        ],
        "description": "Summary of projected taxes owed with breakdown by federal and state components."
      },
      "ApiTaxSummarySection": {
        "type": "object",
        "properties": {
          "label": {
            "type": "string",
            "description": "Display label for this tax component.",
            "example": "Federal Income & Self-Employment Tax"
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "Total tax amount for this component in cents (before subtracting payments)."
          },
          "taxes_paid": {
            "type": "integer",
            "format": "int64",
            "description": "Amount already paid towards this tax component in cents."
          },
          "taxes_owed": {
            "type": "integer",
            "format": "int64",
            "description": "Remaining amount owed for this tax component in cents (total - taxes_paid)."
          }
        },
        "required": [
          "label",
          "total",
          "taxes_paid",
          "taxes_owed"
        ],
        "description": "Breakdown of a single tax component (federal or state) showing total, paid, and owed amounts."
      },
      "TaxExportType": {
        "type": "string",
        "enum": [
          "TAX_PACKET",
          "SCHEDULE_C",
          "PAYMENT_HISTORY"
        ],
        "description": "Type of tax document to export.",
        "example": "TAX_PACKET"
      },
      "ApiUnifiedReport": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be 'Unified_Report'.",
            "example": "Unified_Report"
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the business this report belongs to."
          },
          "columns": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UnifiedReportColumn"
            },
            "description": "The column headers for the report. Columns can be nested to represent hierarchical dimensions (e.g., Location > Month)."
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UnifiedReportRow"
            },
            "description": "The data rows for the report. Rows can be nested to represent hierarchical account structures."
          }
        },
        "description": "A unified report structure that supports hierarchical columns and rows. Used for balance sheets, cashflow statements, profit & loss reports, and aging reports with flexible dimensional breakdowns."
      },
      "UnifiedReportColumn": {
        "type": "object",
        "properties": {
          "column_key": {
            "type": "string",
            "description": "Unique identifier for this column. Used as the key in row cell mappings.",
            "example": "amount"
          },
          "display_name": {
            "type": "string",
            "description": "Human-readable name for the column header.",
            "example": "Amount"
          },
          "columns": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UnifiedReportColumn"
            },
            "description": "Nested child columns. When present, this column acts as a group header."
          }
        },
        "description": "A column header in a unified report. Supports nesting for multi-dimensional reports."
      },
      "UnifiedReportRow": {
        "type": "object",
        "properties": {
          "row_key": {
            "type": "string",
            "description": "Unique identifier for this row.",
            "example": "revenue"
          },
          "display_name": {
            "type": "string",
            "description": "Human-readable name for the row (e.g., account name, category name).",
            "example": "Revenue"
          },
          "cells": {
            "type": "object",
            "additionalProperties": {
              "$ref": "#/components/schemas/UnifiedReportCell"
            },
            "description": "Cell values keyed by column_key. Each entry maps a column to its cell value for this row."
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UnifiedReportRow"
            },
            "description": "Nested child rows. Used for hierarchical account structures (e.g., parent accounts with sub-accounts)."
          }
        },
        "description": "A data row in a unified report. Supports nesting for hierarchical data structures."
      },
      "UnifiedReportCell": {
        "type": "object",
        "properties": {
          "value": {
            "$ref": "#/components/schemas/UnifiedCellValue",
            "description": "The cell's value, which can be an amount or empty."
          }
        },
        "description": "A single cell value in a unified report row."
      },
      "UnifiedCellValue": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "Amount"
                ],
                "description": "Indicates this is an amount value."
              },
              "value": {
                "type": "integer",
                "format": "int64",
                "description": "The amount in cents (e.g., 10000 = $100.00)."
              }
            },
            "required": [
              "type",
              "value"
            ],
            "example": {
              "type": "Amount",
              "value": 10000
            }
          },
          {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "Empty"
                ],
                "description": "Indicates this cell has no value."
              }
            },
            "required": [
              "type"
            ],
            "example": {
              "type": "Empty"
            }
          }
        ],
        "description": "The value of a cell in a unified report. Can be either an Amount (with value in cents) or Empty.",
        "example": {
          "type": "Amount",
          "value": 10000
        }
      },
      "BulkDeleteRequest": {
        "type": "object",
        "required": [
          "ids"
        ],
        "properties": {
          "ids": {
            "type": "array",
            "description": "List of UUIDs to delete (max 100).",
            "items": {
              "type": "string",
              "format": "uuid"
            },
            "maxItems": 100,
            "minItems": 1
          }
        }
      },
      "BulkDeleteResponse": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `BulkDeleteResponse`.",
            "example": "BulkDeleteResponse"
          },
          "deleted_count": {
            "type": "integer",
            "description": "Number of items deleted."
          }
        }
      },
      "BatchCreateInvoiceFailure": {
        "type": "object",
        "description": "Details about a single invoice that failed to be created in a batch request.",
        "properties": {
          "code": {
            "type": "string",
            "description": "Machine-readable error code for the failure. Uses the same values as the `error_enum` field in standard error responses (e.g. `SpecifiedIdNotFound`, `SpecifiedBadRequest`). Null for unexpected internal errors.",
            "nullable": true
          },
          "message": {
            "type": "string",
            "description": "Human-readable description of why this invoice failed."
          }
        },
        "required": [
          "message"
        ]
      },
      "BatchCreateInvoicesResponse": {
        "type": "object",
        "description": "Response from the batch invoice creation endpoint, containing both successful and failed invoices.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `BatchCreateInvoicesResponse`.",
            "example": "BatchCreateInvoicesResponse"
          },
          "successful_invoices": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiInvoice"
            },
            "description": "Invoices that were successfully created."
          },
          "failed_invoices": {
            "type": "object",
            "description": "Map of failed invoices keyed by an identifier derived from the invoice's `external_id`, `reference_number`, or `unknown-N` if neither is present. When two failed invoices share the same base key, subsequent entries are suffixed with `#1`, `#2`, etc.",
            "additionalProperties": {
              "$ref": "#/components/schemas/BatchCreateInvoiceFailure"
            }
          }
        },
        "required": [
          "successful_invoices",
          "failed_invoices"
        ]
      },
      "DedicatedInvoicePaymentInput": {
        "type": "object",
        "required": [
          "method",
          "amount"
        ],
        "properties": {
          "external_id": {
            "type": "string",
            "description": "External identifier for the payment."
          },
          "paid_at": {
            "type": "string",
            "format": "date-time",
            "description": "The timestamp when the payment was made."
          },
          "method": {
            "type": "string",
            "enum": [
              "CREDIT_CARD",
              "CASH",
              "CHECK",
              "ACH",
              "CREDIT_BALANCE",
              "OTHER"
            ],
            "description": "Payment method.",
            "example": "CREDIT_CARD"
          },
          "fee": {
            "type": "integer",
            "description": "Fee amount in cents."
          },
          "additional_fees": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreatePaymentFeeParams"
            }
          },
          "amount": {
            "type": "integer",
            "description": "Payment amount in cents."
          },
          "processor": {
            "type": "string",
            "description": "Payment processor name."
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier"
          },
          "redemption_account": {
            "$ref": "#/components/schemas/AccountIdentifier"
          },
          "dedicated_refunds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateDedicatedRefundParams"
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            }
          },
          "memo": {
            "type": "string"
          },
          "metadata": {
            "type": "object"
          },
          "reference_number": {
            "type": "string"
          }
        }
      },
      "ApiService": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The unique identifier of the service."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the business this service belongs to."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An optional external identifier for the service, used for idempotency."
          },
          "name": {
            "type": "string",
            "description": "The name of the service."
          },
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "The ledger account identifier for revenue tracking."
          },
          "ledger_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "nullable": true,
            "description": "The ledger account associated with this service."
          },
          "billable_rate_per_minute_amount": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "The billable rate per minute for this service in cents (e.g., 100 = $1.00 per minute or $60.00 per hour)."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Optional memo or notes about the service."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Custom metadata for the service."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the service was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the service was last updated."
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp when the service was deleted, or null if not deleted."
          }
        },
        "required": [
          "id",
          "business_id",
          "name",
          "created_at",
          "updated_at"
        ]
      },
      "CreateServiceParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An optional external identifier for the service. If provided and a service with this external_id already exists, the existing service will be updated instead of creating a new one."
          },
          "name": {
            "type": "string",
            "description": "The name of the service."
          },
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "The ledger account identifier for revenue tracking."
          },
          "billable_rate_per_minute_amount": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "The billable rate per minute for this service in cents (e.g., 100 = $1.00 per minute or $60.00 per hour)."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Optional memo or notes about the service."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Custom metadata for the service."
          }
        },
        "required": [
          "name"
        ]
      },
      "PatchServiceParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Update the external identifier for the service."
          },
          "name": {
            "type": "string",
            "description": "Update the name of the service."
          },
          "account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "nullable": true,
            "description": "Update the ledger account identifier. Set to null to remove the account association."
          },
          "billable_rate_per_minute_amount": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Update the billable rate per minute in cents."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Update the memo."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Update the custom metadata."
          }
        },
        "description": "Partial update parameters for a service. Only specified fields will be updated."
      },
      "ApiTimeEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The unique identifier of the time entry."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the business this time entry belongs to."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An optional external identifier for the time entry."
          },
          "service": {
            "$ref": "#/components/schemas/ApiService",
            "description": "The service this time entry is associated with."
          },
          "customer": {
            "$ref": "#/components/schemas/ApiCustomerData",
            "nullable": true,
            "description": "The customer this time entry is billed to (optional)."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "The date the work was performed."
          },
          "duration_minutes": {
            "type": "integer",
            "description": "Duration of the time entry in minutes."
          },
          "billable": {
            "type": "boolean",
            "description": "Whether this time entry is billable."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description of the work performed."
          },
          "invoice_line_item_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The invoice line item ID if this time entry has been invoiced."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Optional memo or notes."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Custom metadata."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the time entry was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp when the time entry was last updated."
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp when deleted, or null if not deleted."
          }
        },
        "required": [
          "id",
          "business_id",
          "service",
          "date",
          "duration_minutes",
          "billable",
          "created_at",
          "updated_at"
        ]
      },
      "CreateTimeEntryParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "An optional external identifier. If provided and a time entry with this external_id already exists, the existing entry will be updated."
          },
          "service_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the service. Either service_id or service_external_id must be provided."
          },
          "service_external_id": {
            "type": "string",
            "description": "The external ID of the service. Either service_id or service_external_id must be provided."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The UUID of the customer to bill (optional)."
          },
          "customer_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external ID of the customer to bill (optional)."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "The date the work was performed."
          },
          "duration_minutes": {
            "type": "integer",
            "description": "Duration of the time entry in minutes."
          },
          "billable": {
            "type": "boolean",
            "default": false,
            "description": "Whether this time entry is billable."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Description of the work performed."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Optional memo or notes."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Custom metadata."
          }
        },
        "required": [
          "date",
          "duration_minutes"
        ]
      },
      "PatchTimeEntryParams": {
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Update the external identifier."
          },
          "service_id": {
            "type": "string",
            "format": "uuid",
            "description": "Update the associated service."
          },
          "customer_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Update the customer. Set to null to remove customer association."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Update the date."
          },
          "duration_minutes": {
            "type": "integer",
            "description": "Update the duration in minutes."
          },
          "billable": {
            "type": "boolean",
            "description": "Update billable status."
          },
          "description": {
            "type": "string",
            "nullable": true,
            "description": "Update the description."
          },
          "invoice_line_item_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Link or unlink the time entry from an invoice line item."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Update the memo."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Update the custom metadata."
          }
        },
        "description": "Partial update parameters for a time entry. Only specified fields will be updated."
      },
      "BulkCreateTimeEntriesRequest": {
        "type": "object",
        "properties": {
          "time_entries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateTimeEntryParams"
            },
            "maxItems": 100,
            "description": "List of time entries to create (maximum 100)."
          }
        },
        "required": [
          "time_entries"
        ]
      },
      "ApiTimeEntrySummary": {
        "type": "object",
        "properties": {
          "total_minutes": {
            "type": "integer",
            "format": "int64",
            "description": "Total minutes across all matching time entries."
          },
          "total_billable_minutes": {
            "type": "integer",
            "format": "int64",
            "description": "Total minutes for billable time entries only."
          },
          "total_billable_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Total billable amount in cents, calculated from billable entries and their service rates."
          },
          "by_customer": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTimeEntrySummaryGroup"
            },
            "description": "Summary grouped by customer."
          },
          "by_service": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTimeEntrySummaryGroup"
            },
            "description": "Summary grouped by service."
          }
        },
        "required": [
          "total_minutes",
          "total_billable_minutes",
          "total_billable_amount",
          "by_customer",
          "by_service"
        ]
      },
      "ApiTimeEntrySummaryGroup": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "The UUID of the customer or service (null for entries without a customer)."
          },
          "name": {
            "type": "string",
            "nullable": true,
            "description": "The name of the customer or service."
          },
          "total_minutes": {
            "type": "integer",
            "format": "int64",
            "description": "Total minutes for this group."
          },
          "total_billable_minutes": {
            "type": "integer",
            "format": "int64",
            "description": "Total billable minutes for this group."
          },
          "total_billable_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Total billable amount in cents for this group."
          },
          "entry_count": {
            "type": "integer",
            "format": "int64",
            "description": "Number of time entries in this group."
          }
        },
        "required": [
          "total_minutes",
          "total_billable_minutes",
          "total_billable_amount",
          "entry_count"
        ]
      },
      "ApiBookkeepingPeriods": {
        "type": "object",
        "properties": {
          "periods": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBookkeepingPeriod"
            }
          }
        },
        "required": [
          "periods"
        ]
      },
      "ApiBookkeepingPeriod": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/ApiBookkeepingPeriodBase"
          },
          {
            "$ref": "#/components/schemas/ApiBookkeepingPeriodWithTasks"
          },
          {
            "$ref": "#/components/schemas/ApiBookkeepingPeriodWithTemplateClosingActions"
          }
        ]
      },
      "ApiBookkeepingPeriodBase": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "business_id": {
            "type": "string",
            "format": "uuid"
          },
          "bookkeeper_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "month": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 12
          },
          "year": {
            "type": "integer",
            "nullable": true,
            "minimum": 2015
          },
          "scale": {
            "enum": [
              "MONTHLY",
              "ANNUAL",
              "ONGOING"
            ]
          },
          "status": {
            "enum": [
              "BOOKKEEPING_NOT_ACTIVE",
              "NOT_STARTED",
              "IN_PROGRESS_AWAITING_BOOKKEEPER",
              "IN_PROGRESS_AWAITING_CUSTOMER",
              "CLOSING_IN_REVIEW",
              "CLOSED_OPEN_TASKS",
              "CLOSED_COMPLETE"
            ]
          },
          "billing_status": {
            "enum": [
              "BILLABLE",
              "NOT_BILLABLE"
            ]
          }
        },
        "required": [
          "id",
          "business_id",
          "month",
          "year",
          "scale",
          "status",
          "billing_status"
        ]
      },
      "ApiBookkeepingPeriodWithTasks": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiBookkeepingPeriodBase"
          },
          {
            "type": "object",
            "properties": {
              "tasks": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ApiBusinessTask"
                }
              }
            },
            "required": [
              "tasks"
            ]
          }
        ]
      },
      "ApiBookkeepingPeriodWithTemplateClosingActions": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ApiBookkeepingPeriodBase"
          },
          {
            "type": "object",
            "properties": {
              "template_closing_actions": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ApiTemplateClosingActionWithProvisionedActions"
                }
              }
            },
            "required": [
              "template_closing_actions"
            ]
          }
        ]
      },
      "PatchBookkeepingPeriodParams": {
        "type": "object",
        "properties": {
          "bookkeeper_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "status": {
            "enum": [
              "BOOKKEEPING_NOT_ACTIVE",
              "NOT_STARTED",
              "IN_PROGRESS_AWAITING_BOOKKEEPER",
              "IN_PROGRESS_AWAITING_CUSTOMER",
              "CLOSING_IN_REVIEW",
              "CLOSED_OPEN_TASKS",
              "CLOSED_COMPLETE"
            ]
          },
          "billing_status": {
            "enum": [
              "BILLABLE",
              "NOT_BILLABLE"
            ]
          }
        }
      },
      "ApiBookkeepingChecklist": {
        "type": "object",
        "properties": {
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBookkeepingStep"
            }
          }
        },
        "required": [
          "steps"
        ]
      },
      "ApiBookkeepingStep": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "business_id": {
            "type": "string",
            "format": "uuid"
          },
          "bookkeeping_period_id": {
            "type": "string",
            "format": "uuid"
          },
          "parent_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "title": {
            "type": "string"
          },
          "step_stage": {
            "type": "string"
          },
          "status": {
            "enum": [
              "TO_DO",
              "IN_PROGRESS",
              "DONE",
              "BLOCKED"
            ]
          },
          "priority": {
            "enum": [
              "LOW",
              "NORMAL",
              "HIGH"
            ]
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "start_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "due_at": {
            "type": "string",
            "format": "date-time"
          },
          "evaluation_strategy": {
            "type": "string",
            "nullable": true
          },
          "is_self_evaluating": {
            "type": "boolean"
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "children": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBookkeepingStep"
            }
          }
        },
        "required": [
          "id",
          "business_id",
          "bookkeeping_period_id",
          "title",
          "step_stage",
          "status",
          "priority",
          "due_at",
          "is_self_evaluating",
          "children"
        ]
      },
      "ApiClosingActionsRunResult": {
        "type": "object",
        "properties": {
          "period": {
            "$ref": "#/components/schemas/ApiBookkeepingPeriodBase"
          },
          "template_closing_actions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTemplateClosingActionWithProvisionedActions"
            }
          }
        },
        "required": [
          "period",
          "template_closing_actions"
        ]
      },
      "ApiTemplateClosingActionWithProvisionedActions": {
        "type": "object",
        "properties": {
          "template_closing_action": {
            "$ref": "#/components/schemas/ApiTemplateClosingAction"
          },
          "provisioned_actions": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "required": [
          "template_closing_action",
          "provisioned_actions"
        ]
      },
      "ApiTemplateClosingAction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "closing_action_type": {
            "enum": [
              "RETAINED_EARNINGS",
              "RECOGNIZE_EXTERNAL_REVENUE",
              "CONSOLIDATE_OWNERS_CAPITAL"
            ]
          },
          "period_scale": {
            "enum": [
              "MONTHLY",
              "ANNUAL",
              "ONGOING"
            ]
          },
          "provisioning_start_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "provisioning_end_date": {
            "type": "string",
            "format": "date",
            "nullable": true
          },
          "ledger_activity_start_timestamp": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        },
        "required": [
          "id",
          "closing_action_type",
          "period_scale"
        ]
      },
      "AccountType": {
        "type": "string",
        "enum": [
          "DEPOSITORY",
          "CREDIT",
          "LOAN",
          "BROKERAGE",
          "INVESTMENT"
        ],
        "description": "The broad category of a bank account.",
        "example": "DEPOSITORY"
      },
      "AccountSubtype": {
        "type": "string",
        "enum": [
          "_401A",
          "_401K",
          "_403B",
          "_457B",
          "_529",
          "BROKERAGE",
          "CASH_ISA",
          "CRYPTO_EXCHANGE",
          "EDUCATION_SAVINGS_ACCOUNT",
          "EBT",
          "FIXED_ANNUITY",
          "GIC",
          "HEALTH_REIMBURSEMENT_ARRANGEMENT",
          "HSA",
          "ISA",
          "IRA",
          "LIF",
          "LIFE_INSURANCE",
          "LIRA",
          "LRIF",
          "LRSP",
          "NON_CUSTODIAL_WALLET",
          "NON_TAXABLE_BROKERAGE_ACCOUNT",
          "OTHER",
          "OTHER_INSURANCE",
          "OTHER_ANNUITY",
          "PRIF",
          "RDSP",
          "RESP",
          "RLIF",
          "RRIF",
          "PENSION",
          "PROFIT_SHARING_PLAN",
          "RETIREMENT",
          "ROTH",
          "ROTH_401K",
          "RRSP",
          "SEP_IRA",
          "SIMPLE_IRA",
          "SIPP",
          "STOCK_PLAN",
          "THRIFT_SAVINGS_PLAN",
          "TFSA",
          "TRUST",
          "UGMA",
          "UTMA",
          "VARIABLE_ANNUITY",
          "CREDIT_CARD",
          "PAYPAL",
          "CD",
          "CHECKING",
          "SAVINGS",
          "MONEY_MARKET",
          "PREPAID",
          "AUTO",
          "BUSINESS",
          "COMMERCIAL",
          "CONSTRUCTION",
          "CONSUMER",
          "HOME_EQUITY",
          "LOAN",
          "MORTGAGE",
          "OVERDRAFT",
          "LINE_OF_CREDIT",
          "STUDENT",
          "CASH_MANAGEMENT",
          "KEOGH",
          "MUTUAL_FUND",
          "RECURRING",
          "REWARDS",
          "SAFE_DEPOSIT",
          "SARSEP",
          "PAYROLL",
          "NULL",
          "ENUM_UNKNOWN"
        ],
        "description": "The specific subtype of a bank account.",
        "example": "CHECKING"
      },
      "ApiFinancialInstitution": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the financial institution."
          },
          "name": {
            "type": "string",
            "description": "Name of the financial institution.",
            "example": "Chase"
          },
          "logo": {
            "type": "string",
            "nullable": true,
            "description": "Base64-encoded logo image for the financial institution."
          }
        },
        "required": [
          "id",
          "name"
        ]
      },
      "ApiBankAccount": {
        "type": "object",
        "description": "A bank account belonging to a business. Bank accounts are the top-level container that groups one or more external accounts (connected financial accounts) under a single logical account.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Bank_Account`.",
            "example": "Bank_Account"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the bank account."
          },
          "account_name": {
            "type": "string",
            "nullable": true,
            "description": "User-defined display name for the bank account.",
            "example": "Business Checking"
          },
          "ledger_account_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the ledger account associated with this bank account."
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "description": "Free-form notes about the bank account."
          },
          "institution": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ApiFinancialInstitution"
              }
            ],
            "nullable": true,
            "description": "The financial institution associated with this bank account."
          },
          "account_type": {
            "$ref": "#/components/schemas/AccountType",
            "description": "The broad category of the bank account."
          },
          "account_subtype": {
            "$ref": "#/components/schemas/AccountSubtype",
            "description": "The specific subtype of the bank account."
          },
          "notify_when_disconnected": {
            "type": "boolean",
            "description": "Whether to send a notification when any external account linked to this bank account becomes disconnected."
          },
          "is_disconnected": {
            "type": "boolean",
            "description": "Whether any linked external account is currently disconnected."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp when the bank account was archived. Null if the account is active."
          },
          "external_accounts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiExternalAccount"
            },
            "description": "List of external accounts (connected financial accounts) linked to this bank account."
          },
          "entity_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags applied to this bank account."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal memo for the bank account."
          },
          "metadata": {
            "type": "object",
            "nullable": true,
            "description": "Arbitrary platform-defined metadata associated with the bank account."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "A platform-defined reference number for the bank account."
          }
        },
        "required": [
          "id",
          "ledger_account_id",
          "account_type",
          "account_subtype",
          "notify_when_disconnected",
          "is_disconnected",
          "external_accounts",
          "entity_tags"
        ]
      },
      "CreateBankAccountParams": {
        "type": "object",
        "description": "Parameters for creating a new bank account.",
        "properties": {
          "account_name": {
            "type": "string",
            "description": "Display name for the bank account.",
            "example": "Business Checking"
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "description": "Free-form notes about the bank account."
          },
          "financial_institution_name": {
            "type": "string",
            "nullable": true,
            "description": "Name of the financial institution. Used when no `financial_institution_id` is provided."
          },
          "financial_institution_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of an existing financial institution to associate with the bank account."
          },
          "account_type": {
            "$ref": "#/components/schemas/AccountType",
            "description": "The broad category of the bank account."
          },
          "account_subtype": {
            "$ref": "#/components/schemas/AccountSubtype",
            "description": "The specific subtype of the bank account."
          }
        },
        "required": [
          "account_name",
          "account_type",
          "account_subtype"
        ]
      },
      "PatchBankAccountParams": {
        "type": "object",
        "description": "Parameters for updating an existing bank account. All fields are optional; only provided fields are updated.",
        "properties": {
          "account_name": {
            "type": "string",
            "nullable": true,
            "description": "New display name for the bank account."
          },
          "notes": {
            "type": "string",
            "nullable": true,
            "description": "New notes for the bank account."
          },
          "financial_institution_name": {
            "type": "string",
            "nullable": true,
            "description": "New financial institution name."
          },
          "financial_institution_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the financial institution to associate with the bank account."
          },
          "notify_when_disconnected": {
            "type": "boolean",
            "description": "Whether to send a notification when any linked external account becomes disconnected."
          }
        }
      },
      "RequestMetadata": {
        "type": "object",
        "description": "Request metadata. Present on paginated list responses.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Metadata type discriminator. Value will be `request_metadata`.",
            "example": "request_metadata"
          },
          "pagination": {
            "$ref": "#/components/schemas/PaginationMetadata"
          }
        }
      },
      "LoanType": {
        "type": "string",
        "description": "The type of loan.",
        "enum": [
          "TERM_LOAN",
          "MCA",
          "FLEX_LOAN",
          "LINE_OF_CREDIT",
          "LEASE",
          "EQUIPMENT_FINANCING"
        ],
        "example": "TERM_LOAN"
      },
      "LoanProceedType": {
        "type": "string",
        "description": "How the loan proceeds were received. `DISBURSEMENT` is a cash disbursement; `ASSET` means the proceeds funded an asset (e.g. financed equipment).",
        "enum": [
          "ASSET",
          "DISBURSEMENT"
        ],
        "example": "DISBURSEMENT"
      },
      "LoanPaymentSplitType": {
        "type": "string",
        "description": "The portion of a loan payment a split applies to.",
        "enum": [
          "PRINCIPAL",
          "INTEREST",
          "FEE"
        ],
        "example": "PRINCIPAL"
      },
      "AssetType": {
        "type": "string",
        "description": "The type of fixed asset.",
        "enum": [
          "RIGHT_OF_USE_ASSET",
          "VEHICLE",
          "EQUIPMENT",
          "GOODWILL"
        ],
        "example": "EQUIPMENT"
      },
      "AssetValueUpdateType": {
        "type": "string",
        "description": "The kind of value change applied to an asset. `DEPRECIATION_AMORTIZATION`, `IMPAIRMENT`, and `REVALUATION_DOWN` decrease the asset's carrying value; `IMPROVEMENT` and `REVALUATION_UP` increase it. `DEPRECIATION_AMORTIZATION` requires the asset to have an `accumulated_depreciation_account` configured.",
        "enum": [
          "DEPRECIATION_AMORTIZATION",
          "IMPROVEMENT",
          "IMPAIRMENT",
          "REVALUATION_UP",
          "REVALUATION_DOWN"
        ],
        "example": "DEPRECIATION_AMORTIZATION"
      },
      "CreateLoanProceedAssetRef": {
        "description": "Reference to the asset funded by an `ASSET` proceed. Either link an existing asset by `id` or `external_id`, or create a new asset inline with `new_asset`.",
        "oneOf": [
          {
            "type": "object",
            "title": "Existing asset",
            "description": "Link an existing asset. Provide either `id` or `external_id`.",
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid",
                "nullable": true,
                "description": "ID of an existing asset to link to this proceed."
              },
              "external_id": {
                "type": "string",
                "nullable": true,
                "description": "External ID of an existing asset to link to this proceed."
              }
            }
          },
          {
            "type": "object",
            "title": "New asset",
            "required": [
              "new_asset"
            ],
            "properties": {
              "new_asset": {
                "$ref": "#/components/schemas/CreateAssetParams"
              }
            }
          }
        ]
      },
      "CreateLoanAssetProceedParams": {
        "type": "object",
        "title": "Asset proceed",
        "required": [
          "loan_proceed_type",
          "amount",
          "date",
          "asset"
        ],
        "properties": {
          "loan_proceed_type": {
            "type": "string",
            "enum": [
              "ASSET"
            ],
            "description": "Discriminator. Must be `ASSET`."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the proceed in your system for linking purposes."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Proceed amount, in cents."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Date the proceed was received."
          },
          "asset": {
            "$ref": "#/components/schemas/CreateLoanProceedAssetRef"
          }
        }
      },
      "CreateLoanDisbursementProceedParams": {
        "type": "object",
        "title": "Disbursement proceed",
        "required": [
          "loan_proceed_type",
          "amount",
          "date"
        ],
        "properties": {
          "loan_proceed_type": {
            "type": "string",
            "enum": [
              "DISBURSEMENT"
            ],
            "description": "Discriminator. Must be `DISBURSEMENT`."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the proceed in your system for linking purposes."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Proceed amount, in cents."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Date the proceed was received."
          },
          "method": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentMethod"
              }
            ],
            "default": "OTHER",
            "description": "Payment method used for the cash disbursement. Defaults to `OTHER`."
          }
        }
      },
      "CreateLoanProceedParams": {
        "description": "A loan proceed: funds (or an asset) received from the loan.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/CreateLoanAssetProceedParams"
          },
          {
            "$ref": "#/components/schemas/CreateLoanDisbursementProceedParams"
          }
        ],
        "discriminator": {
          "propertyName": "loan_proceed_type",
          "mapping": {
            "ASSET": "#/components/schemas/CreateLoanAssetProceedParams",
            "DISBURSEMENT": "#/components/schemas/CreateLoanDisbursementProceedParams"
          }
        }
      },
      "CreateTermLoanParams": {
        "type": "object",
        "required": [
          "loan_type",
          "display_name",
          "origination_date",
          "original_principal"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "TERM_LOAN"
            ],
            "description": "Discriminator. Must be `TERM_LOAN`."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the loan in your system for linking purposes."
          },
          "display_name": {
            "type": "string",
            "description": "Human-friendly name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Date the loan was originated."
          },
          "parent_ledger_account_identifier": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "Parent ledger account under which the loan's dedicated liability account is created. Defaults to `NOTES_PAYABLE`."
          },
          "original_principal": {
            "type": "integer",
            "format": "int64",
            "description": "Original principal of the loan, in cents."
          },
          "loan_term_months": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Term of the loan, in months."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Loan proceeds. Optional. On create, sets the loan's initial proceeds. Because creating with an existing `external_id` upserts the loan, on a subsequent call this list is reconciled against the loan's existing proceeds by proceed `external_id` (matched proceeds are updated, existing proceeds that are absent or have no `external_id` are archived, and new entries are created). Omit the field or set it to `null` to leave the existing proceeds untouched. Individual proceeds can also be managed with the loan proceed endpoints.",
            "nullable": true
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the loan."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the loan."
          }
        },
        "title": "Term loan"
      },
      "CreateMcaLoanParams": {
        "type": "object",
        "required": [
          "loan_type",
          "display_name",
          "origination_date",
          "original_principal",
          "fee_percentage"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "MCA"
            ],
            "description": "Discriminator. Must be `MCA`."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the loan in your system for linking purposes."
          },
          "display_name": {
            "type": "string",
            "description": "Human-friendly name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Date the loan was originated."
          },
          "parent_ledger_account_identifier": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "Parent ledger account under which the loan's dedicated liability account is created. Defaults to `NOTES_PAYABLE`."
          },
          "original_principal": {
            "type": "integer",
            "format": "int64",
            "description": "Original principal (advance amount), in cents."
          },
          "fee_percentage": {
            "type": "string",
            "description": "Merchant cash advance fee, expressed as a percentage in a decimal string (for example, `\"15\"` for a 15% fee, or `\"15.5\"` for 15.5%)."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Loan proceeds. Optional. On create, sets the loan's initial proceeds. Because creating with an existing `external_id` upserts the loan, on a subsequent call this list is reconciled against the loan's existing proceeds by proceed `external_id` (matched proceeds are updated, existing proceeds that are absent or have no `external_id` are archived, and new entries are created). Omit the field or set it to `null` to leave the existing proceeds untouched. Individual proceeds can also be managed with the loan proceed endpoints.",
            "nullable": true
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the loan."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the loan."
          }
        },
        "title": "Merchant cash advance"
      },
      "CreateLineOfCreditLoanParams": {
        "type": "object",
        "required": [
          "loan_type",
          "display_name",
          "origination_date",
          "credit_limit"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "LINE_OF_CREDIT"
            ],
            "description": "Discriminator. Must be `LINE_OF_CREDIT`."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the loan in your system for linking purposes."
          },
          "display_name": {
            "type": "string",
            "description": "Human-friendly name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Date the loan was originated."
          },
          "parent_ledger_account_identifier": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "Parent ledger account under which the loan's dedicated liability account is created. Defaults to `NOTES_PAYABLE`."
          },
          "credit_limit": {
            "type": "integer",
            "format": "int64",
            "description": "Credit limit of the line of credit, in cents."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Loan proceeds. Optional. On create, sets the loan's initial proceeds. Because creating with an existing `external_id` upserts the loan, on a subsequent call this list is reconciled against the loan's existing proceeds by proceed `external_id` (matched proceeds are updated, existing proceeds that are absent or have no `external_id` are archived, and new entries are created). Omit the field or set it to `null` to leave the existing proceeds untouched. Individual proceeds can also be managed with the loan proceed endpoints.",
            "nullable": true
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the loan."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the loan."
          }
        },
        "title": "Line of credit"
      },
      "CreateLeaseLoanParams": {
        "type": "object",
        "required": [
          "loan_type",
          "display_name",
          "origination_date",
          "original_principal",
          "loan_term_months"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "LEASE"
            ],
            "description": "Discriminator. Must be `LEASE`."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the loan in your system for linking purposes."
          },
          "display_name": {
            "type": "string",
            "description": "Human-friendly name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Date the loan was originated."
          },
          "parent_ledger_account_identifier": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "Parent ledger account under which the loan's dedicated liability account is created. Defaults to `NOTES_PAYABLE`."
          },
          "original_principal": {
            "type": "integer",
            "format": "int64",
            "description": "Original principal of the lease, in cents."
          },
          "loan_term_months": {
            "type": "integer",
            "format": "int32",
            "description": "Term of the lease, in months."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Loan proceeds. Optional. On create, sets the loan's initial proceeds. Because creating with an existing `external_id` upserts the loan, on a subsequent call this list is reconciled against the loan's existing proceeds by proceed `external_id` (matched proceeds are updated, existing proceeds that are absent or have no `external_id` are archived, and new entries are created). Omit the field or set it to `null` to leave the existing proceeds untouched. Individual proceeds can also be managed with the loan proceed endpoints.",
            "nullable": true
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the loan."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the loan."
          }
        },
        "title": "Lease"
      },
      "CreateEquipmentFinancingLoanParams": {
        "type": "object",
        "required": [
          "loan_type",
          "display_name",
          "origination_date",
          "original_principal",
          "loan_term_months"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "EQUIPMENT_FINANCING"
            ],
            "description": "Discriminator. Must be `EQUIPMENT_FINANCING`."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the loan in your system for linking purposes."
          },
          "display_name": {
            "type": "string",
            "description": "Human-friendly name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Date the loan was originated."
          },
          "parent_ledger_account_identifier": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "Parent ledger account under which the loan's dedicated liability account is created. Defaults to `NOTES_PAYABLE`."
          },
          "original_principal": {
            "type": "integer",
            "format": "int64",
            "description": "Original principal of the financing, in cents."
          },
          "loan_term_months": {
            "type": "integer",
            "format": "int32",
            "description": "Term of the financing, in months."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Loan proceeds. Optional. On create, sets the loan's initial proceeds. Because creating with an existing `external_id` upserts the loan, on a subsequent call this list is reconciled against the loan's existing proceeds by proceed `external_id` (matched proceeds are updated, existing proceeds that are absent or have no `external_id` are archived, and new entries are created). Omit the field or set it to `null` to leave the existing proceeds untouched. Individual proceeds can also be managed with the loan proceed endpoints.",
            "nullable": true
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the loan."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the loan."
          }
        },
        "title": "Equipment financing"
      },
      "CreateLoanParams": {
        "description": "Parameters for creating a loan. The shape depends on `loan_type`.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/CreateTermLoanParams"
          },
          {
            "$ref": "#/components/schemas/CreateMcaLoanParams"
          },
          {
            "$ref": "#/components/schemas/CreateFlexLoanParams"
          },
          {
            "$ref": "#/components/schemas/CreateLineOfCreditLoanParams"
          },
          {
            "$ref": "#/components/schemas/CreateLeaseLoanParams"
          },
          {
            "$ref": "#/components/schemas/CreateEquipmentFinancingLoanParams"
          }
        ],
        "discriminator": {
          "propertyName": "loan_type",
          "mapping": {
            "TERM_LOAN": "#/components/schemas/CreateTermLoanParams",
            "MCA": "#/components/schemas/CreateMcaLoanParams",
            "FLEX_LOAN": "#/components/schemas/CreateFlexLoanParams",
            "LINE_OF_CREDIT": "#/components/schemas/CreateLineOfCreditLoanParams",
            "LEASE": "#/components/schemas/CreateLeaseLoanParams",
            "EQUIPMENT_FINANCING": "#/components/schemas/CreateEquipmentFinancingLoanParams"
          }
        }
      },
      "PatchTermLoanParams": {
        "type": "object",
        "required": [
          "loan_type"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "TERM_LOAN"
            ],
            "description": "Discriminator. Must be `TERM_LOAN`."
          },
          "display_name": {
            "type": "string",
            "description": "Updated display name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Updated origination date."
          },
          "original_principal": {
            "type": "integer",
            "format": "int64",
            "description": "Updated original principal, in cents."
          },
          "loan_term_months": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Updated term, in months."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Replaces the loan's proceeds with this list."
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Updated internal note."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Updated reference number."
          }
        },
        "description": "Only include the fields you want to change.",
        "title": "Term loan"
      },
      "PatchMcaLoanParams": {
        "type": "object",
        "required": [
          "loan_type"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "MCA"
            ],
            "description": "Discriminator. Must be `MCA`."
          },
          "display_name": {
            "type": "string",
            "description": "Updated display name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Updated origination date."
          },
          "original_principal": {
            "type": "integer",
            "format": "int64",
            "description": "Updated original principal, in cents."
          },
          "fee_percentage": {
            "type": "string",
            "description": "Updated MCA fee, expressed as a percentage in a decimal string (for example, `\"15\"` for 15%)."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Replaces the loan's proceeds with this list."
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Updated internal note."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Updated reference number."
          }
        },
        "description": "Only include the fields you want to change.",
        "title": "Merchant cash advance"
      },
      "PatchLineOfCreditLoanParams": {
        "type": "object",
        "required": [
          "loan_type"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "LINE_OF_CREDIT"
            ],
            "description": "Discriminator. Must be `LINE_OF_CREDIT`."
          },
          "display_name": {
            "type": "string",
            "description": "Updated display name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Updated origination date."
          },
          "credit_limit": {
            "type": "integer",
            "format": "int64",
            "description": "Updated credit limit, in cents."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Replaces the loan's proceeds with this list."
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Updated internal note."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Updated reference number."
          }
        },
        "description": "Only include the fields you want to change.",
        "title": "Line of credit"
      },
      "PatchLeaseLoanParams": {
        "type": "object",
        "required": [
          "loan_type"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "LEASE"
            ],
            "description": "Discriminator. Must be `LEASE`."
          },
          "display_name": {
            "type": "string",
            "description": "Updated display name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Updated origination date."
          },
          "original_principal": {
            "type": "integer",
            "format": "int64",
            "description": "Updated original principal, in cents."
          },
          "loan_term_months": {
            "type": "integer",
            "format": "int32",
            "description": "Updated term, in months."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Replaces the loan's proceeds with this list."
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Updated internal note."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Updated reference number."
          }
        },
        "description": "Only include the fields you want to change.",
        "title": "Lease"
      },
      "PatchEquipmentFinancingLoanParams": {
        "type": "object",
        "required": [
          "loan_type"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "EQUIPMENT_FINANCING"
            ],
            "description": "Discriminator. Must be `EQUIPMENT_FINANCING`."
          },
          "display_name": {
            "type": "string",
            "description": "Updated display name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Updated origination date."
          },
          "original_principal": {
            "type": "integer",
            "format": "int64",
            "description": "Updated original principal, in cents."
          },
          "loan_term_months": {
            "type": "integer",
            "format": "int32",
            "description": "Updated term, in months."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Replaces the loan's proceeds with this list."
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Updated internal note."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Updated reference number."
          }
        },
        "description": "Only include the fields you want to change.",
        "title": "Equipment financing"
      },
      "PatchLoanParams": {
        "description": "Parameters for updating a loan. The shape depends on `loan_type`.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/PatchTermLoanParams"
          },
          {
            "$ref": "#/components/schemas/PatchMcaLoanParams"
          },
          {
            "$ref": "#/components/schemas/PatchFlexLoanParams"
          },
          {
            "$ref": "#/components/schemas/PatchLineOfCreditLoanParams"
          },
          {
            "$ref": "#/components/schemas/PatchLeaseLoanParams"
          },
          {
            "$ref": "#/components/schemas/PatchEquipmentFinancingLoanParams"
          }
        ],
        "discriminator": {
          "propertyName": "loan_type",
          "mapping": {
            "TERM_LOAN": "#/components/schemas/PatchTermLoanParams",
            "MCA": "#/components/schemas/PatchMcaLoanParams",
            "FLEX_LOAN": "#/components/schemas/PatchFlexLoanParams",
            "LINE_OF_CREDIT": "#/components/schemas/PatchLineOfCreditLoanParams",
            "LEASE": "#/components/schemas/PatchLeaseLoanParams",
            "EQUIPMENT_FINANCING": "#/components/schemas/PatchEquipmentFinancingLoanParams"
          }
        }
      },
      "ApiLoan": {
        "type": "object",
        "description": "A loan held by a business. Each loan has a dedicated child ledger (liability) account.",
        "required": [
          "id",
          "business_id",
          "display_name",
          "loan_type",
          "loan_account",
          "current_balance",
          "origination_date",
          "transaction_tags"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the loan."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the business that holds the loan."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the loan in your system for linking purposes."
          },
          "display_name": {
            "type": "string",
            "description": "Human-friendly name for the loan."
          },
          "loan_type": {
            "$ref": "#/components/schemas/LoanType"
          },
          "loan_account": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SingleApiChartAccount"
              }
            ],
            "description": "The dedicated ledger (liability) account for this loan."
          },
          "current_balance": {
            "type": "integer",
            "format": "int64",
            "description": "Current outstanding balance of the loan, in cents."
          },
          "opening_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ApiLoanOpeningBalance"
              }
            ],
            "nullable": true,
            "description": "The loan's active opening balance, if one has been derived. Layer derives this from the loan's recorded history and any `reported_balance` you have sent; it is not set directly."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Date the loan was originated."
          },
          "original_principal": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Original principal, in cents. Present for `TERM_LOAN`, `MCA`, `LEASE`, and `EQUIPMENT_FINANCING`."
          },
          "credit_limit": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Credit limit, in cents. Present for `LINE_OF_CREDIT`."
          },
          "fee_percentage": {
            "type": "string",
            "nullable": true,
            "description": "Fixed fee, expressed as a percentage in a decimal string (for example, `\"15\"` for a 15% fee). Present for `MCA` and `FLEX_LOAN`."
          },
          "loan_term_months": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Loan term in months. Present for `TERM_LOAN`, `LEASE`, and `EQUIPMENT_FINANCING`."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the loan was fully repaid, if applicable.",
            "nullable": true
          },
          "cancelled_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the loan was cancelled, if applicable.",
            "nullable": true
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the loan was archived, if applicable.",
            "nullable": true
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the loan."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the loan."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags applied to this record."
          }
        }
      },
      "CreateLoanPaymentSplitParams": {
        "type": "object",
        "description": "How a portion of a loan payment is allocated. All splits on a payment must sum to the payment `amount` and share its sign.",
        "required": [
          "split_type",
          "amount"
        ],
        "properties": {
          "split_type": {
            "$ref": "#/components/schemas/LoanPaymentSplitType"
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Split amount, in cents. Must share the sign of the payment `amount`, so splits on a reversal are negative."
          },
          "account_identifier": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "For `INTEREST` and `FEE` splits, the expense account to post to (defaults to `INTEREST_EXPENSE` and `OTHER_FEES` respectively). Ignored for `PRINCIPAL` splits."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the split in your system for linking purposes."
          }
        }
      },
      "CreateLoanPaymentParams": {
        "type": "object",
        "description": "Parameters for recording a loan payment. Provide exactly one of `loan_id` or `loan_external_id` to identify the loan.",
        "required": [
          "amount",
          "date"
        ],
        "properties": {
          "loan_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the loan being paid. Provide this or `loan_external_id`."
          },
          "loan_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the loan being paid. Provide this or `loan_id`."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the payment in your system for linking purposes."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Total payment amount, in cents. Must equal the sum of the splits. Use a negative amount to record a reversal of an earlier payment, for example when a lender returns a repayment it withheld. Record the reversal as its own payment; do not edit the payment it offsets."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Date of the payment."
          },
          "splits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanPaymentSplitParams"
            },
            "nullable": true,
            "description": "Breakdown of the payment into principal, interest, and fee portions. Optional for MCA and flex loans: when omitted, Layer derives a `PRINCIPAL`/`FEE` split from the loan's `fee_percentage` (`principal = amount / (1 + fee_percentage / 100)`, fee = remainder). Required for all other loan types. Provide explicit splits to override the derived ones."
          },
          "defer_posting": {
            "type": "boolean",
            "default": false,
            "description": "If true, the payment is recorded but not posted to the ledger until it is paid out or its due date is reached."
          },
          "method": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentMethod"
              }
            ],
            "default": "OTHER",
            "description": "Payment method. Defaults to `OTHER`."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Payment processor, if any (e.g. `stripe`)."
          },
          "payment_clearing_account_identifier": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "Override the clearing account used for the payment. Defaults based on `method`."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the payment."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the payment."
          }
        }
      },
      "BulkCreateLoanPaymentsParams": {
        "type": "object",
        "required": [
          "payments"
        ],
        "properties": {
          "payments": {
            "type": "array",
            "minItems": 1,
            "description": "The payments to create or update. `external_id` values must be unique within the request.",
            "items": {
              "$ref": "#/components/schemas/CreateLoanPaymentParams"
            }
          }
        }
      },
      "PatchLoanPaymentParams": {
        "type": "object",
        "description": "Parameters for updating a loan payment. Only include the fields you want to change.",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Updated total payment amount, in cents. Can be negative, which makes the payment a reversal."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Updated payment date."
          },
          "splits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanPaymentSplitParams"
            },
            "description": "Replaces the payment's splits with this list."
          },
          "defer_posting": {
            "type": "boolean",
            "description": "Updated deferred-posting flag."
          },
          "method": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentMethod"
              }
            ],
            "description": "Updated payment method."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Updated processor."
          },
          "payment_clearing_account_identifier": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "Updated clearing account."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Updated internal note."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Updated reference number."
          }
        }
      },
      "ApiLoanPayment": {
        "type": "object",
        "description": "A payment made against a loan, broken down into principal, interest, and fee splits.",
        "required": [
          "id",
          "business_id",
          "loan_id",
          "splits",
          "amount",
          "date",
          "defer_posting",
          "method",
          "transaction_tags"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the loan payment."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the business that made the payment."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the payment in your system for linking purposes."
          },
          "loan_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the loan this payment applies to."
          },
          "splits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiLoanPaymentSplit"
            },
            "description": "The principal, interest, and fee splits that make up this payment."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Total payment amount, in cents."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Date of the payment."
          },
          "defer_posting": {
            "type": "boolean",
            "description": "Whether posting to the ledger is deferred."
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Payment processor, if any."
          },
          "payment_clearing_account": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SingleApiChartAccount"
              }
            ],
            "nullable": true,
            "description": "The clearing account used for the payment, if any."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the payment was archived, if applicable."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the payment."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the payment."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags applied to this record."
          }
        }
      },
      "CreateAssetParams": {
        "type": "object",
        "description": "Parameters for creating a fixed asset. Creates a dedicated ledger account for the asset under the parent account (defaults to Fixed Assets).",
        "required": [
          "name",
          "asset_type"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Name of the asset."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the asset in your system for linking purposes. Creating an asset with an `external_id` that already exists upserts the existing asset."
          },
          "asset_type": {
            "$ref": "#/components/schemas/AssetType"
          },
          "parent_ledger_account_identifier": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "Parent ledger account under which the asset's dedicated account is created. Defaults to Fixed Assets."
          },
          "accumulated_depreciation_account": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "Accumulated depreciation account for the asset. Required before recording `DEPRECIATION_AMORTIZATION` value updates."
          },
          "original_value": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Original purchase value, in cents."
          },
          "salvage_value": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Estimated salvage (residual) value, in cents."
          },
          "useful_life_months": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Useful life of the asset, in months."
          },
          "opening_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CreateAssetOpeningBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Opening balance for the asset, posted against Opening Balance Equity. Omit if the asset has no opening balance."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the asset."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the asset."
          }
        }
      },
      "CreateAssetOpeningBalanceParams": {
        "type": "object",
        "description": "Opening balance for a fixed asset.",
        "required": [
          "balance",
          "effective_at"
        ],
        "properties": {
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "Opening balance, in cents. Must be positive."
          },
          "effective_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the opening balance takes effect. Clamped forward to the business's activation date, and rejected if later than the earliest recorded asset event."
          }
        }
      },
      "PatchAssetParams": {
        "type": "object",
        "description": "Parameters for updating an asset. Only include the fields you want to change.",
        "properties": {
          "name": {
            "type": "string",
            "description": "Updated asset name."
          },
          "asset_type": {
            "$ref": "#/components/schemas/AssetType"
          },
          "accumulated_depreciation_account": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "Updated accumulated depreciation account."
          },
          "original_value": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Updated original value, in cents."
          },
          "salvage_value": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Updated salvage value, in cents."
          },
          "useful_life_months": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Updated useful life, in months."
          },
          "opening_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CreateAssetOpeningBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Updated opening balance. Replaces any existing opening balance. Set to `null` to clear it."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Updated internal note."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Updated reference number."
          }
        }
      },
      "ApiAsset": {
        "type": "object",
        "description": "A fixed asset held by a business. Each asset has a dedicated ledger account.",
        "required": [
          "id",
          "business_id",
          "name",
          "asset_type",
          "ledger_account",
          "transaction_tags"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the asset."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the business that owns the asset."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the asset in your system for linking purposes."
          },
          "name": {
            "type": "string",
            "description": "Name of the asset."
          },
          "asset_type": {
            "$ref": "#/components/schemas/AssetType"
          },
          "ledger_account": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SingleApiChartAccount"
              }
            ],
            "description": "The dedicated ledger account for this asset."
          },
          "accumulated_depreciation_account": {
            "allOf": [
              {
                "$ref": "#/components/schemas/SingleApiChartAccount"
              }
            ],
            "nullable": true,
            "description": "The accumulated depreciation account for this asset, if configured."
          },
          "original_value": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Original purchase value, in cents."
          },
          "salvage_value": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Estimated salvage (residual) value, in cents."
          },
          "useful_life_months": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "description": "Useful life of the asset, in months."
          },
          "opening_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ApiOpeningBalance"
              }
            ],
            "nullable": true,
            "description": "Opening balance for the asset, if one is set."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the asset was archived, if applicable."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the asset."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the asset."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags applied to this record."
          }
        }
      },
      "CreateAssetValueUpdateParams": {
        "type": "object",
        "description": "Parameters for recording a change to an asset's value (depreciation, improvement, impairment, or revaluation). Identify the asset with either `asset_id` or `asset_external_id`. Posts a journal entry between the asset and the counter account.",
        "required": [
          "amount",
          "update_type",
          "counter_account",
          "date"
        ],
        "properties": {
          "asset_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the asset to update. Provide this or `asset_external_id`."
          },
          "asset_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the asset to update. Provide this or `asset_id`."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the value update in your system for linking purposes."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the value change, in cents."
          },
          "update_type": {
            "$ref": "#/components/schemas/AssetValueUpdateType"
          },
          "counter_account": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "description": "The counter account for the journal entry (e.g. depreciation expense, or the cash/expense account that funded an improvement)."
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Date of the value update."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the value update."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the value update."
          }
        }
      },
      "PatchAssetValueUpdateParams": {
        "type": "object",
        "description": "Parameters for updating an asset value update. Only include the fields you want to change. Changing the amount, type, account, or date re-posts the underlying journal entry.",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Updated amount, in cents."
          },
          "update_type": {
            "$ref": "#/components/schemas/AssetValueUpdateType"
          },
          "counter_account": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "description": "Updated counter account."
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Updated date."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Updated internal note."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Updated reference number."
          }
        }
      },
      "ApiAssetValueUpdate": {
        "type": "object",
        "description": "A recorded change to an asset's value, such as depreciation, improvement, impairment, or revaluation.",
        "required": [
          "id",
          "business_id",
          "asset_id",
          "amount",
          "update_type",
          "date",
          "transaction_tags"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the value update."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the business that owns the asset."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the value update in your system for linking purposes."
          },
          "asset_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the asset this value update applies to."
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the value change, in cents."
          },
          "update_type": {
            "$ref": "#/components/schemas/AssetValueUpdateType"
          },
          "date": {
            "type": "string",
            "format": "date-time",
            "description": "Date of the value update."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the value update was archived, if applicable."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the value update."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the value update."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags applied to this record."
          }
        }
      },
      "CreateCustomerPayoutLoanPaymentParams": {
        "type": "object",
        "description": "Reference to a loan payment to associate with the payout. Provide at least one of `loan_payment_id` or `loan_payment_external_id`.",
        "properties": {
          "loan_payment_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the loan payment to associate. Provide this or `loan_payment_external_id`."
          },
          "loan_payment_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the loan payment to associate. Provide this or `loan_payment_id`."
          }
        }
      },
      "CreateCustomerPayoutLoanProceedParams": {
        "type": "object",
        "description": "Reference to a loan proceed to associate with the payout, for financing disbursements paid out alongside (or instead of) sales. Provide at least one of `loan_proceed_id` or `loan_proceed_external_id`; if you provide both, they must refer to the same proceed. Only proceeds with `loan_proceed_type` of `DISBURSEMENT` are eligible, and each proceed may be referenced at most once per payout.",
        "properties": {
          "loan_proceed_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the loan proceed to associate. Provide this or `loan_proceed_external_id`."
          },
          "loan_proceed_external_id": {
            "type": "string",
            "nullable": true,
            "description": "External ID of the loan proceed to associate. Provide this or `loan_proceed_id`."
          }
        }
      },
      "StandardPaymentFeeParams": {
        "type": "object",
        "title": "Standard fee",
        "description": "A standard additional fee on an invoice payment.",
        "required": [
          "account",
          "fee_amount"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "STANDARD"
            ],
            "default": "STANDARD",
            "description": "Discriminator for the fee type. Optional; defaults to `STANDARD`."
          },
          "description": {
            "type": "string",
            "description": "Optional description of the fee."
          },
          "account": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "The [Account Identifier](/api-reference/ledger/account-identifier) for the fee to be debited."
          },
          "fee_amount": {
            "type": "integer",
            "format": "int64",
            "description": "Amount of the fee in cents."
          },
          "is_passed_to_customer": {
            "type": "boolean",
            "description": "Whether or not the fee is passed to the customer. It is paid by the business otherwise. When calculating the outstanding balance on the invoice, only the portion of each payment allocation that is applied to the invoice (excluding pass-through fees) is considered. This allows customers to pay the invoice amount plus any pass-through fees without the invoice being considered overpaid."
          }
        }
      },
      "LoanRepaymentFeeParams": {
        "type": "object",
        "title": "Loan repayment fee",
        "description": "An additional fee on an invoice payment that records a repayment against a loan. Layer creates a linked [loan payment](/api-reference/loan/loan#loan-payment-object) from the embedded parameters.",
        "required": [
          "type",
          "loan_payment"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "LOAN_REPAYMENT"
            ],
            "description": "Discriminator for the fee type. Must be `LOAN_REPAYMENT`."
          },
          "loan_payment": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CreateLoanPaymentParams"
              }
            ],
            "description": "The loan payment to create and link to this invoice payment."
          },
          "description": {
            "type": "string",
            "description": "Optional description of the fee."
          }
        }
      },
      "ApiLoanProceed": {
        "type": "object",
        "description": "A loan proceed: funds (or an asset) received when a loan is drawn. See the [Loan Proceed object](/api-reference/loan/loan#loan-proceed-object).",
        "required": [
          "id",
          "business_id",
          "loan_id",
          "loan_proceed_type",
          "method",
          "amount",
          "date",
          "transaction_tags"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the loan proceed."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the business that holds the loan."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the proceed in your system for linking purposes."
          },
          "loan_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the loan this proceed belongs to."
          },
          "loan_proceed_type": {
            "$ref": "#/components/schemas/LoanProceedType"
          },
          "method": {
            "$ref": "#/components/schemas/PaymentMethod"
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Proceed amount, in cents."
          },
          "asset_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "ID of the asset funded by this proceed. Present for `ASSET` proceeds."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Date the proceed was received."
          },
          "archived_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the proceed was archived, if applicable."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the proceed."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the proceed."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags applied to this record."
          }
        }
      },
      "PatchLoanProceedParams": {
        "type": "object",
        "description": "Parameters for updating a loan proceed. Only include the fields you want to change.",
        "properties": {
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Updated proceed amount, in cents."
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Updated proceed date."
          },
          "method": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PaymentMethod"
              }
            ],
            "description": "Updated payment method."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Updated internal note."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Updated reference number."
          }
        }
      },
      "ApiLoanPaymentSplit": {
        "type": "object",
        "description": "A split allocating part of a loan payment to principal, interest, or fee.",
        "required": [
          "id",
          "split_type",
          "amount",
          "account"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the split."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the split in your system for linking purposes."
          },
          "split_type": {
            "$ref": "#/components/schemas/LoanPaymentSplitType"
          },
          "amount": {
            "type": "integer",
            "format": "int64",
            "description": "Split amount, in cents. Shares the sign of the payment `amount`, so splits on a reversal are negative."
          },
          "account": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "description": "The ledger account this split posted to."
          }
        }
      },
      "CreateFlexLoanParams": {
        "type": "object",
        "required": [
          "loan_type",
          "display_name",
          "origination_date",
          "original_principal",
          "fee_percentage"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "FLEX_LOAN"
            ],
            "description": "Discriminator. Must be `FLEX_LOAN`."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the loan in your system for linking purposes."
          },
          "display_name": {
            "type": "string",
            "description": "Human-friendly name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Date the loan was originated."
          },
          "parent_ledger_account_identifier": {
            "allOf": [
              {
                "$ref": "#/components/schemas/AccountIdentifier"
              }
            ],
            "nullable": true,
            "description": "Parent ledger account under which the loan's dedicated liability account is created. Defaults to `NOTES_PAYABLE`."
          },
          "original_principal": {
            "type": "integer",
            "format": "int64",
            "description": "Original principal (advance amount), in cents."
          },
          "fee_percentage": {
            "type": "string",
            "description": "Fixed fee, expressed as a percentage in a decimal string (for example, `\"15\"` for a 15% fee)."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Loan proceeds. Optional. On create, sets the loan's initial proceeds. Because creating with an existing `external_id` upserts the loan, on a subsequent call this list is reconciled against the loan's existing proceeds by proceed `external_id` (matched proceeds are updated, existing proceeds that are absent or have no `external_id` are archived, and new entries are created). Omit the field or set it to `null` to leave the existing proceeds untouched. Individual proceeds can also be managed with the loan proceed endpoints.",
            "nullable": true
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the loan."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the loan."
          }
        },
        "title": "Flex loan"
      },
      "PatchFlexLoanParams": {
        "type": "object",
        "required": [
          "loan_type"
        ],
        "properties": {
          "loan_type": {
            "type": "string",
            "enum": [
              "FLEX_LOAN"
            ],
            "description": "Discriminator. Must be `FLEX_LOAN`."
          },
          "display_name": {
            "type": "string",
            "description": "Updated display name for the loan."
          },
          "origination_date": {
            "type": "string",
            "format": "date",
            "description": "Updated origination date."
          },
          "original_principal": {
            "type": "integer",
            "format": "int64",
            "description": "Updated original principal, in cents."
          },
          "fee_percentage": {
            "type": "string",
            "description": "Updated fee, expressed as a percentage in a decimal string."
          },
          "proceeds": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateLoanProceedParams"
            },
            "description": "Replaces the loan's proceeds with this list."
          },
          "reported_balance": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ReportedLoanBalanceParams"
              }
            ],
            "nullable": true,
            "description": "Asserts the loan's outstanding principal at a point in time; Layer derives the opening balance from it, anchored no earlier than the business's activation date. Send this only when you cannot send the loan's history back to its origination, and set `at` to the earliest date you can state the balance for. Omitting it later does not retract it; send `reported_balance` as `null` on an update to do that."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Updated internal note."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Updated reference number."
          }
        },
        "description": "Only include the fields you want to change.",
        "title": "Flex loan"
      },
      "ExpensePaymentParams": {
        "type": "object",
        "properties": {
          "method": {
            "$ref": "#/components/schemas/PaymentMethod",
            "description": "Payment method used for the expense. Defaults to `ACH` when omitted."
          },
          "processor": {
            "type": "string",
            "nullable": true,
            "description": "Processor used for the payment, if any. Do not set this for payment methods that do not support processors, such as `CASH` or `CHECK`."
          },
          "payment_clearing_account_identifier": {
            "$ref": "#/components/schemas/AccountIdentifier",
            "description": "Ledger account used for the payment until the expense is matched to a bank transaction. When both `method` and `payment_clearing_account_identifier` are omitted, this defaults to the Contributions account."
          }
        }
      },
      "NewExpensePostParams": {
        "type": "object",
        "required": [
          "paid_at",
          "line_items",
          "payment"
        ],
        "properties": {
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "Unique ID of the expense in your system. Used for linking and idempotency. If an expense with the same `external_id` already exists, Layer returns the existing expense."
          },
          "paid_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the purchase was paid."
          },
          "vendor_id": {
            "type": "string",
            "format": "uuid",
            "description": "Layer vendor ID. Either `vendor_id` or `vendor_external_id` must be provided."
          },
          "vendor_external_id": {
            "type": "string",
            "description": "Vendor external ID in your system. Either `vendor_id` or `vendor_external_id` must be provided."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Any (typically user-visible) identifier for the expense."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Memo for the expense."
          },
          "line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/NewBillLineItem"
            },
            "description": "Line items for the purchase. Uses the same line item shape as Create bill."
          },
          "additional_sales_taxes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CreateTaxLineItem"
            },
            "description": "Additional sales tax line items applied to the expense total."
          },
          "additional_discount": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Additional discount applied to the expense total, in cents.",
            "default": 0
          },
          "payment": {
            "$ref": "#/components/schemas/ExpensePaymentParams",
            "description": "Payment details for the expense. Expenses are created in `PAID` status with a payment for the full amount."
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TagKeyValue"
            },
            "nullable": true,
            "description": "Tags to associate with the expense."
          },
          "metadata": {
            "$ref": "#/components/schemas/PlatformDefinedJson",
            "nullable": true,
            "description": "Arbitrary custom metadata in JSON format with a size limit of 1KB."
          }
        }
      },
      "ReportedLoanBalanceParams": {
        "type": "object",
        "title": "Reported loan balance",
        "required": [
          "balance",
          "at"
        ],
        "properties": {
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "Outstanding principal of the loan at `at`, in cents. Must not be negative."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "Point in time at which the loan's outstanding principal equaled `balance`."
          }
        },
        "description": "Asserts the loan's outstanding principal at a point in time. Send this only when you cannot send the loan's history back to its origination; if you can send everything, omit it and Layer derives the opening balance from the events themselves. Set `at` to the earliest date you can state the balance for, since events dated before it are rejected. Layer anchors the resulting opening balance no earlier than the business's activation date: if `at` falls on or before activation, the balance is rolled forward through the events between the two and the opening balance is dated at activation; if `at` falls after activation, the opening balance is dated at `at`. `at` cannot precede the loan's `origination_date`, and it cannot postdate history already recorded on the loan. To record history earlier than the current assertion, re-send `reported_balance` with an earlier `at` first, then send the events."
      },
      "ApiLoanOpeningBalance": {
        "type": "object",
        "title": "Loan opening balance",
        "description": "The active opening balance on the loan's ledger account: pre-existing debt recorded against Opening Balance Equity rather than explained by recorded proceeds and payments.",
        "properties": {
          "ledger_account_id": {
            "type": "string",
            "format": "uuid",
            "description": "ID of the loan's ledger account."
          },
          "ledger_account_name": {
            "type": "string",
            "description": "Name of the loan's ledger account."
          },
          "balance": {
            "type": "integer",
            "format": "int64",
            "description": "Opening balance, in cents."
          },
          "effective_at": {
            "type": "string",
            "format": "date-time",
            "description": "Point in time at which the loan's outstanding principal equaled `balance`."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the opening balance was created."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the opening balance was last updated."
          },
          "transaction_tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiTag"
            },
            "description": "Tags associated with the opening balance."
          },
          "memo": {
            "type": "string",
            "nullable": true,
            "description": "Internal note about the opening balance."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "nullable": true,
            "description": "Arbitrary JSON object you can attach for your own use. Layer stores and returns it unchanged."
          },
          "reference_number": {
            "type": "string",
            "nullable": true,
            "description": "Reference number for the opening balance."
          }
        }
      },
      "TripDistanceSource": {
        "type": "string",
        "enum": [
          "MANUAL",
          "COMPUTED"
        ],
        "description": "How the trip distance was determined. `MANUAL` means the distance was provided explicitly; `COMPUTED` means it was calculated as driving distance between `google_start_place_id` and `google_end_place_id`.",
        "example": "COMPUTED"
      },
      "ApiPlaceSuggestion": {
        "type": "object",
        "properties": {
          "place_id": {
            "type": "string",
            "description": "The Google Maps place ID of the suggested address. Pass this to the address details endpoint, or to trip create/update as `google_start_place_id` / `google_end_place_id`."
          },
          "description": {
            "type": "string",
            "description": "The human-readable address suggestion to display."
          }
        },
        "required": [
          "place_id",
          "description"
        ]
      },
      "ApiPlaceDetails": {
        "type": "object",
        "properties": {
          "place_id": {
            "type": "string",
            "description": "The Google Maps place ID of the address."
          },
          "formatted_address": {
            "type": "string",
            "nullable": true,
            "description": "The full formatted address."
          },
          "latitude": {
            "type": "string",
            "nullable": true,
            "description": "The latitude of the address, as a decimal string."
          },
          "longitude": {
            "type": "string",
            "nullable": true,
            "description": "The longitude of the address, as a decimal string."
          }
        },
        "required": [
          "place_id"
        ]
      },
      "ExportRequestStatus": {
        "type": "string",
        "enum": [
          "pending",
          "processing",
          "completed",
          "failed"
        ],
        "description": "Lifecycle status of an async export request.",
        "example": "pending"
      },
      "ExportType": {
        "type": "string",
        "enum": [
          "billing_report",
          "bookkeeping_status_report"
        ],
        "description": "Type of async export.",
        "example": "billing_report"
      },
      "ApiExport": {
        "type": "object",
        "description": "An async export request and its current status.",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Export`.",
            "example": "Export"
          },
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique identifier for the export request."
          },
          "business_id": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Business associated with the export, if applicable. Null for client-scoped exports such as billing and bookkeeping status reports."
          },
          "export_type": {
            "$ref": "#/components/schemas/ExportType"
          },
          "status": {
            "$ref": "#/components/schemas/ExportRequestStatus"
          },
          "params": {
            "type": "object",
            "additionalProperties": true,
            "description": "Parameters used to generate the export. Shape depends on export_type."
          },
          "download_url": {
            "type": "string",
            "nullable": true,
            "description": "Presigned URL to download the completed file. Present only when status is completed."
          },
          "file_name": {
            "type": "string",
            "nullable": true,
            "description": "Suggested filename for the export artifact."
          },
          "error": {
            "type": "string",
            "nullable": true,
            "description": "Error message when status is failed."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the export request was created."
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When export processing started."
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the export completed successfully."
          },
          "failed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When the export failed."
          }
        },
        "required": [
          "id",
          "export_type",
          "status",
          "params",
          "created_at"
        ]
      },
      "BillingReportExportParameters": {
        "type": "object",
        "description": "Parameters for requesting a rolling 3-month bookkeeping billing report.",
        "properties": {
          "end_month": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12,
            "description": "Ending month (1-12) of the rolling 3-month billing window."
          },
          "end_year": {
            "type": "integer",
            "description": "Ending year of the rolling 3-month billing window."
          },
          "pnl_structure": {
            "allOf": [
              {
                "$ref": "#/components/schemas/PnlTemplates"
              }
            ],
            "description": "Optional P&L structure template used when calculating trailing revenue. Defaults to the client's industry default."
          }
        },
        "required": [
          "end_month",
          "end_year"
        ]
      },
      "BookkeepingStatusReportExportParameters": {
        "type": "object",
        "description": "Options for the client-wide bookkeeping status XLSX export. Send an empty object to use both defaults.",
        "properties": {
          "use_derived_status": {
            "type": "boolean",
            "default": false,
            "description": "When true, calculate period statuses from current bookkeeping facts rather than using stored statuses."
          },
          "require_onboarding_call": {
            "type": "boolean",
            "default": true,
            "description": "When deriving statuses, require the onboarding date to have passed before reporting an actionable period status. Has no effect unless use_derived_status is true."
          }
        }
      },
      "BookkeepingEnrollmentStatus": {
        "type": "string",
        "enum": [
          "NOT_PURCHASED",
          "ONBOARDING",
          "ACTIVE",
          "BOOKKEEPING_PAUSED"
        ],
        "description": "Bookkeeping enrollment status for a business.",
        "example": "ACTIVE"
      },
      "BookkeepingOnboardingStatus": {
        "type": "string",
        "enum": [
          "ONBOARDED",
          "UNSCHEDULED",
          "SCHEDULED",
          "NO_SHOWED",
          "RESCHEDULED"
        ],
        "description": "Derived onboarding call status for a business. ONBOARDED when onboarding_date is set. Otherwise derived from active BOOKKEEPING_ONBOARDING call bookings: UNSCHEDULED (no calls), SCHEDULED (today or future call only), NO_SHOWED (past call only), RESCHEDULED (past and future calls).",
        "example": "ONBOARDED"
      },
      "BookkeepingReportingPeriodScale": {
        "type": "string",
        "enum": [
          "MONTHLY",
          "ANNUAL"
        ],
        "example": "MONTHLY"
      },
      "BookkeepingReportingPeriodStatus": {
        "type": "string",
        "enum": [
          "NOT_ONBOARDED",
          "IN_PROGRESS",
          "AWAITING_BUSINESS",
          "BLOCKED_ON_BUSINESS",
          "CLOSING_BOOKKEEPER_REVIEW",
          "CLOSED_PROVISIONALLY",
          "CLOSED_COMPLETE"
        ],
        "description": "Reporting status returned for a bookkeeping period. Inactive periods are omitted from period lists.",
        "example": "IN_PROGRESS"
      },
      "BookkeepingReportingBillingStatus": {
        "type": "string",
        "enum": [
          "ACTIVE",
          "CATCHUP",
          "NON_BILLABLE"
        ],
        "description": "Whether the period is actively billable, catch-up, or non-billable.",
        "example": "ACTIVE"
      },
      "ApiBookkeepingReportingBusiness": {
        "type": "object",
        "description": "Lightweight summary of a business enrolled in bookkeeping.",
        "properties": {
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "The bookkeeping business."
          },
          "onboarding_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Date bookkeeping onboarding was marked complete. Null while onboarding."
          },
          "first_bookkeeping_months": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "First month Layer is responsible for, including any catch-up window."
          },
          "user_requested_catchup_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "First bookkeeping month requested by the user. Null when no catch-up request exists."
          },
          "enrollment_status": {
            "$ref": "#/components/schemas/BookkeepingEnrollmentStatus"
          },
          "onboarding_status": {
            "$ref": "#/components/schemas/BookkeepingOnboardingStatus"
          },
          "churned_at": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Date enrollment was paused or churned. Null unless the business is paused."
          }
        },
        "required": [
          "business_id",
          "enrollment_status",
          "onboarding_status"
        ]
      },
      "ApiBookkeepingReportingClosedPeriod": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "year": {
            "type": "integer"
          },
          "month": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12
          }
        },
        "required": [
          "id",
          "year",
          "month"
        ]
      },
      "ApiBookkeepingReportingSummary": {
        "type": "object",
        "description": "Enrollment, outstanding work, bank connection health, latest close, and latest inbound SMS for a single business.",
        "properties": {
          "business_id": {
            "type": "string",
            "format": "uuid",
            "description": "The business this summary describes."
          },
          "onboarding_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Date bookkeeping onboarding was marked complete. Null if still onboarding or not enrolled."
          },
          "first_bookkeeping_months": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "First month Layer is responsible for (start of the books subscription / catch-up window)."
          },
          "user_requested_catchup_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "First bookkeeping month requested by the user. Null when no catch-up request exists."
          },
          "enrollment_status": {
            "$ref": "#/components/schemas/BookkeepingEnrollmentStatus"
          },
          "onboarding_status": {
            "$ref": "#/components/schemas/BookkeepingOnboardingStatus"
          },
          "bookkeeping_end_date": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Last billable month when bookkeeping is paused. Null while actively enrolled."
          },
          "churned_at": {
            "type": "string",
            "format": "date",
            "nullable": true,
            "description": "Date enrollment was paused or churned. Null if not paused."
          },
          "periods_awaiting_business_count": {
            "type": "integer",
            "description": "How many periods are currently blocked waiting on the business."
          },
          "latest_closed_period": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ApiBookkeepingReportingClosedPeriod"
              }
            ],
            "nullable": true,
            "description": "Most recent monthly period that has been closed. Null if none."
          },
          "pending_business_tasks_count": {
            "type": "integer",
            "description": "Open tasks across the business that still need a response."
          },
          "last_message_received_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Timestamp of the most recent SMS received from this business. Null if none."
          },
          "disconnected_bank_accounts": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of bank accounts whose connection needs repair and for which disconnection notifications remain enabled."
          },
          "bookkeeper_name": {
            "type": "string",
            "nullable": true,
            "description": "Full name of the assigned bookkeeper. Null if no bookkeeper is assigned."
          },
          "primary_blocker": {
            "type": "string",
            "enum": [
              "DISCONNECTED_BANK_ACCOUNT",
              "MISSING_BANK_STATEMENT",
              "CUSTOMER_MUST_CONNECT_BANK_ACCOUNT",
              "MISSING_CONTACT_INFORMATION",
              "OPEN_TASK"
            ],
            "nullable": true,
            "description": "Primary issue blocking bookkeeping. `DISCONNECTED_BANK_ACCOUNT`: a connected bank account needs its connection repaired. `MISSING_BANK_STATEMENT`: an open task asks the customer to upload a bank statement. `CUSTOMER_MUST_CONNECT_BANK_ACCOUNT`: an open task asks the customer to connect a bank account. `MISSING_CONTACT_INFORMATION`: an unanswered Share phone number task requests a phone number for ongoing bookkeeping questions and flags actionable open periods across the business. This does not prevent an otherwise-complete period from closing. `OPEN_TASK`: any other open business task. If more than one applies, the first value in this list takes precedence. Null if none applies."
          },
          "open_asks": {
            "type": "string",
            "description": "All applicable open ask categories, separated by a comma and a space, with each category included once. Categories appear in this order: `MISSING_CONTACT_INFORMATION`, `DISCONNECTED_BANK_ACCOUNT`, `CUSTOMER_MUST_CONNECT_BANK_ACCOUNT`, `MISSING_BANK_STATEMENT`, `OPEN_TASK`. Categories use the same meanings as `primary_blocker`. `OPEN_TASK` also appears when normal pending tasks coexist with specialized blockers. Returns an empty string when no categories apply. This display order does not change the priority used to select `primary_blocker`.",
            "example": "MISSING_CONTACT_INFORMATION, DISCONNECTED_BANK_ACCOUNT, MISSING_BANK_STATEMENT, OPEN_TASK"
          },
          "upcoming_onboarding_call": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ApiUpcomingOnboardingCall"
              }
            ],
            "nullable": true,
            "description": "The next bookkeeping onboarding call, through one hour after its scheduled time. Null if none."
          }
        },
        "required": [
          "business_id",
          "enrollment_status",
          "onboarding_status",
          "periods_awaiting_business_count",
          "pending_business_tasks_count",
          "disconnected_bank_accounts",
          "open_asks"
        ]
      },
      "ApiUpcomingOnboardingCall": {
        "type": "object",
        "description": "A bookkeeping onboarding call that has not ended more than one hour ago.",
        "properties": {
          "booked_at": {
            "type": "string",
            "format": "date-time",
            "description": "Time when the call booking was created."
          },
          "scheduled_time": {
            "type": "string",
            "format": "date-time",
            "description": "Scheduled start time of the call."
          }
        },
        "required": [
          "booked_at",
          "scheduled_time"
        ]
      },
      "ApiBookkeepingReportingClosingTimeline": {
        "type": "object",
        "description": "Milestone timestamps for closing a bookkeeping period. Null means the milestone has not happened or was not recorded.",
        "properties": {
          "started_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "first_awaiting_business_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "closing_started_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "first_closing_tasks_sent_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "in_review_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "last_task_completed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "waiting_for_business_since": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "provisionally_closed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "closed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "ApiBookkeepingReportingPeriod": {
        "type": "object",
        "description": "Historical status and task metrics for a single bookkeeping period.",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Unique period identifier."
          },
          "year": {
            "type": "integer",
            "description": "Calendar year for the period."
          },
          "month": {
            "type": "integer",
            "minimum": 1,
            "maximum": 12,
            "nullable": true,
            "description": "Calendar month (1-12). Null for annual periods."
          },
          "scale": {
            "$ref": "#/components/schemas/BookkeepingReportingPeriodScale"
          },
          "status": {
            "$ref": "#/components/schemas/BookkeepingReportingPeriodStatus"
          },
          "billing_status": {
            "$ref": "#/components/schemas/BookkeepingReportingBillingStatus"
          },
          "closing_timeline": {
            "$ref": "#/components/schemas/ApiBookkeepingReportingClosingTimeline"
          },
          "open_tasks": {
            "type": "integer",
            "description": "Active period tasks where the business has not responded."
          },
          "completed_tasks": {
            "type": "integer",
            "description": "Period tasks with a business response."
          },
          "avg_task_response_time_seconds": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "Average time from task creation to business response, in seconds. Null if no responded tasks."
          }
        },
        "required": [
          "id",
          "year",
          "scale",
          "status",
          "billing_status",
          "closing_timeline",
          "open_tasks",
          "completed_tasks"
        ]
      },
      "ApiBookkeepingReportingPeriods": {
        "type": "object",
        "properties": {
          "status": {
            "$ref": "#/components/schemas/ApiBookkeepingReportingSummary",
            "description": "Current bookkeeping reporting status for the business."
          },
          "periods": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ApiBookkeepingReportingPeriod"
            }
          }
        },
        "required": [
          "status",
          "periods"
        ]
      },
      "ReceiptParseResultSource": {
        "type": "string",
        "enum": [
          "SMS",
          "BOOKKEEPER_UPLOAD"
        ],
        "description": "How the receipt was ingested. SMS indicates the receipt was received via text message. BOOKKEEPER_UPLOAD indicates the receipt was uploaded directly through the API.",
        "example": "BOOKKEEPER_UPLOAD"
      },
      "ReceiptParseResultStatus": {
        "type": "string",
        "enum": [
          "NON_RECEIPT",
          "READY_FOR_BILL",
          "NEEDS_REVIEW",
          "MATCHED_NEEDS_REVIEW"
        ],
        "description": "The current state of the parsed receipt. NON_RECEIPT indicates the uploaded document was not recognized as a receipt. READY_FOR_BILL indicates the receipt was parsed with enough confidence to create a bill. NEEDS_REVIEW indicates a bookkeeper must review the proposed values before a bill is created. MATCHED_NEEDS_REVIEW indicates the receipt was matched to an existing bill or expense that needs review.",
        "example": "READY_FOR_BILL"
      },
      "ReceiptParseResultMatchedVendor": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the matched vendor."
          },
          "external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external id of the matched vendor, if one was set."
          },
          "display_name": {
            "type": "string",
            "description": "The display name of the matched vendor."
          }
        },
        "required": [
          "id",
          "display_name"
        ],
        "description": "The vendor matched to this receipt, if any."
      },
      "ReceiptParseResultLineItem": {
        "type": "object",
        "properties": {
          "description": {
            "type": "string",
            "nullable": true,
            "description": "The proposed line item description."
          },
          "proposed_amount_cents": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "The proposed amount for this line item, in cents."
          },
          "proposed_account": {
            "$ref": "#/components/schemas/SingleApiChartAccount",
            "nullable": true,
            "description": "The proposed chart of account for this line item."
          }
        }
      },
      "ApiReceiptParseResult": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Resource type. Value will be `Receipt_Parse_Result`.",
            "example": "Receipt_Parse_Result"
          },
          "business_document_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the uploaded receipt document."
          },
          "source_s3_document_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the underlying stored document."
          },
          "source": {
            "$ref": "#/components/schemas/ReceiptParseResultSource"
          },
          "status": {
            "$ref": "#/components/schemas/ReceiptParseResultStatus"
          },
          "message_log_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the SMS message log associated with this receipt, if the receipt was ingested via SMS.",
            "nullable": true
          },
          "bill_id": {
            "type": "string",
            "format": "uuid",
            "description": "The UUID of the bill created from this receipt, if one has been created.",
            "nullable": true
          },
          "proposed_paid_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "The proposed date the receipt was paid."
          },
          "proposed_vendor_display": {
            "type": "string",
            "nullable": true,
            "description": "The proposed vendor name as parsed from the receipt."
          },
          "proposed_vendor_external_id": {
            "type": "string",
            "nullable": true,
            "description": "The external id of the proposed vendor, if a matching vendor was found."
          },
          "matched_vendor": {
            "$ref": "#/components/schemas/ReceiptParseResultMatchedVendor",
            "nullable": true,
            "description": "The vendor matched to this receipt, if any."
          },
          "proposed_amount_cents": {
            "type": "integer",
            "format": "int64",
            "nullable": true,
            "description": "The proposed total amount of the receipt, in cents."
          },
          "proposed_line_items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ReceiptParseResultLineItem"
            },
            "description": "The proposed line items parsed from the receipt."
          },
          "rejected_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "When this receipt parse result was rejected, if it was rejected."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the receipt was uploaded."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the receipt parse result was last updated."
          }
        },
        "required": [
          "business_document_id",
          "source_s3_document_id",
          "source",
          "status",
          "proposed_line_items",
          "created_at",
          "updated_at"
        ]
      }
    },
    "examples": {
      "ScheduleCReportExample": {
        "summary": "Example Schedule C Report",
        "value": {
          "business_id": "550e8400-e29b-41d4-a716-446655440000",
          "year": 2025,
          "reporting_basis": "ACCRUAL",
          "line_items": [
            {
              "line_number": "1",
              "line_name": "Gross receipts or sales",
              "part": "Part I - Income",
              "amount": 15000000
            },
            {
              "line_number": "2",
              "line_name": "Returns and allowances",
              "part": "Part I - Income",
              "amount": 50000
            },
            {
              "line_number": "24b",
              "line_name": "Deductible meals",
              "part": "Part II - Expenses",
              "amount": 250000
            }
          ]
        }
      }
    }
  },
  "security": [
    {
      "BearerAuth": []
    }
  ]
}
