{
  "openapi": "3.0.0",
  "info": {
    "title": "Prosaic Public API",
    "version": "1.0.0",
    "description": "Prosaic is AI accounting software designed for accountants and bookkeepers.\n\nWant to get started developing with us? Get in touch at developer@prosaic.works.\n\nLearn more about Prosaic or start free a free trial at https://www.prosaic.works.\n\nBy using the Prosaic API, you agree to our [Developer API Terms](https://www.prosaic.works/developer-api-terms).\n\n## Authentication\n\nEvery request must be authenticated. Prosaic supports two methods, and both send their credential as a bearer token:\n\n```\nAuthorization: Bearer <api-key-or-access-token>\n```\n\n- **API key** — the quickest way to get started. Ideal for scripts, server-side jobs, and your own integrations.\n- **OAuth 2.1** — for applications acting on behalf of other Prosaic users. Requires a registered OAuth app.\n\nAlways send credentials over HTTPS, and never embed them in client-side code.\n\n### API key\n\n1. In Prosaic, go to **Settings → Users**.\n2. Find the user the key should act as (often yourself), open its **Actions** menu (⋯), and choose **Manage API keys** (workspace owners and admins only).\n3. Click **Create API key**, set a name and expiry, then **copy the key** — it begins with `prsk_` and is shown only once.\n\n`GET /api/public/v1/me` returns the authenticated user and is the simplest way to confirm your credential works:\n\n```bash\ncurl https://app.prosaic.works/api/public/v1/me \\\n  -H \"Authorization: Bearer prsk_your_api_key\"\n```\n\nA key acts as its user and can reach every workspace that user belongs to. If the user is in multiple workspaces, target one with the optional `x-workspace-id` header; otherwise the user's active workspace is used.\n\n### OAuth 2.1\n\nUse OAuth when your application accesses Prosaic on behalf of other users. Prosaic uses the **Authorization Code flow with PKCE** — an `S256` code challenge is required.\n\n**Register your app first.** A workspace admin or owner registers it in Prosaic under **Settings → Developer** with its name, redirect URI(s) and type; if that page isn't in your workspace yet, email **hello@prosaic.works**. You'll receive a `client_id` (plus a `client_secret` for confidential web apps; native and single-page apps are public clients that use PKCE without a secret). Until Prosaic reviews it, an app can connect to five workspaces besides your own; request a review from the same page.\n\n**Scopes:** `openid` (required), `profile`, `email`, and `offline_access` (request it to receive a refresh token).\n\n**Endpoints** (also published at `https://app.prosaic.works/.well-known/oauth-authorization-server`):\n\n- Authorize — `https://app.prosaic.works/api/auth/oauth2/authorize`\n- Token — `https://app.prosaic.works/api/auth/oauth2/token`\n- Token verification (JWKS) — `https://app.prosaic.works/api/auth/jwks`\n\n**1. Redirect the user to the authorization endpoint**, including your PKCE challenge and a random `state`:\n\n```\nhttps://app.prosaic.works/api/auth/oauth2/authorize?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=openid%20profile%20email%20offline_access&code_challenge=YOUR_CODE_CHALLENGE&code_challenge_method=S256&state=RANDOM_STATE\n```\n\nAfter the user signs in and approves, Prosaic redirects back to your `redirect_uri` with a `code`.\n\n**2. Exchange the code for tokens**, sending the matching `code_verifier`. Confidential web apps also authenticate with their `client_secret` (HTTP Basic, or a `client_secret` form field):\n\n```bash\ncurl -X POST https://app.prosaic.works/api/auth/oauth2/token \\\n  -H \"Content-Type: application/x-www-form-urlencoded\" \\\n  -d grant_type=authorization_code \\\n  -d code=AUTHORIZATION_CODE \\\n  -d redirect_uri=YOUR_REDIRECT_URI \\\n  -d client_id=YOUR_CLIENT_ID \\\n  -d code_verifier=YOUR_CODE_VERIFIER\n```\n\nA successful response returns your tokens:\n\n```json\n{\n  \"access_token\": \"...\",\n  \"token_type\": \"Bearer\",\n  \"expires_in\": 86400,\n  \"refresh_token\": \"...\",\n  \"scope\": \"openid profile email offline_access\"\n}\n```\n\n**3. Call the API** using the access token (valid for 24 hours):\n\n```bash\ncurl https://app.prosaic.works/api/public/v1/me \\\n  -H \"Authorization: Bearer ACCESS_TOKEN\"\n```\n\n**4. Refresh** when the access token expires, using the refresh token (valid for 30 days, returned only with `offline_access`):\n\n```bash\ncurl -X POST https://app.prosaic.works/api/auth/oauth2/token \\\n  -H \"Content-Type: application/x-www-form-urlencoded\" \\\n  -d grant_type=refresh_token \\\n  -d refresh_token=YOUR_REFRESH_TOKEN \\\n  -d client_id=YOUR_CLIENT_ID\n```\n\n## Date formats\n\nDate query parameters (for example `startDate`, `endDate`, `asOfDate`) must use **YYYY-MM-DD** calendar dates. An optional ISO 8601 time suffix is accepted (for example `2024-04-01T00:00:00.000Z`). Regional formats such as **DD-MM-YYYY** are rejected and return a `400` validation error.\n\nSee the `IsoDateString` schema in components for the exact pattern.\n\n## Common Workflows\n\nWhen working with the Prosaic API, you'll typically follow this lookup order to retrieve reference data needed for transactions and journals:\n\n1. **GET /api/public/v1/entities** — Retrieve entities, which include:\n   - `taxRates[]` — Available tax rates (GST codes like GST15, EXEMPT, ZERO) for use in the `taxCode` field when reconciling transactions or creating chart accounts\n   - `bankAccounts[]` — Linked bank accounts for each entity\n\n2. **GET /api/public/v1/entities/{entityId}/charts** — Retrieve the chart of accounts (account codes) for a specific entity\n\n3. Use the `taxRates[].code` values (from step 1) as the `taxCode` field when reconciling transactions or creating child accounts\n\n4. Use the `charts[].code` values (from step 2) as the `code` field in reconciliation assignment lines or when creating journals",
    "contact": {
      "name": "Prosaic Support",
      "url": "https://www.prosaic.works",
      "email": "developer@prosaic.works"
    }
  },
  "servers": [
    {
      "url": "https://app.prosaic.works",
      "description": "Prosaic API Server"
    }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Generate an API key in Settings → Users → Actions (⋯) → Manage API keys, then provide it as: Bearer prsk_..."
      },
      "OAuth2": {
        "type": "oauth2",
        "description": "OAuth 2.1 authorization with PKCE support (S256 code challenge required).\n\n**Discovery Endpoints:**\n- OpenID Configuration: `/.well-known/openid-configuration`\n- OAuth Authorization Server: `/.well-known/oauth-authorization-server`\n- OAuth Protected Resource (MCP): `/.well-known/oauth-protected-resource`\n- JWKS (for token verification): `/api/auth/jwks`\n\n**Dynamic Client Registration:** Supported via POST to `/api/auth/oauth2/register`\n\n**Token Verification:** Access tokens are JWT-signed with EdDSA (Ed25519). Verify using the JWKS endpoint.",
        "flows": {
          "authorizationCode": {
            "authorizationUrl": "https://app.prosaic.works/api/auth/oauth2/authorize",
            "tokenUrl": "https://app.prosaic.works/api/auth/oauth2/token",
            "scopes": {
              "openid": "Verify your identity (required for OIDC)",
              "profile": "Access your profile information (name, picture)",
              "email": "Access your email address",
              "offline_access": "Request refresh tokens for long-lived access"
            }
          }
        }
      }
    },
    "schemas": {
      "ApiSuccessResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "description": "The response data"
          },
          "meta": {
            "type": "object",
            "properties": {
              "count": {
                "type": "number",
                "description": "Total number of items returned"
              }
            }
          }
        }
      },
      "ApiErrorResponse": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string",
            "description": "Error message"
          },
          "code": {
            "type": "string",
            "description": "Error code for programmatic handling"
          }
        }
      },
      "IsoDateString": {
        "type": "string",
        "format": "date",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}($|T)",
        "description": "Calendar date in YYYY-MM-DD format (ISO 8601). An optional time suffix (for example `T00:00:00.000Z`) is accepted. Regional formats such as DD-MM-YYYY are rejected.",
        "example": "2024-04-01"
      },
      "PublicContact": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/PublicBusinessContact"
          },
          {
            "$ref": "#/components/schemas/PublicIndividualContact"
          }
        ],
        "discriminator": {
          "propertyName": "type",
          "mapping": {
            "BUSINESS": "#/components/schemas/PublicBusinessContact",
            "INDIVIDUAL": "#/components/schemas/PublicIndividualContact"
          }
        }
      },
      "PublicContactBase": {
        "type": "object",
        "required": [
          "id",
          "workspaceId",
          "entityId",
          "status",
          "displayName",
          "legalName",
          "identifierScheme",
          "identifier",
          "gstNumber",
          "website",
          "notes",
          "invoiceNotes",
          "organisationId",
          "receivesInvoices",
          "addresses",
          "phones",
          "organisation",
          "createdAt",
          "updatedAt",
          "archivedAt"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "workspaceId": {
            "type": "string",
            "format": "uuid"
          },
          "entityId": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "type": "string",
            "enum": ["active", "archived"]
          },
          "displayName": {
            "type": "string"
          },
          "legalName": {
            "type": "string",
            "nullable": true
          },
          "identifierScheme": {
            "type": "string",
            "nullable": true
          },
          "identifier": {
            "type": "string",
            "nullable": true
          },
          "gstNumber": {
            "type": "string",
            "nullable": true
          },
          "website": {
            "type": "string",
            "nullable": true
          },
          "notes": {
            "type": "string",
            "nullable": true
          },
          "invoiceNotes": {
            "type": "string",
            "nullable": true
          },
          "organisationId": {
            "type": "string",
            "format": "uuid",
            "nullable": true
          },
          "receivesInvoices": {
            "type": "boolean"
          },
          "addresses": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "phones": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "organisation": {
            "type": "object",
            "nullable": true,
            "required": ["id", "displayName"],
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "displayName": {
                "type": "string"
              }
            }
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          }
        }
      },
      "PublicBusinessContact": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PublicContactBase"
          },
          {
            "type": "object",
            "required": ["type", "people"],
            "properties": {
              "type": {
                "type": "string",
                "enum": ["BUSINESS"]
              },
              "people": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PublicContactPerson"
                }
              }
            }
          }
        ]
      },
      "PublicIndividualContact": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PublicContactBase"
          },
          {
            "type": "object",
            "required": ["type", "emails"],
            "properties": {
              "type": {
                "type": "string",
                "enum": ["INDIVIDUAL"]
              },
              "emails": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PublicContactEmail"
                }
              }
            }
          }
        ]
      },
      "PublicContactEmail": {
        "type": "object",
        "required": ["id", "email", "label"],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "label": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "PublicContactPerson": {
        "type": "object",
        "required": [
          "id",
          "displayName",
          "receivesInvoices",
          "status",
          "archivedAt",
          "emails"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "displayName": {
            "type": "string"
          },
          "receivesInvoices": {
            "type": "boolean"
          },
          "status": {
            "type": "string",
            "enum": ["active", "archived"]
          },
          "archivedAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "emails": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PublicContactEmail"
            }
          }
        }
      },
      "GeneralLedgerEntry": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "description": "Journal line ID"
          },
          "journalId": {
            "type": "string",
            "format": "uuid",
            "description": "Physical journal ID"
          },
          "logicalJournalId": {
            "type": "string",
            "format": "uuid",
            "description": "Logical journal ID for deep linking"
          },
          "date": {
            "type": "string",
            "format": "date",
            "description": "Journal date as an NZ calendar date (YYYY-MM-DD). Matches the NZ-timezone period filtering, so a transaction always appears under the same NZ date it is filtered by.",
            "example": "2026-05-31"
          },
          "narration": {
            "type": "string",
            "description": "Journal-level narration"
          },
          "description": {
            "type": "string",
            "description": "Line-level description"
          },
          "lineType": {
            "type": "string",
            "enum": ["user", "generated-bank-line", "generated-tax-line"]
          },
          "parentId": {
            "type": "string",
            "format": "uuid",
            "nullable": true,
            "description": "Parent line ID for tax lines"
          },
          "source": {
            "type": "string",
            "description": "Human-readable source label (Bank Rec, Manual Journal, System, Reversal)"
          },
          "journalStatus": {
            "type": "string",
            "description": "Journal status (posted, voided)"
          },
          "debit": {
            "type": "string",
            "description": "Debit amount (5 decimal places)"
          },
          "credit": {
            "type": "string",
            "description": "Credit amount (5 decimal places)"
          },
          "net": {
            "type": "string",
            "description": "Net amount (debit - credit, 5 decimal places)"
          },
          "gross": {
            "type": "string",
            "description": "Gross amount including GST"
          },
          "runningBalance": {
            "type": "string",
            "description": "Cumulative account balance after this line, debits minus credits. Positive is a debit balance, negative a credit balance, for every account type."
          },
          "gstAmount": {
            "type": "string",
            "description": "GST amount (positive for expenses, negative for revenue)"
          },
          "taxRate": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "name": {
                "type": "string"
              },
              "rate": {
                "type": "string"
              }
            }
          },
          "bankTransaction": {
            "type": "object",
            "nullable": true,
            "properties": {
              "id": {
                "type": "string",
                "format": "uuid"
              },
              "date": {
                "type": "string",
                "format": "date"
              },
              "amount": {
                "type": "string"
              },
              "type": {
                "type": "string",
                "enum": ["DEBIT", "CREDIT"]
              },
              "description": {
                "type": "string"
              },
              "particulars": {
                "type": "string"
              },
              "code": {
                "type": "string"
              },
              "merchant": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "provider": {
                    "type": "string"
                  },
                  "identifier": {
                    "type": "string"
                  }
                }
              },
              "category": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "groupName": {
                    "type": "string"
                  },
                  "provider": {
                    "type": "string"
                  }
                }
              },
              "bankAccount": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "accountNumber": {
                    "type": "string"
                  },
                  "institution": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "ReportGroupSummary": {
        "type": "object",
        "nullable": true,
        "description": "Saved reporting placement, independent of the legacy subtype; null when unassigned.",
        "required": ["id", "key", "name", "status", "accountType"],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "accountType": {
            "type": "string"
          }
        }
      },
      "ReportCategorySummary": {
        "type": "object",
        "nullable": true,
        "description": "Saved account meaning; null is valid for a group-only assignment.",
        "required": ["id", "key", "name", "status"],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "status": {
            "type": "string"
          }
        }
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "OAuth2": ["openid", "profile", "email"]
    }
  ],
  "paths": {
    "/api/public/v1/charts/{chartId}/accounts/{accountId}/delete": {
      "post": {
        "summary": "Delete a single account from a chart of accounts template",
        "description": "Removes one account from a chart of accounts template without resending the full account list.\nThe removal propagates to every entity using the template. Accounts that have journal entries,\nchild accounts, or are system accounts cannot be removed. `accountId` is the TemplateAccount ID\nfrom `GET /charts/{chartId}`. Requires API key authentication.\n",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "chartId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "accountId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedUpdatedAt": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        },
                        "entitiesUpdated": {
                          "type": "number"
                        }
                      },
                      "required": ["success", "entitiesUpdated"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Account has journal entries, has children, or is a system account"
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Chart or account not found"
          }
        },
        "operationId": "charts.deleteAccount",
        "x-sdk-resource": "charts",
        "x-sdk-method": "deleteAccount"
      }
    },
    "/api/public/v1/charts/{chartId}/accounts/{accountId}/update": {
      "post": {
        "summary": "Update a single account in a chart of accounts template",
        "description": "Discover the current workspace contract at GET /api/public/v1/report-categories before writing. In activated workspaces, included accounts need groupKey and an explicit categoryKey (null is valid for eligible group-only accounts); type derives from the group. Parent-only and mixed classification writes are rejected. Nonactivated workspaces retain parent inputs and reject reporting inputs. Metadata-only updates preserve saved reporting. API writes do not confirm template review or approve propagation. Reporting edits require saved template and row versions; reload after 409, and never retry using an alternate request shape.\nUpdates one account in a chart of accounts template without resending the full account list.\nSupports `name`, `description`, `taxCode`, `mappedCode` and `code` (rename, kept under the same\nparent). A code rename cascades non-destructively to every entity account derived from this\ntemplate account (balances and customizations are preserved). Metadata changes follow existing propagation policy for entities\nusing the template. Omitted fields preserve their existing values; send `description: null` to\nclear the description. `accountId` is the TemplateAccount ID from `GET /charts/{chartId}`.\nReporting changes remain subject to human review before propagation. Requires bearer authentication.\n",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "chartId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "accountId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "expectedTemplateUpdatedAt": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string",
                    "nullable": true
                  },
                  "taxCode": {
                    "type": "string",
                    "enum": [
                      "NZ_GST_15_INC",
                      "NZ_GST_15_EXP",
                      "NZ_GST_0_NONE",
                      "NZ_GST_0_ZERO",
                      "AU_GST_10_INC",
                      "AU_GST_10_EXP",
                      "AU_GST_0_NONE",
                      "AU_GST_0_INPUT",
                      "AU_GST_0_EXPORT"
                    ],
                    "nullable": true
                  },
                  "mappedCode": {
                    "type": "string",
                    "nullable": true
                  },
                  "code": {
                    "type": "string"
                  },
                  "id": {
                    "type": "string"
                  },
                  "clientKey": {
                    "type": "string"
                  },
                  "groupKey": {
                    "type": "string"
                  },
                  "categoryKey": {
                    "type": "string",
                    "nullable": true
                  },
                  "systemRole": {
                    "type": "string",
                    "nullable": true
                  },
                  "expectedUpdatedAt": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "entitiesUpdated": {
                          "type": "number"
                        }
                      },
                      "required": ["id", "entitiesUpdated"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation error or business rule violation"
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Chart or account not found"
          },
          "409": {
            "description": "The new code conflicts with an existing template or entity account"
          }
        },
        "operationId": "charts.updateAccount",
        "x-sdk-resource": "charts",
        "x-sdk-method": "updateAccount"
      }
    },
    "/api/public/v1/charts/{chartId}/accounts": {
      "post": {
        "summary": "Add a single account to a chart of accounts template",
        "description": "Discover the current workspace contract at GET /api/public/v1/report-categories before writing. In activated workspaces, included accounts need groupKey and an explicit categoryKey (null is valid for eligible group-only accounts); type derives from the group. Parent-only and mixed classification writes are rejected. Nonactivated workspaces retain parent inputs and reject reporting inputs. Metadata-only updates preserve saved reporting. API writes do not confirm template review or approve propagation. Reporting edits require saved template and row versions; reload after 409, and never retry using an alternate request shape.\nAdds one account to a chart of accounts template without resending the full account list. To\nadd a legacy top-level account in a nonactivated workspace, provide its global account `code`; to add a legacy child\naccount, provide `code`, `name`, and `parentCode` (the child code must be `{parentCode}.{digits}`).\nActivated rows use the explicit fields above and remain subject to review before reporting propagation. Requires bearer authentication.\n",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "chartId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string",
                    "nullable": true
                  },
                  "parentCode": {
                    "type": "string",
                    "nullable": true
                  },
                  "taxCode": {
                    "type": "string",
                    "enum": [
                      "NZ_GST_15_INC",
                      "NZ_GST_15_EXP",
                      "NZ_GST_0_NONE",
                      "NZ_GST_0_ZERO",
                      "AU_GST_10_INC",
                      "AU_GST_10_EXP",
                      "AU_GST_0_NONE",
                      "AU_GST_0_INPUT",
                      "AU_GST_0_EXPORT"
                    ],
                    "nullable": true
                  },
                  "description": {
                    "type": "string",
                    "nullable": true
                  },
                  "mappedCode": {
                    "type": "string",
                    "nullable": true
                  },
                  "id": {
                    "type": "string"
                  },
                  "clientKey": {
                    "type": "string"
                  },
                  "groupKey": {
                    "type": "string"
                  },
                  "categoryKey": {
                    "type": "string",
                    "nullable": true
                  },
                  "systemRole": {
                    "type": "string",
                    "nullable": true
                  },
                  "expectedUpdatedAt": {
                    "type": "string"
                  }
                },
                "required": ["code"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "nullable": true
                        },
                        "code": {
                          "type": "string"
                        },
                        "entitiesUpdated": {
                          "type": "number"
                        }
                      },
                      "required": ["id", "code", "entitiesUpdated"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation error or business rule violation"
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Chart not found"
          },
          "409": {
            "description": "An account with this code already exists, or the code conflicts with a custom entity account"
          }
        },
        "operationId": "charts.createAccount",
        "x-sdk-resource": "charts",
        "x-sdk-method": "createAccount"
      }
    },
    "/api/public/v1/charts/{chartId}/delete": {
      "post": {
        "summary": "Delete a chart of accounts template",
        "description": "Deletes a chart of accounts template. Cannot delete templates with assigned entities. Requires API key authentication.",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "chartId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        }
                      },
                      "required": ["success"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Chart not found"
          },
          "409": {
            "description": "Cannot delete template with assigned entities"
          }
        },
        "operationId": "charts.del",
        "x-sdk-resource": "charts",
        "x-sdk-method": "del"
      }
    },
    "/api/public/v1/charts/{chartId}": {
      "get": {
        "summary": "Get chart of accounts template accounts",
        "description": "Returns paginated accounts from a chart-of-accounts **template** (the read-only blueprint entities are provisioned from). When `includeHidden=true`, also returns global accounts not in the template with `isIncluded=false`. Requires API key authentication.\n\nEach included account also exposes its nullable confirmed systemRole and saved reportGroup/reportCategory summaries. subtype remains the legacy compatibility value, independent of report placement. Hidden global suggestions have systemRole=null and no saved report assignment.\n\n**Important**: The `id` values returned by this endpoint are *template account* IDs (`TemplateAccount.id`). They are **not** the IDs of an entity's actual GL accounts — do not use them to post journals or look up reconciliation activity.\n\nTo fetch the chart of accounts for a specific entity (including bank-account-linked accounts and any custom accounts), use `GET /api/public/v1/entities/{entityId}/charts`. The bank-account-to-GL linkage is also embedded on each entity's bank account at `bankAccounts[].entityAccount` in the `GET /api/public/v1/entities` response.\n\n**Tax codes**: The `taxCode` field is returned as the human-readable tax *name* (e.g. `\"15% GST on Income\"`, or `\"No GST\"` when unset), not the machine code. When creating or updating a template you must pass the machine *code* instead (`NZ_GST_15_INC`, `NZ_GST_15_EXP`, `NZ_GST_0_NONE`, `NZ_GST_0_ZERO`), so convert the name back to its code before writing.\n",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "chartId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeHidden",
            "in": "query",
            "required": false,
            "description": "When true, includes global accounts not in the template (with isIncluded=false). Disables pagination.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number (starts at 1). Ignored when includeHidden=true.",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Number of items per page. Ignored when includeHidden=true.",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "templateUpdatedAt": {
                      "type": "string"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "type": "string"
                          },
                          "reportCategoryReviewedAt": {
                            "type": "string",
                            "nullable": true
                          },
                          "reportCategoryReviewVersion": {
                            "type": "number"
                          },
                          "code": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "subtype": {
                            "type": "string"
                          },
                          "reportGroup": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "key": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "accountType": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "key",
                              "name",
                              "status",
                              "accountType"
                            ],
                            "additionalProperties": false,
                            "nullable": true
                          },
                          "reportCategory": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "key": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              }
                            },
                            "required": ["id", "key", "name", "status"],
                            "additionalProperties": false,
                            "nullable": true
                          },
                          "taxCode": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string",
                            "nullable": true
                          },
                          "mappedCode": {
                            "type": "string",
                            "nullable": true
                          },
                          "isSystem": {
                            "type": "boolean"
                          },
                          "systemRole": {
                            "type": "string",
                            "nullable": true
                          },
                          "parentId": {
                            "type": "string",
                            "nullable": true
                          },
                          "isExcluded": {
                            "type": "boolean"
                          },
                          "isIncluded": {
                            "type": "boolean"
                          },
                          "source": {
                            "type": "string",
                            "enum": ["template", "overridden", "custom"]
                          }
                        },
                        "required": [
                          "id",
                          "code",
                          "name",
                          "type",
                          "subtype",
                          "reportGroup",
                          "reportCategory",
                          "taxCode",
                          "description",
                          "mappedCode",
                          "isSystem"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "currentPage": {
                          "type": "number"
                        },
                        "pageSize": {
                          "type": "number"
                        },
                        "totalCount": {
                          "type": "number"
                        },
                        "totalPages": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        },
                        "hasPreviousPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "currentPage",
                        "pageSize",
                        "totalCount",
                        "totalPages",
                        "hasNextPage",
                        "hasPreviousPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["templateUpdatedAt", "data", "pagination"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters"
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "403": {
            "description": "Forbidden - No access to the specified chart"
          },
          "404": {
            "description": "Chart not found"
          }
        },
        "operationId": "charts.listAccounts",
        "x-sdk-resource": "charts",
        "x-sdk-method": "listAccounts"
      }
    },
    "/api/public/v1/charts/{chartId}/update": {
      "post": {
        "summary": "Update a chart of accounts template",
        "description": "Discover the current workspace contract at GET /api/public/v1/report-categories before writing. In activated workspaces, included accounts need groupKey and an explicit categoryKey (null is valid for eligible group-only accounts); type derives from the group. Parent-only and mixed classification writes are rejected. Nonactivated workspaces retain parent inputs and reject reporting inputs. Metadata-only updates preserve saved reporting. API writes do not confirm template review or approve propagation. Reporting edits require saved template and row versions; reload after 409, and never retry using an alternate request shape.\nUpdates a chart of accounts template. When `accounts` is provided it fully replaces the\ntemplate's account list (delegates to updateAccountTemplateAccounts and propagates to all\nentities). When `accounts` is omitted, only the provided template metadata (`name`,\n`description`) is updated and accounts are left untouched. Omit a metadata field to preserve\nits existing value, or send `description: null` to clear the description. A full replacement\nlist in a nonactivated workspace must still contain every\nsystem account (`GET /api/public/v1/global-accounts`, `isSystem: true`) with\n`isIncluded: true` — otherwise the request fails with `SYSTEM_ACCOUNT_VALIDATION` listing\nall missing accounts. Set `includeSystemAccounts: true` to carry over any omitted system\naccounts automatically. For surgical single-account changes use the\n`/charts/{chartId}/accounts` endpoints instead. Requires API key authentication.\n\n**Tax codes**: The `taxCode` field expects the machine code, not the human-readable tax name.\nPassing a name (e.g. `\"15% GST on Income\"`) is stored verbatim and resolves to null wherever the\ncode is looked up. Valid codes are `NZ_GST_15_INC` (15% GST on Income), `NZ_GST_15_EXP`\n(15% GST on Expenses), `NZ_GST_0_NONE` (No GST), and `NZ_GST_0_ZERO` (Zero-rated GST). Note that\n`GET /api/public/v1/charts/{chartId}` returns the human-readable name on read — convert it back to\nthe machine code before writing.\n\n**Field preserve/clear semantics**: For each account, omitting a field (`description`, `taxCode`,\n`mappedCode`) preserves its existing value, while an explicit null clears it (taxCode clears to\n`NZ_GST_0_NONE`).\n",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "chartId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string",
                    "nullable": true
                  },
                  "includeSystemAccounts": {
                    "type": "boolean"
                  },
                  "expectedUpdatedAt": {
                    "type": "string"
                  },
                  "accounts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "isIncluded": {
                          "type": "boolean"
                        },
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        },
                        "taxCode": {
                          "type": "string",
                          "enum": [
                            "NZ_GST_15_INC",
                            "NZ_GST_15_EXP",
                            "NZ_GST_0_NONE",
                            "NZ_GST_0_ZERO",
                            "AU_GST_10_INC",
                            "AU_GST_10_EXP",
                            "AU_GST_0_NONE",
                            "AU_GST_0_INPUT",
                            "AU_GST_0_EXPORT"
                          ],
                          "nullable": true
                        },
                        "mappedCode": {
                          "type": "string",
                          "nullable": true
                        },
                        "parentCode": {
                          "type": "string",
                          "nullable": true
                        },
                        "id": {
                          "type": "string"
                        },
                        "clientKey": {
                          "type": "string"
                        },
                        "groupKey": {
                          "type": "string"
                        },
                        "categoryKey": {
                          "type": "string",
                          "nullable": true
                        },
                        "systemRole": {
                          "type": "string",
                          "nullable": true
                        },
                        "expectedUpdatedAt": {
                          "type": "string"
                        }
                      },
                      "required": ["code", "isIncluded"],
                      "additionalProperties": false
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        },
                        "entitiesUpdated": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "description",
                        "entitiesUpdated"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation error or business rule violation. `SYSTEM_ACCOUNT_VALIDATION` includes `details.missingAccounts` listing every required system account absent from the payload."
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Chart not found"
          },
          "409": {
            "description": "Account code conflict - new template account codes conflict with custom accounts in entities using this template",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["error", "code"],
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Account code conflict"
                    },
                    "code": {
                      "type": "string",
                      "enum": ["ACCOUNT_CODE_CONFLICT"]
                    },
                    "details": {
                      "type": "object",
                      "properties": {
                        "accountCode": {
                          "type": "string",
                          "description": "(deprecated) Use accountCodes[0] for backward compatibility"
                        },
                        "accountCodes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          },
                          "description": "All new account codes that conflict with entity custom accounts"
                        },
                        "conflictingEntityIds": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "description": "Entity IDs that have conflicting custom accounts"
                        },
                        "conflictingEntities": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "entityId": {
                                "type": "string",
                                "format": "uuid"
                              },
                              "entityName": {
                                "type": "string"
                              },
                              "conflictingAccountCodes": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                },
                                "description": "Account codes in this entity that conflict"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                "example": {
                  "error": "Account code conflict",
                  "code": "ACCOUNT_CODE_CONFLICT",
                  "details": {
                    "accountCode": "1100",
                    "accountCodes": ["1100", "1200"],
                    "conflictingEntityIds": [
                      "550e8400-e29b-41d4-a716-446655440001"
                    ],
                    "conflictingEntities": [
                      {
                        "entityId": "550e8400-e29b-41d4-a716-446655440001",
                        "entityName": "Acme Ltd",
                        "conflictingAccountCodes": ["1100", "1200"]
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "operationId": "charts.update",
        "x-sdk-resource": "charts",
        "x-sdk-method": "update"
      }
    },
    "/api/public/v1/charts": {
      "get": {
        "summary": "List all chart of accounts templates",
        "description": "Returns all chart of accounts templates in the workspace. Requires API key authentication.",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string",
                            "nullable": true
                          },
                          "accountCount": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "description",
                          "accountCount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          }
        },
        "operationId": "charts.list",
        "x-sdk-resource": "charts",
        "x-sdk-method": "list",
        "parameters": []
      },
      "post": {
        "summary": "Create a chart of accounts template",
        "description": "Discover the current workspace contract at GET /api/public/v1/report-categories before writing. In activated workspaces, included accounts need groupKey and an explicit categoryKey (null is valid for eligible group-only accounts); type derives from the group. Parent-only and mixed classification writes are rejected. Nonactivated workspaces retain parent inputs and reject reporting inputs. Metadata-only updates preserve saved reporting. API writes do not confirm template review or approve propagation. Reporting edits require saved template and row versions; reload after 409, and never retry using an alternate request shape.\nIn nonactivated workspaces, creates a chart from global definitions. Every system global\naccount (see `GET /api/public/v1/global-accounts`, `isSystem: true`) must be present\nin `accounts` with `isIncluded: true` — otherwise the request fails with\n`SYSTEM_ACCOUNT_VALIDATION` listing all missing accounts. Set\n`includeSystemAccounts: true` to have any omitted system accounts added\nautomatically from their global definitions. Requires API key authentication.\n\n**Tax codes**: The `taxCode` field expects the machine code, not the human-readable tax name.\nPassing a name (e.g. `\"15% GST on Income\"`) is stored verbatim and resolves to null wherever the\ncode is looked up. Valid codes are `NZ_GST_15_INC` (15% GST on Income), `NZ_GST_15_EXP`\n(15% GST on Expenses), `NZ_GST_0_NONE` (No GST), and `NZ_GST_0_ZERO` (Zero-rated GST). Omit\n`taxCode` or set it to null to default to `NZ_GST_0_NONE` (No GST).\n\n**Description defaults**: `description` is optional per account; omitting it (or null) leaves\nthe account description empty.\n",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "accounts": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "isIncluded": {
                          "type": "boolean"
                        },
                        "type": {
                          "type": "string"
                        },
                        "subtype": {
                          "type": "string",
                          "nullable": true
                        },
                        "taxCode": {
                          "type": "string",
                          "enum": [
                            "NZ_GST_15_INC",
                            "NZ_GST_15_EXP",
                            "NZ_GST_0_NONE",
                            "NZ_GST_0_ZERO",
                            "AU_GST_10_INC",
                            "AU_GST_10_EXP",
                            "AU_GST_0_NONE",
                            "AU_GST_0_INPUT",
                            "AU_GST_0_EXPORT"
                          ],
                          "nullable": true
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        },
                        "mappedCode": {
                          "type": "string",
                          "nullable": true
                        },
                        "parentCode": {
                          "type": "string",
                          "nullable": true
                        },
                        "id": {
                          "type": "string"
                        },
                        "clientKey": {
                          "type": "string"
                        },
                        "groupKey": {
                          "type": "string"
                        },
                        "categoryKey": {
                          "type": "string",
                          "nullable": true
                        },
                        "systemRole": {
                          "type": "string",
                          "nullable": true
                        },
                        "expectedUpdatedAt": {
                          "type": "string"
                        }
                      },
                      "required": ["code", "name", "isIncluded"],
                      "additionalProperties": false
                    }
                  },
                  "description": {
                    "type": "string"
                  },
                  "includeSystemAccounts": {
                    "type": "boolean"
                  }
                },
                "required": ["name", "accounts"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        }
                      },
                      "required": ["id", "name", "description"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation error. `SYSTEM_ACCOUNT_VALIDATION` includes `details.missingAccounts` listing every required system account absent from the payload.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["error", "code"],
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Missing required system accounts: 8500 (GST), 8950 (Rounding). All system accounts must be included in the template with isIncluded: true."
                    },
                    "code": {
                      "type": "string",
                      "example": "SYSTEM_ACCOUNT_VALIDATION"
                    },
                    "details": {
                      "type": "object",
                      "properties": {
                        "missingAccounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string",
                                "example": "8500"
                              },
                              "name": {
                                "type": "string",
                                "example": "GST"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          }
        },
        "operationId": "charts.create",
        "x-sdk-resource": "charts",
        "x-sdk-method": "create",
        "parameters": []
      }
    },
    "/api/public/v1/clients/{clientId}/bank-accounts": {
      "get": {
        "summary": "List client's bank accounts",
        "description": "Returns all bank accounts belonging to the specified client.\n\nAccess control:\n- Authenticated user must be the client themselves, OR\n- Authenticated user must be in the same workspace as the client (accountant/advisor)\n",
        "tags": ["Clients"],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "clientId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string",
                            "nullable": true
                          },
                          "externalId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "alias": {
                            "type": "string",
                            "nullable": true
                          },
                          "institution": {
                            "type": "string",
                            "nullable": true
                          },
                          "accountNumber": {
                            "type": "string",
                            "nullable": true
                          },
                          "logoUrl": {
                            "type": "string",
                            "nullable": true
                          },
                          "type": {
                            "type": "string"
                          },
                          "sourceType": {
                            "type": "string",
                            "nullable": true
                          },
                          "entityAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "updatedAt": {
                                "type": "string"
                              },
                              "reportCategoryReviewedAt": {
                                "type": "string",
                                "nullable": true
                              },
                              "reportCategoryReviewVersion": {
                                "type": "number"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "subtype": {
                                "type": "string"
                              },
                              "reportGroup": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "key": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "accountType": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "key",
                                  "name",
                                  "status",
                                  "accountType"
                                ],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "reportCategory": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "key": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "key", "name", "status"],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "taxCode": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string",
                                "nullable": true
                              },
                              "mappedCode": {
                                "type": "string",
                                "nullable": true
                              },
                              "isSystem": {
                                "type": "boolean"
                              },
                              "systemRole": {
                                "type": "string",
                                "nullable": true
                              },
                              "parentId": {
                                "type": "string",
                                "nullable": true
                              },
                              "isExcluded": {
                                "type": "boolean"
                              },
                              "isIncluded": {
                                "type": "boolean"
                              },
                              "source": {
                                "type": "string",
                                "enum": ["template", "overridden", "custom"]
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name",
                              "type",
                              "subtype",
                              "reportGroup",
                              "reportCategory",
                              "taxCode",
                              "description",
                              "mappedCode",
                              "isSystem"
                            ],
                            "additionalProperties": false,
                            "nullable": true
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "externalId",
                          "name",
                          "alias",
                          "institution",
                          "accountNumber",
                          "logoUrl",
                          "type",
                          "sourceType",
                          "entityAccount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key/token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - User does not have access to this client",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Client not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "clients.listBankAccounts",
        "x-sdk-resource": "clients",
        "x-sdk-method": "listBankAccounts"
      }
    },
    "/api/public/v1/clients/{clientId}/onboarding": {
      "post": {
        "operationId": "clients.createOnboardingLink",
        "summary": "clients.createOnboardingLink",
        "x-sdk-resource": "clients",
        "x-sdk-method": "createOnboardingLink",
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "magicLink": {
                          "type": "string"
                        }
                      },
                      "required": ["magicLink"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "parameters": [
          {
            "in": "path",
            "name": "clientId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "integrationId": {
                    "type": "string"
                  },
                  "callbackURL": {
                    "type": "string"
                  },
                  "state": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/public/v1/clients/{clientId}/transactions": {
      "get": {
        "summary": "List client's bank transactions",
        "description": "Returns paginated bank transactions for the specified client.\n\nAccess control:\n- Authenticated user must be the client themselves, OR\n- Authenticated user must be in the same workspace as the client (accountant/advisor)\n\nSupports filtering by:\n- Bank account IDs (comma-separated)\n- Date range (dateFrom, dateTo)\n- Reconciliation status (reconciled | unreconciled)\n",
        "tags": ["Clients"],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "clientId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "bankAccountIds",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Comma-separated list of bank account IDs to filter by",
            "example": "uuid1,uuid2,uuid3",
            "style": "form",
            "explode": false
          },
          {
            "name": "dateFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Start date for filtering transactions (ISO 8601 format)",
            "example": "2024-04-01"
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "End date for filtering transactions (ISO 8601 format)",
            "example": "2025-03-31"
          },
          {
            "name": "reconciliationStatus",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["reconciled", "unreconciled"]
            },
            "description": "Filter by reconciliation status"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            },
            "description": "Page number (starts at 1)"
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 500
            },
            "description": "Number of items per page"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entityId": {
                            "type": "string",
                            "nullable": true
                          },
                          "reconciliationStatus": {
                            "type": "string",
                            "enum": ["reconciled", "unreconciled"]
                          },
                          "journalId": {
                            "type": "string",
                            "nullable": true
                          },
                          "bankAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "entityId": {
                                "type": "string",
                                "nullable": true
                              },
                              "externalId": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "alias": {
                                "type": "string",
                                "nullable": true
                              },
                              "institution": {
                                "type": "string",
                                "nullable": true
                              },
                              "accountNumber": {
                                "type": "string",
                                "nullable": true
                              },
                              "logoUrl": {
                                "type": "string",
                                "nullable": true
                              },
                              "type": {
                                "type": "string"
                              },
                              "sourceType": {
                                "type": "string",
                                "nullable": true
                              },
                              "entityAccount": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "updatedAt": {
                                    "type": "string"
                                  },
                                  "reportCategoryReviewedAt": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "reportCategoryReviewVersion": {
                                    "type": "number"
                                  },
                                  "code": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string"
                                  },
                                  "subtype": {
                                    "type": "string"
                                  },
                                  "reportGroup": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "key": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "status": {
                                        "type": "string"
                                      },
                                      "accountType": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "key",
                                      "name",
                                      "status",
                                      "accountType"
                                    ],
                                    "additionalProperties": false,
                                    "nullable": true
                                  },
                                  "reportCategory": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "key": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "status": {
                                        "type": "string"
                                      }
                                    },
                                    "required": ["id", "key", "name", "status"],
                                    "additionalProperties": false,
                                    "nullable": true
                                  },
                                  "taxCode": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "mappedCode": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "isSystem": {
                                    "type": "boolean"
                                  },
                                  "systemRole": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "parentId": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "isExcluded": {
                                    "type": "boolean"
                                  },
                                  "isIncluded": {
                                    "type": "boolean"
                                  },
                                  "source": {
                                    "type": "string",
                                    "enum": ["template", "overridden", "custom"]
                                  }
                                },
                                "required": [
                                  "id",
                                  "code",
                                  "name",
                                  "type",
                                  "subtype",
                                  "reportGroup",
                                  "reportCategory",
                                  "taxCode",
                                  "description",
                                  "mappedCode",
                                  "isSystem"
                                ],
                                "additionalProperties": false,
                                "nullable": true
                              }
                            },
                            "required": [
                              "id",
                              "entityId",
                              "externalId",
                              "name",
                              "alias",
                              "institution",
                              "accountNumber",
                              "logoUrl",
                              "type",
                              "sourceType",
                              "entityAccount"
                            ],
                            "additionalProperties": false
                          },
                          "merchant": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "provider": {
                                "type": "string",
                                "nullable": true
                              },
                              "identifier": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "provider",
                              "identifier"
                            ],
                            "additionalProperties": false,
                            "nullable": true
                          },
                          "category": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "identifier": {
                                "type": "string"
                              }
                            },
                            "required": ["id", "name", "identifier"],
                            "additionalProperties": false,
                            "nullable": true
                          },
                          "user": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string",
                                "nullable": true
                              },
                              "tradingName": {
                                "type": "string",
                                "nullable": true
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            },
                            "required": [
                              "id",
                              "email",
                              "name",
                              "tradingName",
                              "createdAt"
                            ],
                            "additionalProperties": false
                          },
                          "suggestions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "sourceType": {
                                  "type": "string"
                                },
                                "confidence": {
                                  "type": "string",
                                  "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                },
                                "status": {
                                  "type": "string"
                                },
                                "ruleId": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "ruleName": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "lines": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "proportion": {
                                        "type": "string",
                                        "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic.",
                                        "nullable": true
                                      },
                                      "credit": {
                                        "type": "string",
                                        "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                      },
                                      "debit": {
                                        "type": "string",
                                        "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                      },
                                      "entityAccountId": {
                                        "type": "string"
                                      },
                                      "entityAccount": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          }
                                        },
                                        "required": ["id", "code", "name"],
                                        "additionalProperties": false
                                      },
                                      "taxRateId": {
                                        "type": "string",
                                        "nullable": true
                                      },
                                      "taxRate": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "code": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          },
                                          "description": {
                                            "type": "string",
                                            "nullable": true
                                          },
                                          "rate": {
                                            "type": "string",
                                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "code",
                                          "name",
                                          "description",
                                          "rate"
                                        ],
                                        "additionalProperties": false,
                                        "nullable": true
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "proportion",
                                      "credit",
                                      "debit",
                                      "entityAccountId",
                                      "entityAccount",
                                      "taxRateId",
                                      "taxRate"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "id",
                                "sourceType",
                                "confidence",
                                "status",
                                "ruleId",
                                "ruleName",
                                "lines"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "id": {
                            "type": "string"
                          },
                          "date": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "amount": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          },
                          "description": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "particulars": {
                            "type": "string",
                            "nullable": true
                          },
                          "code": {
                            "type": "string",
                            "nullable": true
                          },
                          "reference": {
                            "type": "string",
                            "nullable": true
                          }
                        },
                        "required": [
                          "entityId",
                          "reconciliationStatus",
                          "journalId",
                          "bankAccount",
                          "merchant",
                          "category",
                          "user",
                          "id",
                          "date",
                          "amount",
                          "description",
                          "type",
                          "particulars",
                          "code",
                          "reference"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "currentPage": {
                          "type": "number"
                        },
                        "pageSize": {
                          "type": "number"
                        },
                        "totalCount": {
                          "type": "number"
                        },
                        "totalPages": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        },
                        "hasPreviousPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "currentPage",
                        "pageSize",
                        "totalCount",
                        "totalPages",
                        "hasNextPage",
                        "hasPreviousPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data", "pagination"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key/token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - User does not have access to this client",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Client not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "clients.listTransactions",
        "x-sdk-resource": "clients",
        "x-sdk-method": "listTransactions"
      }
    },
    "/api/public/v1/clients": {
      "get": {
        "summary": "List clients",
        "description": "Returns client users (`client` and `standard_user` roles) in the workspace tied to the token.\nCallers authenticated as client or standard_user only ever receive their own client record,\neven within a shared workspace. Accountant-style roles receive the full list (subject to filters).\n",
        "tags": ["Clients"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "clientId",
            "schema": {
              "type": "string"
            },
            "required": false,
            "description": "Filter by specific client ID"
          },
          {
            "in": "query",
            "name": "email",
            "schema": {
              "type": "string"
            },
            "required": false,
            "description": "Filter by client email address"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string",
                            "nullable": true
                          },
                          "tradingName": {
                            "type": "string",
                            "nullable": true
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "bankAccounts": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "required": ["id", "name"],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "id",
                          "email",
                          "name",
                          "tradingName",
                          "createdAt",
                          "bankAccounts"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Workspace not found or access denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "clients.list",
        "x-sdk-resource": "clients",
        "x-sdk-method": "list"
      },
      "post": {
        "summary": "Create a client",
        "description": "Creates a new client in the workspace associated with the API key. If a client with the same email already exists, returns the existing client.",
        "tags": ["Clients"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "tradingName": {
                    "type": "string"
                  },
                  "sendInvite": {
                    "type": "boolean"
                  },
                  "message": {
                    "type": "string"
                  }
                },
                "required": ["name", "email"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string",
                          "nullable": true
                        },
                        "tradingName": {
                          "type": "string",
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "bankAccounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": ["id", "name"],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "email",
                        "name",
                        "tradingName",
                        "createdAt",
                        "bankAccounts"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "details": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Workspace not found or access denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Invitation email rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "clients.create",
        "x-sdk-resource": "clients",
        "x-sdk-method": "create",
        "parameters": []
      }
    },
    "/api/public/v1/contacts": {
      "get": {
        "summary": "List contacts",
        "description": "Returns non-deleted contacts from entities visible in the active workspace.",
        "tags": ["Contacts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "entityId",
            "schema": {
              "type": "string"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": ["BUSINESS", "INDIVIDUAL"]
            },
            "required": false
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": ["active", "archived", "all"]
            },
            "required": false
          },
          {
            "in": "query",
            "name": "updatedSince",
            "schema": {
              "type": "string"
            },
            "required": false
          },
          {
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "default": 1
            },
            "required": false
          },
          {
            "in": "query",
            "name": "pageSize",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100
            },
            "required": false
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": ["BUSINESS"]
                              },
                              "people": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "displayName": {
                                      "type": "string"
                                    },
                                    "receivesInvoices": {
                                      "type": "boolean"
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": ["active", "archived"]
                                    },
                                    "archivedAt": {
                                      "type": "string",
                                      "format": "date-time",
                                      "nullable": true
                                    },
                                    "emails": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "email": {
                                            "type": "string"
                                          },
                                          "label": {
                                            "type": "string",
                                            "nullable": true
                                          }
                                        },
                                        "required": ["id", "email", "label"],
                                        "additionalProperties": false
                                      }
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "displayName",
                                    "receivesInvoices",
                                    "status",
                                    "archivedAt",
                                    "emails"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "id": {
                                "type": "string"
                              },
                              "workspaceId": {
                                "type": "string"
                              },
                              "entityId": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": ["active", "archived"]
                              },
                              "displayName": {
                                "type": "string"
                              },
                              "legalName": {
                                "type": "string",
                                "nullable": true
                              },
                              "identifierScheme": {
                                "type": "string",
                                "nullable": true
                              },
                              "identifier": {
                                "type": "string",
                                "nullable": true
                              },
                              "gstNumber": {
                                "type": "string",
                                "nullable": true
                              },
                              "website": {
                                "type": "string",
                                "nullable": true
                              },
                              "notes": {
                                "type": "string",
                                "nullable": true
                              },
                              "invoiceNotes": {
                                "type": "string",
                                "nullable": true
                              },
                              "organisationId": {
                                "type": "string",
                                "nullable": true
                              },
                              "receivesInvoices": {
                                "type": "boolean"
                              },
                              "addresses": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "label": {
                                      "type": "string"
                                    },
                                    "type": {
                                      "type": "string",
                                      "enum": [
                                        "BILLING",
                                        "DELIVERY",
                                        "POSTAL",
                                        "PHYSICAL",
                                        "REMITTANCE",
                                        "OTHER"
                                      ]
                                    },
                                    "attentionTo": {
                                      "type": "string"
                                    },
                                    "addressLines": {
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      }
                                    },
                                    "sublocality": {
                                      "type": "string"
                                    },
                                    "locality": {
                                      "type": "string"
                                    },
                                    "administrativeArea": {
                                      "type": "string"
                                    },
                                    "postalCode": {
                                      "type": "string"
                                    },
                                    "sortingCode": {
                                      "type": "string"
                                    },
                                    "countryCode": {
                                      "type": "string"
                                    },
                                    "isInvoiceDefault": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "type",
                                    "addressLines",
                                    "countryCode",
                                    "isInvoiceDefault"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "phones": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "label": {
                                      "type": "string"
                                    },
                                    "number": {
                                      "type": "string"
                                    },
                                    "isPrimary": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": ["id", "number", "isPrimary"],
                                  "additionalProperties": false
                                }
                              },
                              "organisation": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "displayName"],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "updatedAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "archivedAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              }
                            },
                            "required": [
                              "type",
                              "people",
                              "id",
                              "workspaceId",
                              "entityId",
                              "status",
                              "displayName",
                              "legalName",
                              "identifierScheme",
                              "identifier",
                              "gstNumber",
                              "website",
                              "notes",
                              "invoiceNotes",
                              "organisationId",
                              "receivesInvoices",
                              "addresses",
                              "phones",
                              "organisation",
                              "createdAt",
                              "updatedAt",
                              "archivedAt"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": ["INDIVIDUAL"]
                              },
                              "emails": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "email": {
                                      "type": "string"
                                    },
                                    "label": {
                                      "type": "string",
                                      "nullable": true
                                    }
                                  },
                                  "required": ["id", "email", "label"],
                                  "additionalProperties": false
                                }
                              },
                              "id": {
                                "type": "string"
                              },
                              "workspaceId": {
                                "type": "string"
                              },
                              "entityId": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": ["active", "archived"]
                              },
                              "displayName": {
                                "type": "string"
                              },
                              "legalName": {
                                "type": "string",
                                "nullable": true
                              },
                              "identifierScheme": {
                                "type": "string",
                                "nullable": true
                              },
                              "identifier": {
                                "type": "string",
                                "nullable": true
                              },
                              "gstNumber": {
                                "type": "string",
                                "nullable": true
                              },
                              "website": {
                                "type": "string",
                                "nullable": true
                              },
                              "notes": {
                                "type": "string",
                                "nullable": true
                              },
                              "invoiceNotes": {
                                "type": "string",
                                "nullable": true
                              },
                              "organisationId": {
                                "type": "string",
                                "nullable": true
                              },
                              "receivesInvoices": {
                                "type": "boolean"
                              },
                              "addresses": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "label": {
                                      "type": "string"
                                    },
                                    "type": {
                                      "type": "string",
                                      "enum": [
                                        "BILLING",
                                        "DELIVERY",
                                        "POSTAL",
                                        "PHYSICAL",
                                        "REMITTANCE",
                                        "OTHER"
                                      ]
                                    },
                                    "attentionTo": {
                                      "type": "string"
                                    },
                                    "addressLines": {
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      }
                                    },
                                    "sublocality": {
                                      "type": "string"
                                    },
                                    "locality": {
                                      "type": "string"
                                    },
                                    "administrativeArea": {
                                      "type": "string"
                                    },
                                    "postalCode": {
                                      "type": "string"
                                    },
                                    "sortingCode": {
                                      "type": "string"
                                    },
                                    "countryCode": {
                                      "type": "string"
                                    },
                                    "isInvoiceDefault": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "type",
                                    "addressLines",
                                    "countryCode",
                                    "isInvoiceDefault"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "phones": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "label": {
                                      "type": "string"
                                    },
                                    "number": {
                                      "type": "string"
                                    },
                                    "isPrimary": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": ["id", "number", "isPrimary"],
                                  "additionalProperties": false
                                }
                              },
                              "organisation": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "displayName"],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "updatedAt": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "archivedAt": {
                                "type": "string",
                                "format": "date-time",
                                "nullable": true
                              }
                            },
                            "required": [
                              "type",
                              "emails",
                              "id",
                              "workspaceId",
                              "entityId",
                              "status",
                              "displayName",
                              "legalName",
                              "identifierScheme",
                              "identifier",
                              "gstNumber",
                              "website",
                              "notes",
                              "invoiceNotes",
                              "organisationId",
                              "receivesInvoices",
                              "addresses",
                              "phones",
                              "organisation",
                              "createdAt",
                              "updatedAt",
                              "archivedAt"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "currentPage": {
                          "type": "number"
                        },
                        "pageSize": {
                          "type": "number"
                        },
                        "totalCount": {
                          "type": "number"
                        },
                        "totalPages": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        },
                        "hasPreviousPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "currentPage",
                        "pageSize",
                        "totalCount",
                        "totalPages",
                        "hasNextPage",
                        "hasPreviousPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data", "pagination"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters."
          },
          "401": {
            "description": "Unauthorized."
          },
          "403": {
            "description": "Insufficient role or token scope."
          },
          "500": {
            "description": "Internal server error."
          }
        },
        "operationId": "contacts.list",
        "x-sdk-resource": "contacts",
        "x-sdk-method": "list"
      }
    },
    "/api/public/v1/entities/{entityId}/bank-accounts/{bankAccountId}/import": {
      "post": {
        "summary": "Import transactions into a CSV bank account",
        "description": "Adds transactions to one of the entity's CSV bank accounts — the kind\nfed by imported files (`sourceType: csv` on the bank account). Bank\nfeeds (`akahu`, `siss`) can't take imported transactions; create a\nseparate CSV account with `POST /entities/{entityId}/bank-accounts/import`\ninstead.\n\nRows the account already holds (same date, amount and description)\nare skipped, so importing an overlapping statement is safe. Amounts\nare from the account holder's side: money in positive, money out\nnegative. Zero amounts are rejected.\n",
        "tags": ["Bank Accounts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "bankAccountId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filename": {
                    "type": "string"
                  },
                  "transactions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number"
                        },
                        "transactionType": {
                          "type": "string"
                        },
                        "payee": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "reference": {
                          "type": "string"
                        },
                        "particulars": {
                          "type": "string"
                        },
                        "bankTransactionId": {
                          "type": "string"
                        }
                      },
                      "required": ["date", "description", "amount"],
                      "additionalProperties": false
                    }
                  }
                },
                "required": ["filename", "transactions"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "bankAccountId": {
                          "type": "string"
                        },
                        "bankAccountName": {
                          "type": "string"
                        },
                        "importId": {
                          "type": "string",
                          "nullable": true
                        },
                        "transactionsImported": {
                          "type": "number"
                        },
                        "transactionsSkipped": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "bankAccountId",
                        "bankAccountName",
                        "importId",
                        "transactionsImported",
                        "transactionsSkipped",
                        "message"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid body (`VALIDATION_ERROR`, `INVALID_ROW_DATE`,\n`ZERO_AMOUNT_TRANSACTION`), a bank feed account\n(`BANK_ACCOUNT_NOT_CSV`), or an account missing its owner or bank\n(`BANK_ACCOUNT_NOT_IMPORTABLE`)\n"
          },
          "401": {
            "description": "Invalid or missing API key or token"
          },
          "404": {
            "description": "The entity or bank account wasn't found, or isn't accessible (`BANK_ACCOUNT_NOT_FOUND`)"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "bankAccounts.importTransactions",
        "x-sdk-resource": "bankAccounts",
        "x-sdk-method": "importTransactions"
      }
    },
    "/api/public/v1/entities/{entityId}/bank-accounts/import": {
      "post": {
        "summary": "Create a CSV bank account and import transactions into it",
        "description": "Creates a CSV bank account for the entity — one fed by imported files —\nwith its account in the entity's chart so its lines can be reconciled,\nthen imports the transactions into it. All or nothing.\n\nUse this when the entity has no account for the statement, or when its\nmatching account is a bank feed, which can't take imported\ntransactions. The new account sits beside the feed account, so both\nwill need reconciling; prefer importing into an existing CSV account\nwith `POST /entities/{entityId}/bank-accounts/{bankAccountId}/import`.\n\nThe account belongs to the caller. Amounts are from the account\nholder's side: money in positive, money out negative; never 0.\n",
        "tags": ["Bank Accounts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "filename": {
                    "type": "string"
                  },
                  "transactions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "number"
                        },
                        "transactionType": {
                          "type": "string"
                        },
                        "payee": {
                          "type": "string"
                        },
                        "code": {
                          "type": "string"
                        },
                        "reference": {
                          "type": "string"
                        },
                        "particulars": {
                          "type": "string"
                        },
                        "bankTransactionId": {
                          "type": "string"
                        }
                      },
                      "required": ["date", "description", "amount"],
                      "additionalProperties": false
                    }
                  },
                  "name": {
                    "type": "string"
                  },
                  "institution": {
                    "type": "string"
                  },
                  "accountNumber": {
                    "type": "string"
                  }
                },
                "required": ["filename", "transactions", "name", "institution"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "bankAccountId": {
                          "type": "string"
                        },
                        "bankAccountName": {
                          "type": "string"
                        },
                        "institution": {
                          "type": "string",
                          "nullable": true
                        },
                        "accountNumber": {
                          "type": "string",
                          "nullable": true
                        },
                        "importId": {
                          "type": "string",
                          "nullable": true
                        },
                        "transactionsImported": {
                          "type": "number"
                        },
                        "message": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "bankAccountId",
                        "bankAccountName",
                        "institution",
                        "accountNumber",
                        "importId",
                        "transactionsImported",
                        "message"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid body (`VALIDATION_ERROR`, `INVALID_ROW_DATE`, `ZERO_AMOUNT_TRANSACTION`)"
          },
          "401": {
            "description": "Invalid or missing API key or token"
          },
          "404": {
            "description": "Entity not found or not accessible"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "bankAccounts.createWithTransactions",
        "x-sdk-resource": "bankAccounts",
        "x-sdk-method": "createWithTransactions"
      }
    },
    "/api/public/v1/entities/{entityId}/bank-accounts": {
      "post": {
        "summary": "Link bank accounts to an entity",
        "description": "Links existing bank accounts to the entity, creating each one's general\nledger account in the entity's chart of accounts. Linking only ever adds:\naccounts already on the entity are left as they are, and no account is\nunlinked.\n\nEach account must belong to a client of the entity — find them with\n`GET /api/public/v1/clients/{clientId}/bank-accounts` — and must not be\nlinked to a different entity.\n",
        "tags": ["Bank Accounts"],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "bankAccountIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": ["bankAccountIds"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string",
                            "nullable": true
                          },
                          "externalId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "alias": {
                            "type": "string",
                            "nullable": true
                          },
                          "institution": {
                            "type": "string",
                            "nullable": true
                          },
                          "accountNumber": {
                            "type": "string",
                            "nullable": true
                          },
                          "logoUrl": {
                            "type": "string",
                            "nullable": true
                          },
                          "type": {
                            "type": "string"
                          },
                          "sourceType": {
                            "type": "string",
                            "nullable": true
                          },
                          "entityAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "updatedAt": {
                                "type": "string"
                              },
                              "reportCategoryReviewedAt": {
                                "type": "string",
                                "nullable": true
                              },
                              "reportCategoryReviewVersion": {
                                "type": "number"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "subtype": {
                                "type": "string"
                              },
                              "reportGroup": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "key": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  },
                                  "accountType": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "key",
                                  "name",
                                  "status",
                                  "accountType"
                                ],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "reportCategory": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "key": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "status": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "key", "name", "status"],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "taxCode": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string",
                                "nullable": true
                              },
                              "mappedCode": {
                                "type": "string",
                                "nullable": true
                              },
                              "isSystem": {
                                "type": "boolean"
                              },
                              "systemRole": {
                                "type": "string",
                                "nullable": true
                              },
                              "parentId": {
                                "type": "string",
                                "nullable": true
                              },
                              "isExcluded": {
                                "type": "boolean"
                              },
                              "isIncluded": {
                                "type": "boolean"
                              },
                              "source": {
                                "type": "string",
                                "enum": ["template", "overridden", "custom"]
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name",
                              "type",
                              "subtype",
                              "reportGroup",
                              "reportCategory",
                              "taxCode",
                              "description",
                              "mappedCode",
                              "isSystem"
                            ],
                            "additionalProperties": false,
                            "nullable": true
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "externalId",
                          "name",
                          "alias",
                          "institution",
                          "accountNumber",
                          "logoUrl",
                          "type",
                          "sourceType",
                          "entityAccount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation failed (`VALIDATION_ERROR`), an ID does not exist (`INVALID_BANK_ACCOUNT_IDS`), or an account does not belong to a client of the entity (`BANK_ACCOUNTS_CLIENT_MISMATCH`)"
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key/token"
          },
          "404": {
            "description": "Entity not found or not accessible"
          },
          "409": {
            "description": "An account is already linked to a different entity (`BANK_ACCOUNT_ASSIGNED_TO_DIFFERENT_ENTITY`)"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "bankAccounts.link",
        "x-sdk-resource": "bankAccounts",
        "x-sdk-method": "link"
      }
    },
    "/api/public/v1/entities/{entityId}/change-sets": {
      "post": {
        "summary": "Submit a change-set (proposed financial writes) for an entity",
        "description": "Records an agent-proposed set of write operations (`journal.post` and/or `reconcile`) as a PENDING change-set. Idempotent on the content hash — re-submitting identical content returns the existing change-set. The set is NOT committed here; an admin approves it (L1) before it hits the ledger. The read-only box token is permitted on this single write path and remains pinned to its entity.\n",
        "tags": ["ChangeSets"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "operations": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": ["journal.post"]
                            },
                            "payload": {
                              "type": "object",
                              "properties": {
                                "narration": {
                                  "type": "string"
                                },
                                "date": {
                                  "type": "string"
                                },
                                "lines": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "entityAccountId": {
                                        "type": "string"
                                      },
                                      "credit": {
                                        "type": "number"
                                      },
                                      "debit": {
                                        "type": "number"
                                      },
                                      "taxRateId": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "entityAccountId",
                                      "credit",
                                      "debit",
                                      "taxRateId"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "taxMode": {
                                  "type": "string",
                                  "enum": [
                                    "NO_TAX",
                                    "TAX_INCLUSIVE",
                                    "TAX_EXCLUSIVE"
                                  ]
                                }
                              },
                              "required": ["narration", "date", "lines"],
                              "additionalProperties": false
                            }
                          },
                          "required": ["type", "payload"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": ["reconcile"]
                            },
                            "payload": {
                              "type": "object",
                              "properties": {
                                "transactionId": {
                                  "type": "string"
                                },
                                "assignment": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "code": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "taxCode": {
                                        "type": "string"
                                      },
                                      "credit": {
                                        "type": "number"
                                      },
                                      "debit": {
                                        "type": "number"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    },
                                    "required": ["code", "name", "taxCode"],
                                    "additionalProperties": false
                                  }
                                },
                                "narration": {
                                  "type": "string"
                                },
                                "taxMode": {
                                  "type": "string",
                                  "enum": [
                                    "NO_TAX",
                                    "TAX_INCLUSIVE",
                                    "TAX_EXCLUSIVE"
                                  ]
                                },
                                "confidence": {
                                  "type": "number"
                                },
                                "reasoning": {
                                  "type": "string"
                                }
                              },
                              "required": ["transactionId", "assignment"],
                              "additionalProperties": false
                            }
                          },
                          "required": ["type", "payload"],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "sessionId": {
                    "type": "string"
                  },
                  "agentSessionId": {
                    "type": "string"
                  }
                },
                "required": ["operations"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "contentHash": {
                          "type": "string"
                        }
                      },
                      "required": ["id", "status", "contentHash"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["success", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid body"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "TOKEN_READ_ONLY / TOKEN_ENTITY_MISMATCH / ENTITY_ACCESS_DENIED"
          },
          "404": {
            "description": "Entity has no workspace"
          },
          "422": {
            "description": "CHANGE_SET_INVALID — an operation failed validation (e.g. amounts do not sum",
            "journal does not balance)": null
          },
          "500": {
            "description": "Failed to record the change-set"
          }
        },
        "operationId": "changeSets.create",
        "x-sdk-resource": "changeSets",
        "x-sdk-method": "create"
      }
    },
    "/api/public/v1/entities/{entityId}/charts/{accountId}/delete": {
      "post": {
        "summary": "Delete or hide an entity account",
        "description": "Deletes a custom child account or hides a template-based child account by creating an exclusion. Parent accounts cannot be deleted. Accounts assigned a system role or linked to bank accounts, fixed assets or inter-entity transfers cannot be deleted.",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "accountId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        }
                      },
                      "required": ["success"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The account is a parent, has children or journal entries, or has an operational link that prevents deletion (DELETE_RESTRICTED)."
          },
          "404": {
            "description": "Account not found"
          }
        },
        "operationId": "entityAccounts.del",
        "x-sdk-resource": "entityAccounts",
        "x-sdk-method": "del"
      }
    },
    "/api/public/v1/entities/{entityId}/charts/{accountId}/reset": {
      "post": {
        "summary": "Reset an entity account to template defaults",
        "description": "Resets all customized fields on a template-based entity account back to the template values and clears customization flags. No request body required.",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "accountId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        }
                      },
                      "required": ["success"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "404": {
            "description": "Account not found"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "entityAccounts.reset",
        "x-sdk-resource": "entityAccounts",
        "x-sdk-method": "reset"
      }
    },
    "/api/public/v1/entities/{entityId}/charts/{accountId}/update": {
      "post": {
        "summary": "Update an entity account",
        "description": "Discover GET /api/public/v1/entities/{entityId}/report-categories before a write. In activated scope, create with reporting.groupKey and explicit reporting.categoryKey (null for eligible group-only accounts); omit legacy parent references. Metadata-only patches preserve reporting. Reporting updates require reporting.expected with the saved pair (or null for an unassigned account). All active workspaces must allow the write. Type derives from group. A contract mismatch or stale pair returns 409; reload and rediscover without automatically retrying a mutation. Stored subtype output remains a compatibility value.\n",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "accountId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reporting": {
                    "type": "object",
                    "properties": {
                      "groupKey": {
                        "type": "string"
                      },
                      "categoryKey": {
                        "type": "string",
                        "nullable": true
                      },
                      "expected": {
                        "type": "object",
                        "properties": {
                          "groupKey": {
                            "type": "string"
                          },
                          "categoryKey": {
                            "type": "string",
                            "nullable": true
                          }
                        },
                        "required": ["groupKey", "categoryKey"],
                        "additionalProperties": false,
                        "nullable": true
                      }
                    },
                    "required": ["groupKey", "categoryKey", "expected"],
                    "additionalProperties": false
                  },
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string",
                    "nullable": true
                  },
                  "taxCode": {
                    "type": "string"
                  },
                  "mappedCode": {
                    "type": "string",
                    "nullable": true
                  },
                  "code": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string"
                        },
                        "reportCategoryReviewedAt": {
                          "type": "string",
                          "nullable": true
                        },
                        "reportCategoryReviewVersion": {
                          "type": "number"
                        },
                        "code": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "subtype": {
                          "type": "string"
                        },
                        "reportGroup": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "key": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string"
                            },
                            "accountType": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "key",
                            "name",
                            "status",
                            "accountType"
                          ],
                          "additionalProperties": false,
                          "nullable": true
                        },
                        "reportCategory": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "key": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string"
                            }
                          },
                          "required": ["id", "key", "name", "status"],
                          "additionalProperties": false,
                          "nullable": true
                        },
                        "taxCode": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        },
                        "mappedCode": {
                          "type": "string",
                          "nullable": true
                        },
                        "isSystem": {
                          "type": "boolean"
                        },
                        "systemRole": {
                          "type": "string",
                          "nullable": true
                        },
                        "parentId": {
                          "type": "string",
                          "nullable": true
                        },
                        "isExcluded": {
                          "type": "boolean"
                        },
                        "isIncluded": {
                          "type": "boolean"
                        },
                        "source": {
                          "type": "string",
                          "enum": ["template", "overridden", "custom"]
                        }
                      },
                      "required": [
                        "id",
                        "code",
                        "name",
                        "type",
                        "subtype",
                        "reportGroup",
                        "reportCategory",
                        "taxCode",
                        "description",
                        "mappedCode",
                        "isSystem"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation error or business rule violation"
          },
          "404": {
            "description": "Account not found"
          }
        },
        "operationId": "entityAccounts.update",
        "x-sdk-resource": "entityAccounts",
        "x-sdk-method": "update"
      }
    },
    "/api/public/v1/entities/{entityId}/charts/excluded/{templateAccountId}/restore": {
      "post": {
        "summary": "Restore a hidden/excluded template account",
        "description": "Restores an excluded template account by removing the exclusion and recreating the entity account from the template. No request body required.",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "templateAccountId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean"
                        }
                      },
                      "required": ["success"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Parent account must be restored first, or restoring would conflict with an assigned system role (SYSTEM_ACCOUNT_CONFLICT)."
          },
          "404": {
            "description": "Template account no longer exists (chart template may have been updated)"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "entityAccounts.restore",
        "x-sdk-resource": "entityAccounts",
        "x-sdk-method": "restore"
      }
    },
    "/api/public/v1/entities/{entityId}/charts": {
      "get": {
        "summary": "List chart of accounts for an entity",
        "description": "Returns chart account codes configured for the specified entity. Supports filtering by system accounts and excluded accounts. Requires API key authentication and entity access. reportGroup and reportCategory expose the saved reporting classification; subtype remains the legacy compatibility value and may differ from current report placement. Null category with a saved group is valid.",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeSystem",
            "in": "query",
            "required": false,
            "description": "Include system-generated accounts (GST, Rounding, Retained Earnings, etc.) in the response. Defaults to true so all account codes are available for mapping (e.g. importing a trial balance or journals). Pass includeSystem=false to exclude system accounts.",
            "schema": {
              "type": "string"
            },
            "examples": {
              "default": {
                "value": true,
                "summary": "Include system accounts (default behavior)"
              },
              "exclude": {
                "value": false,
                "summary": "Exclude system accounts"
              }
            }
          },
          {
            "name": "includeExcluded",
            "in": "query",
            "required": false,
            "description": "Include accounts that have been excluded from the entity's chart. When true, excluded accounts are returned with isExcluded=true flag, and their data comes from the template account.",
            "schema": {
              "type": "string"
            },
            "examples": {
              "default": {
                "value": false,
                "summary": "Exclude excluded accounts (default behavior)"
              },
              "include": {
                "value": true,
                "summary": "Include excluded accounts (with isExcluded=true flag)"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "type": "string"
                          },
                          "reportCategoryReviewedAt": {
                            "type": "string",
                            "nullable": true
                          },
                          "reportCategoryReviewVersion": {
                            "type": "number"
                          },
                          "code": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "subtype": {
                            "type": "string"
                          },
                          "reportGroup": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "key": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "accountType": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "key",
                              "name",
                              "status",
                              "accountType"
                            ],
                            "additionalProperties": false,
                            "nullable": true
                          },
                          "reportCategory": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "key": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              }
                            },
                            "required": ["id", "key", "name", "status"],
                            "additionalProperties": false,
                            "nullable": true
                          },
                          "taxCode": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string",
                            "nullable": true
                          },
                          "mappedCode": {
                            "type": "string",
                            "nullable": true
                          },
                          "isSystem": {
                            "type": "boolean"
                          },
                          "systemRole": {
                            "type": "string",
                            "nullable": true
                          },
                          "parentId": {
                            "type": "string",
                            "nullable": true
                          },
                          "isExcluded": {
                            "type": "boolean"
                          },
                          "isIncluded": {
                            "type": "boolean"
                          },
                          "source": {
                            "type": "string",
                            "enum": ["template", "overridden", "custom"]
                          }
                        },
                        "required": [
                          "id",
                          "code",
                          "name",
                          "type",
                          "subtype",
                          "reportGroup",
                          "reportCategory",
                          "taxCode",
                          "description",
                          "mappedCode",
                          "isSystem"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "entityAccounts.list",
        "x-sdk-resource": "entityAccounts",
        "x-sdk-method": "list"
      },
      "post": {
        "summary": "Create a child account in the chart of accounts",
        "description": "Discover GET /api/public/v1/entities/{entityId}/report-categories before a write. In activated scope, create with reporting.groupKey and explicit reporting.categoryKey (null for eligible group-only accounts); omit legacy parent references. Metadata-only patches preserve reporting. Reporting updates require reporting.expected with the saved pair (or null for an unassigned account). All active workspaces must allow the write. Type derives from group. A contract mismatch or stale pair returns 409; reload and rediscover without automatically retrying a mutation. Stored subtype output remains a compatibility value.\n",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "taxCode": {
                    "type": "string"
                  },
                  "reporting": {
                    "type": "object",
                    "properties": {
                      "groupKey": {
                        "type": "string"
                      },
                      "categoryKey": {
                        "type": "string",
                        "nullable": true
                      }
                    },
                    "required": ["groupKey", "categoryKey"],
                    "additionalProperties": false
                  },
                  "parentAccountId": {
                    "type": "string"
                  },
                  "parentAccountCode": {
                    "type": "string"
                  },
                  "parentMappedCode": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string",
                    "nullable": true
                  },
                  "mappedCode": {
                    "type": "string",
                    "nullable": true
                  }
                },
                "required": ["code", "name", "taxCode"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string"
                        },
                        "reportCategoryReviewedAt": {
                          "type": "string",
                          "nullable": true
                        },
                        "reportCategoryReviewVersion": {
                          "type": "number"
                        },
                        "code": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "subtype": {
                          "type": "string"
                        },
                        "reportGroup": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "key": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string"
                            },
                            "accountType": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "key",
                            "name",
                            "status",
                            "accountType"
                          ],
                          "additionalProperties": false,
                          "nullable": true
                        },
                        "reportCategory": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "key": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string"
                            }
                          },
                          "required": ["id", "key", "name", "status"],
                          "additionalProperties": false,
                          "nullable": true
                        },
                        "taxCode": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        },
                        "mappedCode": {
                          "type": "string",
                          "nullable": true
                        },
                        "isSystem": {
                          "type": "boolean"
                        },
                        "systemRole": {
                          "type": "string",
                          "nullable": true
                        },
                        "parentId": {
                          "type": "string",
                          "nullable": true
                        },
                        "isExcluded": {
                          "type": "boolean"
                        },
                        "isIncluded": {
                          "type": "boolean"
                        },
                        "source": {
                          "type": "string",
                          "enum": ["template", "overridden", "custom"]
                        }
                      },
                      "required": [
                        "id",
                        "code",
                        "name",
                        "type",
                        "subtype",
                        "reportGroup",
                        "reportCategory",
                        "taxCode",
                        "description",
                        "mappedCode",
                        "isSystem"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation error or business rule violation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "description": "Error message"
                    },
                    "code": {
                      "type": "string",
                      "description": "Error code"
                    },
                    "details": {
                      "type": "object",
                      "description": "Additional error details (for template conflicts)",
                      "properties": {
                        "templateAccountId": {
                          "type": "string"
                        },
                        "isExcluded": {
                          "type": "boolean"
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "invalidCodeFormat": {
                    "summary": "Invalid code format",
                    "value": {
                      "error": "Child account code must start with \"2030.\" followed by a unique suffix",
                      "code": "INVALID_CODE_FORMAT"
                    }
                  },
                  "templateConflict": {
                    "summary": "Code conflicts with template account",
                    "value": {
                      "error": "Account code conflicts with template account",
                      "code": "TEMPLATE_CONFLICT",
                      "details": {
                        "templateAccountId": "770e8400-e29b-41d4-a716-446655440000",
                        "isExcluded": false
                      }
                    }
                  },
                  "grandchildNotAllowed": {
                    "summary": "Cannot create grandchild account",
                    "value": {
                      "error": "Cannot create child account under \"Travel Expenses\" because it is already a child account. Only top-level accounts can have children.",
                      "code": "GRANDCHILD_NOT_ALLOWED"
                    }
                  },
                  "bankAccountParent": {
                    "summary": "Cannot add children to bank accounts",
                    "value": {
                      "error": "Cannot add child accounts to bank account-linked account \"ANZ Business Account\"",
                      "code": "BANK_ACCOUNT_PARENT"
                    }
                  },
                  "invalidTaxCode": {
                    "summary": "Tax code not found",
                    "value": {
                      "error": "Tax rate with code \"GST20\" not found for entity",
                      "code": "INVALID_TAX_CODE"
                    }
                  },
                  "parentRequired": {
                    "summary": "Parent reference required",
                    "value": {
                      "error": "One of parentAccountId, parentAccountCode, or parentMappedCode is required",
                      "code": "PARENT_REQUIRED"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Parent account not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "Parent account not found",
                  "code": "PARENT_NOT_FOUND"
                }
              }
            }
          },
          "409": {
            "description": "Conflict - account code already exists",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "Account with code 2030.100 already exists in this entity",
                  "code": "DUPLICATE_CODE"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "entityAccounts.create",
        "x-sdk-resource": "entityAccounts",
        "x-sdk-method": "create"
      }
    },
    "/api/public/v1/entities/{entityId}/contacts/{contactId}/archive": {
      "post": {
        "summary": "Archive a contact",
        "description": "Archives an active contact, optionally archiving a business's people with it.",
        "tags": ["Contacts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "contactId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "archivePeople": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["archived", "last-person"]
                    }
                  },
                  "required": ["status"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid contact ID",
            "JSON": null,
            "or archive option.": null
          },
          "401": {
            "description": "Unauthorized."
          },
          "403": {
            "description": "Insufficient workspace role or entity permission."
          },
          "404": {
            "description": "Contact or entity not found."
          },
          "409": {
            "description": "Archiving would leave a live business without a person to invoice."
          },
          "500": {
            "description": "Internal server error."
          }
        },
        "operationId": "contacts.archive",
        "x-sdk-resource": "contacts",
        "x-sdk-method": "archive"
      }
    },
    "/api/public/v1/entities/{entityId}/contacts/{contactId}/restore": {
      "post": {
        "summary": "Restore a contact",
        "description": "Restores an archived contact and optionally the people archived with the same business operation.",
        "tags": ["Contacts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "contactId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "restorePeople": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["restored"]
                    }
                  },
                  "required": ["status"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid contact ID",
            "JSON": null,
            "or restore option.": null
          },
          "401": {
            "description": "Unauthorized."
          },
          "403": {
            "description": "Insufficient workspace role or entity permission."
          },
          "404": {
            "description": "Contact or entity not found."
          },
          "500": {
            "description": "Internal server error."
          }
        },
        "operationId": "contacts.restore",
        "x-sdk-resource": "contacts",
        "x-sdk-method": "restore"
      }
    },
    "/api/public/v1/entities/{entityId}/contacts/{contactId}": {
      "get": {
        "summary": "Get a contact",
        "description": "Returns one active or archived contact belonging to the path entity.",
        "tags": ["Contacts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "contactId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": ["BUSINESS"]
                            },
                            "people": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  },
                                  "receivesInvoices": {
                                    "type": "boolean"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": ["active", "archived"]
                                  },
                                  "archivedAt": {
                                    "type": "string",
                                    "format": "date-time",
                                    "nullable": true
                                  },
                                  "emails": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "email": {
                                          "type": "string"
                                        },
                                        "label": {
                                          "type": "string",
                                          "nullable": true
                                        }
                                      },
                                      "required": ["id", "email", "label"],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName",
                                  "receivesInvoices",
                                  "status",
                                  "archivedAt",
                                  "emails"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "id": {
                              "type": "string"
                            },
                            "workspaceId": {
                              "type": "string"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": ["active", "archived"]
                            },
                            "displayName": {
                              "type": "string"
                            },
                            "legalName": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifierScheme": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifier": {
                              "type": "string",
                              "nullable": true
                            },
                            "gstNumber": {
                              "type": "string",
                              "nullable": true
                            },
                            "website": {
                              "type": "string",
                              "nullable": true
                            },
                            "notes": {
                              "type": "string",
                              "nullable": true
                            },
                            "invoiceNotes": {
                              "type": "string",
                              "nullable": true
                            },
                            "organisationId": {
                              "type": "string",
                              "nullable": true
                            },
                            "receivesInvoices": {
                              "type": "boolean"
                            },
                            "addresses": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "BILLING",
                                      "DELIVERY",
                                      "POSTAL",
                                      "PHYSICAL",
                                      "REMITTANCE",
                                      "OTHER"
                                    ]
                                  },
                                  "attentionTo": {
                                    "type": "string"
                                  },
                                  "addressLines": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "sublocality": {
                                    "type": "string"
                                  },
                                  "locality": {
                                    "type": "string"
                                  },
                                  "administrativeArea": {
                                    "type": "string"
                                  },
                                  "postalCode": {
                                    "type": "string"
                                  },
                                  "sortingCode": {
                                    "type": "string"
                                  },
                                  "countryCode": {
                                    "type": "string"
                                  },
                                  "isInvoiceDefault": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "id",
                                  "type",
                                  "addressLines",
                                  "countryCode",
                                  "isInvoiceDefault"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "phones": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "isPrimary": {
                                    "type": "boolean"
                                  }
                                },
                                "required": ["id", "number", "isPrimary"],
                                "additionalProperties": false
                              }
                            },
                            "organisation": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "displayName": {
                                  "type": "string"
                                }
                              },
                              "required": ["id", "displayName"],
                              "additionalProperties": false,
                              "nullable": true
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "archivedAt": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            }
                          },
                          "required": [
                            "type",
                            "people",
                            "id",
                            "workspaceId",
                            "entityId",
                            "status",
                            "displayName",
                            "legalName",
                            "identifierScheme",
                            "identifier",
                            "gstNumber",
                            "website",
                            "notes",
                            "invoiceNotes",
                            "organisationId",
                            "receivesInvoices",
                            "addresses",
                            "phones",
                            "organisation",
                            "createdAt",
                            "updatedAt",
                            "archivedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": ["INDIVIDUAL"]
                            },
                            "emails": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "email": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string",
                                    "nullable": true
                                  }
                                },
                                "required": ["id", "email", "label"],
                                "additionalProperties": false
                              }
                            },
                            "id": {
                              "type": "string"
                            },
                            "workspaceId": {
                              "type": "string"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": ["active", "archived"]
                            },
                            "displayName": {
                              "type": "string"
                            },
                            "legalName": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifierScheme": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifier": {
                              "type": "string",
                              "nullable": true
                            },
                            "gstNumber": {
                              "type": "string",
                              "nullable": true
                            },
                            "website": {
                              "type": "string",
                              "nullable": true
                            },
                            "notes": {
                              "type": "string",
                              "nullable": true
                            },
                            "invoiceNotes": {
                              "type": "string",
                              "nullable": true
                            },
                            "organisationId": {
                              "type": "string",
                              "nullable": true
                            },
                            "receivesInvoices": {
                              "type": "boolean"
                            },
                            "addresses": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "BILLING",
                                      "DELIVERY",
                                      "POSTAL",
                                      "PHYSICAL",
                                      "REMITTANCE",
                                      "OTHER"
                                    ]
                                  },
                                  "attentionTo": {
                                    "type": "string"
                                  },
                                  "addressLines": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "sublocality": {
                                    "type": "string"
                                  },
                                  "locality": {
                                    "type": "string"
                                  },
                                  "administrativeArea": {
                                    "type": "string"
                                  },
                                  "postalCode": {
                                    "type": "string"
                                  },
                                  "sortingCode": {
                                    "type": "string"
                                  },
                                  "countryCode": {
                                    "type": "string"
                                  },
                                  "isInvoiceDefault": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "id",
                                  "type",
                                  "addressLines",
                                  "countryCode",
                                  "isInvoiceDefault"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "phones": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "isPrimary": {
                                    "type": "boolean"
                                  }
                                },
                                "required": ["id", "number", "isPrimary"],
                                "additionalProperties": false
                              }
                            },
                            "organisation": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "displayName": {
                                  "type": "string"
                                }
                              },
                              "required": ["id", "displayName"],
                              "additionalProperties": false,
                              "nullable": true
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "archivedAt": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            }
                          },
                          "required": [
                            "type",
                            "emails",
                            "id",
                            "workspaceId",
                            "entityId",
                            "status",
                            "displayName",
                            "legalName",
                            "identifierScheme",
                            "identifier",
                            "gstNumber",
                            "website",
                            "notes",
                            "invoiceNotes",
                            "organisationId",
                            "receivesInvoices",
                            "addresses",
                            "phones",
                            "organisation",
                            "createdAt",
                            "updatedAt",
                            "archivedAt"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid contact ID."
          },
          "401": {
            "description": "Unauthorized."
          },
          "403": {
            "description": "Insufficient workspace role."
          },
          "404": {
            "description": "Contact or entity not found."
          },
          "500": {
            "description": "Internal server error."
          }
        },
        "operationId": "contacts.retrieve",
        "x-sdk-resource": "contacts",
        "x-sdk-method": "retrieve"
      },
      "patch": {
        "summary": "Update a contact",
        "description": "Updates only the supplied mutable fields on an active contact. Omitted fields, including nested email labels and person invoice preferences, are unchanged; send null to clear an email label. Type and entity cannot be changed.",
        "tags": ["Contacts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "contactId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "displayName": {
                    "type": "string"
                  },
                  "email": {
                    "type": "object",
                    "properties": {
                      "email": {
                        "type": "string"
                      },
                      "label": {
                        "type": "string",
                        "nullable": true
                      }
                    },
                    "required": ["email"],
                    "additionalProperties": false,
                    "nullable": true
                  },
                  "people": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "receivesInvoices": {
                          "type": "boolean"
                        },
                        "id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "displayName": {
                          "type": "string"
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "phones": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "number": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "isPrimary": {
                          "type": "boolean"
                        }
                      },
                      "required": ["id", "number"],
                      "additionalProperties": false
                    }
                  },
                  "addresses": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "BILLING",
                            "DELIVERY",
                            "POSTAL",
                            "PHYSICAL",
                            "REMITTANCE",
                            "OTHER"
                          ]
                        },
                        "addressLines": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "countryCode": {
                          "type": "string"
                        },
                        "label": {
                          "type": "string"
                        },
                        "attentionTo": {
                          "type": "string"
                        },
                        "sublocality": {
                          "type": "string"
                        },
                        "locality": {
                          "type": "string"
                        },
                        "administrativeArea": {
                          "type": "string"
                        },
                        "postalCode": {
                          "type": "string"
                        },
                        "sortingCode": {
                          "type": "string"
                        },
                        "isInvoiceDefault": {
                          "type": "boolean"
                        }
                      },
                      "required": ["id", "type", "addressLines", "countryCode"],
                      "additionalProperties": false
                    }
                  },
                  "linkPastInvoices": {
                    "type": "boolean"
                  },
                  "legalName": {
                    "type": "string",
                    "nullable": true
                  },
                  "identifierScheme": {
                    "type": "string",
                    "nullable": true
                  },
                  "identifier": {
                    "type": "string",
                    "nullable": true
                  },
                  "gstNumber": {
                    "type": "string",
                    "nullable": true
                  },
                  "website": {
                    "type": "string",
                    "nullable": true
                  },
                  "notes": {
                    "type": "string",
                    "nullable": true
                  },
                  "invoiceNotes": {
                    "type": "string",
                    "nullable": true
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": ["BUSINESS"]
                            },
                            "people": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  },
                                  "receivesInvoices": {
                                    "type": "boolean"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": ["active", "archived"]
                                  },
                                  "archivedAt": {
                                    "type": "string",
                                    "format": "date-time",
                                    "nullable": true
                                  },
                                  "emails": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "email": {
                                          "type": "string"
                                        },
                                        "label": {
                                          "type": "string",
                                          "nullable": true
                                        }
                                      },
                                      "required": ["id", "email", "label"],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName",
                                  "receivesInvoices",
                                  "status",
                                  "archivedAt",
                                  "emails"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "id": {
                              "type": "string"
                            },
                            "workspaceId": {
                              "type": "string"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": ["active", "archived"]
                            },
                            "displayName": {
                              "type": "string"
                            },
                            "legalName": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifierScheme": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifier": {
                              "type": "string",
                              "nullable": true
                            },
                            "gstNumber": {
                              "type": "string",
                              "nullable": true
                            },
                            "website": {
                              "type": "string",
                              "nullable": true
                            },
                            "notes": {
                              "type": "string",
                              "nullable": true
                            },
                            "invoiceNotes": {
                              "type": "string",
                              "nullable": true
                            },
                            "organisationId": {
                              "type": "string",
                              "nullable": true
                            },
                            "receivesInvoices": {
                              "type": "boolean"
                            },
                            "addresses": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "BILLING",
                                      "DELIVERY",
                                      "POSTAL",
                                      "PHYSICAL",
                                      "REMITTANCE",
                                      "OTHER"
                                    ]
                                  },
                                  "attentionTo": {
                                    "type": "string"
                                  },
                                  "addressLines": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "sublocality": {
                                    "type": "string"
                                  },
                                  "locality": {
                                    "type": "string"
                                  },
                                  "administrativeArea": {
                                    "type": "string"
                                  },
                                  "postalCode": {
                                    "type": "string"
                                  },
                                  "sortingCode": {
                                    "type": "string"
                                  },
                                  "countryCode": {
                                    "type": "string"
                                  },
                                  "isInvoiceDefault": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "id",
                                  "type",
                                  "addressLines",
                                  "countryCode",
                                  "isInvoiceDefault"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "phones": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "isPrimary": {
                                    "type": "boolean"
                                  }
                                },
                                "required": ["id", "number", "isPrimary"],
                                "additionalProperties": false
                              }
                            },
                            "organisation": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "displayName": {
                                  "type": "string"
                                }
                              },
                              "required": ["id", "displayName"],
                              "additionalProperties": false,
                              "nullable": true
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "archivedAt": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            }
                          },
                          "required": [
                            "type",
                            "people",
                            "id",
                            "workspaceId",
                            "entityId",
                            "status",
                            "displayName",
                            "legalName",
                            "identifierScheme",
                            "identifier",
                            "gstNumber",
                            "website",
                            "notes",
                            "invoiceNotes",
                            "organisationId",
                            "receivesInvoices",
                            "addresses",
                            "phones",
                            "organisation",
                            "createdAt",
                            "updatedAt",
                            "archivedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": ["INDIVIDUAL"]
                            },
                            "emails": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "email": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string",
                                    "nullable": true
                                  }
                                },
                                "required": ["id", "email", "label"],
                                "additionalProperties": false
                              }
                            },
                            "id": {
                              "type": "string"
                            },
                            "workspaceId": {
                              "type": "string"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": ["active", "archived"]
                            },
                            "displayName": {
                              "type": "string"
                            },
                            "legalName": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifierScheme": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifier": {
                              "type": "string",
                              "nullable": true
                            },
                            "gstNumber": {
                              "type": "string",
                              "nullable": true
                            },
                            "website": {
                              "type": "string",
                              "nullable": true
                            },
                            "notes": {
                              "type": "string",
                              "nullable": true
                            },
                            "invoiceNotes": {
                              "type": "string",
                              "nullable": true
                            },
                            "organisationId": {
                              "type": "string",
                              "nullable": true
                            },
                            "receivesInvoices": {
                              "type": "boolean"
                            },
                            "addresses": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "BILLING",
                                      "DELIVERY",
                                      "POSTAL",
                                      "PHYSICAL",
                                      "REMITTANCE",
                                      "OTHER"
                                    ]
                                  },
                                  "attentionTo": {
                                    "type": "string"
                                  },
                                  "addressLines": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "sublocality": {
                                    "type": "string"
                                  },
                                  "locality": {
                                    "type": "string"
                                  },
                                  "administrativeArea": {
                                    "type": "string"
                                  },
                                  "postalCode": {
                                    "type": "string"
                                  },
                                  "sortingCode": {
                                    "type": "string"
                                  },
                                  "countryCode": {
                                    "type": "string"
                                  },
                                  "isInvoiceDefault": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "id",
                                  "type",
                                  "addressLines",
                                  "countryCode",
                                  "isInvoiceDefault"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "phones": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "isPrimary": {
                                    "type": "boolean"
                                  }
                                },
                                "required": ["id", "number", "isPrimary"],
                                "additionalProperties": false
                              }
                            },
                            "organisation": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "displayName": {
                                  "type": "string"
                                }
                              },
                              "required": ["id", "displayName"],
                              "additionalProperties": false,
                              "nullable": true
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "archivedAt": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            }
                          },
                          "required": [
                            "type",
                            "emails",
                            "id",
                            "workspaceId",
                            "entityId",
                            "status",
                            "displayName",
                            "legalName",
                            "identifierScheme",
                            "identifier",
                            "gstNumber",
                            "website",
                            "notes",
                            "invoiceNotes",
                            "organisationId",
                            "receivesInvoices",
                            "addresses",
                            "phones",
                            "organisation",
                            "createdAt",
                            "updatedAt",
                            "archivedAt"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "linkedInvoiceCount": {
                      "type": "number"
                    }
                  },
                  "required": ["data", "linkedInvoiceCount"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid ID",
            "JSON": null,
            "field values": null,
            "or saved contact relationships.": null
          },
          "401": {
            "description": "Unauthorized."
          },
          "403": {
            "description": "Insufficient workspace role or entity permission."
          },
          "404": {
            "description": "Contact or entity not found."
          },
          "500": {
            "description": "Internal server error."
          }
        },
        "operationId": "contacts.update",
        "x-sdk-resource": "contacts",
        "x-sdk-method": "update"
      },
      "delete": {
        "summary": "Delete a contact",
        "description": "Soft-deletes an active contact that has no invoice history.",
        "tags": ["Contacts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "contactId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["last-person", "deleted", "has-history"]
                    }
                  },
                  "required": ["status"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid contact ID."
          },
          "401": {
            "description": "Unauthorized."
          },
          "403": {
            "description": "Insufficient workspace role or entity permission."
          },
          "404": {
            "description": "Contact or entity not found."
          },
          "409": {
            "description": "Contact has invoice history or removal would leave a business without a person to invoice."
          },
          "500": {
            "description": "Internal server error."
          }
        },
        "operationId": "contacts.del",
        "x-sdk-resource": "contacts",
        "x-sdk-method": "del"
      }
    },
    "/api/public/v1/entities/{entityId}/contacts": {
      "post": {
        "summary": "Create a contact",
        "description": "Creates a contact in the path entity and returns its public representation.",
        "tags": ["Contacts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "displayName": {
                        "type": "string"
                      },
                      "type": {
                        "type": "string",
                        "enum": ["BUSINESS", "INDIVIDUAL"]
                      },
                      "email": {
                        "type": "object",
                        "properties": {
                          "email": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          }
                        },
                        "required": ["email"],
                        "additionalProperties": false
                      },
                      "people": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "receivesInvoices": {
                              "type": "boolean"
                            },
                            "id": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            },
                            "label": {
                              "type": "string"
                            },
                            "displayName": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "phones": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "string"
                            },
                            "label": {
                              "type": "string"
                            },
                            "isPrimary": {
                              "type": "boolean"
                            }
                          },
                          "required": ["id", "number"],
                          "additionalProperties": false
                        }
                      },
                      "addresses": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "type": {
                              "type": "string",
                              "enum": [
                                "BILLING",
                                "DELIVERY",
                                "POSTAL",
                                "PHYSICAL",
                                "REMITTANCE",
                                "OTHER"
                              ]
                            },
                            "addressLines": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "countryCode": {
                              "type": "string"
                            },
                            "label": {
                              "type": "string"
                            },
                            "attentionTo": {
                              "type": "string"
                            },
                            "sublocality": {
                              "type": "string"
                            },
                            "locality": {
                              "type": "string"
                            },
                            "administrativeArea": {
                              "type": "string"
                            },
                            "postalCode": {
                              "type": "string"
                            },
                            "sortingCode": {
                              "type": "string"
                            },
                            "isInvoiceDefault": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "id",
                            "type",
                            "addressLines",
                            "countryCode"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "linkPastInvoices": {
                        "type": "boolean"
                      },
                      "legalName": {
                        "type": "string"
                      },
                      "identifierScheme": {
                        "type": "string"
                      },
                      "identifier": {
                        "type": "string"
                      },
                      "gstNumber": {
                        "type": "string"
                      },
                      "website": {
                        "type": "string"
                      },
                      "notes": {
                        "type": "string"
                      },
                      "invoiceNotes": {
                        "type": "string"
                      }
                    },
                    "required": ["displayName", "type"],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "people": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "receivesInvoices": {
                              "type": "boolean"
                            },
                            "id": {
                              "type": "string"
                            },
                            "email": {
                              "type": "string"
                            },
                            "label": {
                              "type": "string"
                            },
                            "displayName": {
                              "type": "string"
                            }
                          },
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": ["people"],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": ["BUSINESS"]
                            },
                            "people": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "displayName": {
                                    "type": "string"
                                  },
                                  "receivesInvoices": {
                                    "type": "boolean"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": ["active", "archived"]
                                  },
                                  "archivedAt": {
                                    "type": "string",
                                    "format": "date-time",
                                    "nullable": true
                                  },
                                  "emails": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "email": {
                                          "type": "string"
                                        },
                                        "label": {
                                          "type": "string",
                                          "nullable": true
                                        }
                                      },
                                      "required": ["id", "email", "label"],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "id",
                                  "displayName",
                                  "receivesInvoices",
                                  "status",
                                  "archivedAt",
                                  "emails"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "id": {
                              "type": "string"
                            },
                            "workspaceId": {
                              "type": "string"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": ["active", "archived"]
                            },
                            "displayName": {
                              "type": "string"
                            },
                            "legalName": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifierScheme": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifier": {
                              "type": "string",
                              "nullable": true
                            },
                            "gstNumber": {
                              "type": "string",
                              "nullable": true
                            },
                            "website": {
                              "type": "string",
                              "nullable": true
                            },
                            "notes": {
                              "type": "string",
                              "nullable": true
                            },
                            "invoiceNotes": {
                              "type": "string",
                              "nullable": true
                            },
                            "organisationId": {
                              "type": "string",
                              "nullable": true
                            },
                            "receivesInvoices": {
                              "type": "boolean"
                            },
                            "addresses": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "BILLING",
                                      "DELIVERY",
                                      "POSTAL",
                                      "PHYSICAL",
                                      "REMITTANCE",
                                      "OTHER"
                                    ]
                                  },
                                  "attentionTo": {
                                    "type": "string"
                                  },
                                  "addressLines": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "sublocality": {
                                    "type": "string"
                                  },
                                  "locality": {
                                    "type": "string"
                                  },
                                  "administrativeArea": {
                                    "type": "string"
                                  },
                                  "postalCode": {
                                    "type": "string"
                                  },
                                  "sortingCode": {
                                    "type": "string"
                                  },
                                  "countryCode": {
                                    "type": "string"
                                  },
                                  "isInvoiceDefault": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "id",
                                  "type",
                                  "addressLines",
                                  "countryCode",
                                  "isInvoiceDefault"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "phones": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "isPrimary": {
                                    "type": "boolean"
                                  }
                                },
                                "required": ["id", "number", "isPrimary"],
                                "additionalProperties": false
                              }
                            },
                            "organisation": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "displayName": {
                                  "type": "string"
                                }
                              },
                              "required": ["id", "displayName"],
                              "additionalProperties": false,
                              "nullable": true
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "archivedAt": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            }
                          },
                          "required": [
                            "type",
                            "people",
                            "id",
                            "workspaceId",
                            "entityId",
                            "status",
                            "displayName",
                            "legalName",
                            "identifierScheme",
                            "identifier",
                            "gstNumber",
                            "website",
                            "notes",
                            "invoiceNotes",
                            "organisationId",
                            "receivesInvoices",
                            "addresses",
                            "phones",
                            "organisation",
                            "createdAt",
                            "updatedAt",
                            "archivedAt"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": ["INDIVIDUAL"]
                            },
                            "emails": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "email": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string",
                                    "nullable": true
                                  }
                                },
                                "required": ["id", "email", "label"],
                                "additionalProperties": false
                              }
                            },
                            "id": {
                              "type": "string"
                            },
                            "workspaceId": {
                              "type": "string"
                            },
                            "entityId": {
                              "type": "string"
                            },
                            "status": {
                              "type": "string",
                              "enum": ["active", "archived"]
                            },
                            "displayName": {
                              "type": "string"
                            },
                            "legalName": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifierScheme": {
                              "type": "string",
                              "nullable": true
                            },
                            "identifier": {
                              "type": "string",
                              "nullable": true
                            },
                            "gstNumber": {
                              "type": "string",
                              "nullable": true
                            },
                            "website": {
                              "type": "string",
                              "nullable": true
                            },
                            "notes": {
                              "type": "string",
                              "nullable": true
                            },
                            "invoiceNotes": {
                              "type": "string",
                              "nullable": true
                            },
                            "organisationId": {
                              "type": "string",
                              "nullable": true
                            },
                            "receivesInvoices": {
                              "type": "boolean"
                            },
                            "addresses": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "BILLING",
                                      "DELIVERY",
                                      "POSTAL",
                                      "PHYSICAL",
                                      "REMITTANCE",
                                      "OTHER"
                                    ]
                                  },
                                  "attentionTo": {
                                    "type": "string"
                                  },
                                  "addressLines": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  },
                                  "sublocality": {
                                    "type": "string"
                                  },
                                  "locality": {
                                    "type": "string"
                                  },
                                  "administrativeArea": {
                                    "type": "string"
                                  },
                                  "postalCode": {
                                    "type": "string"
                                  },
                                  "sortingCode": {
                                    "type": "string"
                                  },
                                  "countryCode": {
                                    "type": "string"
                                  },
                                  "isInvoiceDefault": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "id",
                                  "type",
                                  "addressLines",
                                  "countryCode",
                                  "isInvoiceDefault"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "phones": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "label": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "string"
                                  },
                                  "isPrimary": {
                                    "type": "boolean"
                                  }
                                },
                                "required": ["id", "number", "isPrimary"],
                                "additionalProperties": false
                              }
                            },
                            "organisation": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "displayName": {
                                  "type": "string"
                                }
                              },
                              "required": ["id", "displayName"],
                              "additionalProperties": false,
                              "nullable": true
                            },
                            "createdAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "updatedAt": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "archivedAt": {
                              "type": "string",
                              "format": "date-time",
                              "nullable": true
                            }
                          },
                          "required": [
                            "type",
                            "emails",
                            "id",
                            "workspaceId",
                            "entityId",
                            "status",
                            "displayName",
                            "legalName",
                            "identifierScheme",
                            "identifier",
                            "gstNumber",
                            "website",
                            "notes",
                            "invoiceNotes",
                            "organisationId",
                            "receivesInvoices",
                            "addresses",
                            "phones",
                            "organisation",
                            "createdAt",
                            "updatedAt",
                            "archivedAt"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    },
                    "linkedInvoiceCount": {
                      "type": "number"
                    }
                  },
                  "required": ["data", "linkedInvoiceCount"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid JSON",
            "field values": null,
            "or saved contact relationships.": null
          },
          "401": {
            "description": "Unauthorized."
          },
          "403": {
            "description": "Insufficient workspace role or entity permission."
          },
          "404": {
            "description": "Entity not found."
          },
          "500": {
            "description": "Internal server error."
          }
        },
        "operationId": "contacts.create",
        "x-sdk-resource": "contacts",
        "x-sdk-method": "create"
      }
    },
    "/api/public/v1/entities/{entityId}/dimensions": {
      "get": {
        "summary": "List dimensions",
        "description": "Returns the entity's active dimensions (tracking categories such as Property or\nDepartment) with their active options. Use each option's `id` as a value in\n`dimensionOptionIds` when creating journals\n(`POST /api/public/v1/entities/{entityId}/journals`) or reconciling transactions\n(`POST /api/public/v1/entities/{entityId}/transactions/{transactionId}/reconcile`).\n\nArchived dimensions and archived options are excluded. Requires API key\nauthentication and entity access.\n",
        "tags": ["Dimensions"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "typeKey": {
                            "type": "string"
                          },
                          "enforcement": {
                            "type": "string"
                          },
                          "options": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string",
                                  "nullable": true
                                }
                              },
                              "required": ["id", "name", "code"],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "typeKey",
                          "enforcement",
                          "options"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "403": {
            "description": "API key does not have access to this entity"
          }
        },
        "operationId": "dimensions.list",
        "x-sdk-resource": "dimensions",
        "x-sdk-method": "list"
      }
    },
    "/api/public/v1/entities/{entityId}/files": {
      "get": {
        "summary": "List files",
        "description": "Returns the entity's files, newest first: those filed under it or attached to it,\nexcluding deleted files. Use a file's `id` in `fileIds` when creating a journal\n(`POST /api/public/v1/entities/{entityId}/journals`) or attaching files to one.\nRequires API key authentication and entity access.\n",
        "tags": ["Files"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "search",
            "in": "query",
            "required": false,
            "description": "Part of the file name, matched in any case",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Most files to return",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "contentType": {
                            "type": "string"
                          },
                          "size": {
                            "type": "number"
                          },
                          "createdAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "contentType",
                          "size",
                          "createdAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters"
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "404": {
            "description": "Entity not found or not accessible"
          }
        },
        "operationId": "files.list",
        "x-sdk-resource": "files",
        "x-sdk-method": "list"
      }
    },
    "/api/public/v1/entities/{entityId}/files/upload": {
      "post": {
        "summary": "Upload a file",
        "description": "Uploads a file for an entity. Files must be validated against size (20MB) and type restrictions. Returns a fileId that can be used when creating or attaching to journals. Requires API key authentication and entity access.",
        "tags": ["Files"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": ["file"],
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "The file to upload (max 20MB). Accepted types — PDF, JPEG, PNG, GIF, WebP, CSV, plain text, Excel (XLS/XLSX), Word (DOC/DOCX), Outlook MSG."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "file": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "filename": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "contentType": {
                          "type": "string"
                        },
                        "size": {
                          "type": "number"
                        },
                        "createdAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "filename",
                        "name",
                        "contentType",
                        "size",
                        "createdAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["success", "file"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "no_file": {
                    "value": {
                      "error": "No file provided",
                      "code": "MISSING_FILE"
                    }
                  },
                  "invalid_type": {
                    "value": {
                      "error": "File type not allowed. Allowed types: PDF, JPEG Image, PNG Image, GIF Image, WebP Image, CSV, Text, Excel (XLS), Excel (XLSX), Word (DOCX), Word (DOC), Outlook Email (MSG)",
                      "code": "INVALID_FILE_TYPE"
                    }
                  },
                  "file_too_large": {
                    "value": {
                      "error": "File size exceeds 20MB limit",
                      "code": "FILE_TOO_LARGE"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error - Upload failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "files.upload",
        "x-sdk-resource": "files",
        "x-sdk-method": "upload"
      }
    },
    "/api/public/v1/entities/{entityId}/fixed-asset-types": {
      "get": {
        "summary": "List fixed asset types (categories) for an entity",
        "description": "Returns all fixed asset types (categories) configured for the specified entity.\nAsset types define default depreciation settings and account mappings.\nIncludes mappedCode on accounts to support external system integrations (e.g., Xero).\n",
        "tags": ["Fixed Assets"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "depreciationMethod": {
                            "type": "string"
                          },
                          "usefulLifeYears": {
                            "type": "number",
                            "nullable": true
                          },
                          "depreciationRate": {
                            "type": "number",
                            "nullable": true
                          },
                          "assetAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "mappedCode": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": ["id", "code", "name", "mappedCode"],
                            "additionalProperties": false
                          },
                          "accumulatedDepreciationAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "mappedCode": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": ["id", "code", "name", "mappedCode"],
                            "additionalProperties": false
                          },
                          "depreciationExpenseAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "mappedCode": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": ["id", "code", "name", "mappedCode"],
                            "additionalProperties": false
                          },
                          "privateUseAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "mappedCode": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": ["id", "code", "name", "mappedCode"],
                            "additionalProperties": false,
                            "nullable": true
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "depreciationMethod",
                          "usefulLifeYears",
                          "depreciationRate",
                          "assetAccount",
                          "accumulatedDepreciationAccount",
                          "depreciationExpenseAccount",
                          "privateUseAccount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "fixedAssetTypes.list",
        "x-sdk-resource": "fixedAssetTypes",
        "x-sdk-method": "list"
      },
      "post": {
        "summary": "Create a new fixed asset type (category)",
        "description": "Creates a new fixed asset type for the specified entity.\nAsset types define default depreciation settings and account mappings for fixed assets.\n",
        "tags": ["Fixed Assets"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "depreciationMethod": {
                    "type": "string"
                  },
                  "assetAccountId": {
                    "type": "string"
                  },
                  "accumulatedDepreciationAccountId": {
                    "type": "string"
                  },
                  "depreciationExpenseAccountId": {
                    "type": "string"
                  },
                  "privateUseAccountId": {
                    "type": "string",
                    "nullable": true
                  },
                  "usefulLifeYears": {
                    "type": "number",
                    "nullable": true
                  },
                  "depreciationRate": {
                    "type": "number",
                    "nullable": true
                  }
                },
                "required": [
                  "name",
                  "depreciationMethod",
                  "assetAccountId",
                  "accumulatedDepreciationAccountId",
                  "depreciationExpenseAccountId",
                  "privateUseAccountId"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "depreciationMethod": {
                          "type": "string"
                        },
                        "usefulLifeYears": {
                          "type": "number",
                          "nullable": true
                        },
                        "depreciationRate": {
                          "type": "number",
                          "nullable": true
                        },
                        "assetAccount": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "mappedCode": {
                              "type": "string",
                              "nullable": true
                            }
                          },
                          "required": ["id", "code", "name", "mappedCode"],
                          "additionalProperties": false
                        },
                        "accumulatedDepreciationAccount": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "mappedCode": {
                              "type": "string",
                              "nullable": true
                            }
                          },
                          "required": ["id", "code", "name", "mappedCode"],
                          "additionalProperties": false
                        },
                        "depreciationExpenseAccount": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "mappedCode": {
                              "type": "string",
                              "nullable": true
                            }
                          },
                          "required": ["id", "code", "name", "mappedCode"],
                          "additionalProperties": false
                        },
                        "privateUseAccount": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "code": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            },
                            "mappedCode": {
                              "type": "string",
                              "nullable": true
                            }
                          },
                          "required": ["id", "code", "name", "mappedCode"],
                          "additionalProperties": false,
                          "nullable": true
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "depreciationMethod",
                        "usefulLifeYears",
                        "depreciationRate",
                        "assetAccount",
                        "accumulatedDepreciationAccount",
                        "depreciationExpenseAccount",
                        "privateUseAccount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "missingDepreciation": {
                    "summary": "Missing depreciation configuration",
                    "value": {
                      "error": "Validation failed: usefulLifeYears: Either useful life years or depreciation rate is required; depreciationRate: Either useful life years or depreciation rate is required",
                      "code": "VALIDATION_ERROR"
                    }
                  },
                  "bothDepreciationFields": {
                    "summary": "Both depreciation fields provided",
                    "value": {
                      "error": "Validation failed: usefulLifeYears: Cannot set both useful life years and depreciation rate. Please provide only one.",
                      "code": "VALIDATION_ERROR"
                    }
                  },
                  "duplicateName": {
                    "summary": "Asset type name already exists",
                    "value": {
                      "error": "A fixed asset type with this name already exists for this entity",
                      "code": "DUPLICATE_NAME"
                    }
                  },
                  "duplicateAccount": {
                    "summary": "Asset account already assigned",
                    "value": {
                      "error": "A fixed asset type assigned to this asset account already exists for this entity",
                      "code": "DUPLICATE_ASSET_ACCOUNT"
                    }
                  },
                  "invalidAccounts": {
                    "summary": "Invalid account IDs",
                    "value": {
                      "error": "One or more account IDs are invalid or do not belong to this entity",
                      "code": "INVALID_ACCOUNT_IDS"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "fixedAssetTypes.create",
        "x-sdk-resource": "fixedAssetTypes",
        "x-sdk-method": "create"
      }
    },
    "/api/public/v1/entities/{entityId}/fixed-assets/{assetId}": {
      "get": {
        "summary": "Get a single fixed asset by ID",
        "description": "Returns a single fixed asset by its ID for the specified entity.\nIncludes asset details, depreciation information, and current book value.\n",
        "tags": ["Fixed Assets"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "assetId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "assetNumber": {
                          "type": "string",
                          "nullable": true
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        },
                        "status": {
                          "type": "string"
                        },
                        "purchaseDate": {
                          "type": "string",
                          "nullable": true
                        },
                        "startDate": {
                          "type": "string",
                          "nullable": true
                        },
                        "purchasePrice": {
                          "type": "number",
                          "nullable": true
                        },
                        "residualValue": {
                          "type": "number",
                          "nullable": true
                        },
                        "businessUsePercentage": {
                          "type": "number",
                          "nullable": true
                        },
                        "initialAccumulatedDepreciation": {
                          "type": "number",
                          "nullable": true
                        },
                        "depreciationMethod": {
                          "type": "string",
                          "nullable": true
                        },
                        "usefulLifeYears": {
                          "type": "number",
                          "nullable": true
                        },
                        "depreciationRate": {
                          "type": "number",
                          "nullable": true
                        },
                        "methodParams": {},
                        "disposalDate": {
                          "type": "string",
                          "nullable": true
                        },
                        "disposalProceeds": {
                          "type": "number",
                          "nullable": true
                        },
                        "bookValue": {
                          "type": "number",
                          "nullable": true
                        },
                        "assetType": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": ["id", "name"],
                          "additionalProperties": false,
                          "nullable": true
                        },
                        "mostRecentDepreciationRun": {
                          "type": "object",
                          "properties": {
                            "year": {
                              "type": "number"
                            },
                            "month": {
                              "type": "number"
                            },
                            "accumulatedDepreciation": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "year",
                            "month",
                            "accumulatedDepreciation"
                          ],
                          "additionalProperties": false,
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string",
                          "nullable": true
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "assetNumber",
                        "description",
                        "status",
                        "purchaseDate",
                        "startDate",
                        "purchasePrice",
                        "residualValue",
                        "businessUsePercentage",
                        "initialAccumulatedDepreciation",
                        "depreciationMethod",
                        "usefulLifeYears",
                        "depreciationRate",
                        "methodParams",
                        "disposalDate",
                        "disposalProceeds",
                        "bookValue",
                        "assetType",
                        "mostRecentDepreciationRun",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity or asset",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found - Asset not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "fixedAssets.retrieve",
        "x-sdk-resource": "fixedAssets",
        "x-sdk-method": "retrieve"
      },
      "patch": {
        "summary": "Update a draft fixed asset",
        "description": "Updates only the supplied fields on a draft fixed asset. Omitted fields keep\ntheir stored values; send null to clear a nullable field. The asset's own\ndepreciation method, rate and useful life override its asset type's defaults.\nRate and useful life are exclusive: setting one clears the other, and\nmethod \"none\" clears both. Active and disposed assets cannot be edited here.\n",
        "tags": ["Fixed Assets"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "assetId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "dimensionOptionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "depreciationRate": {
                    "type": "number",
                    "nullable": true
                  },
                  "purchaseDate": {
                    "type": "string"
                  },
                  "startDate": {
                    "type": "string"
                  },
                  "purchasePrice": {},
                  "residualValue": {},
                  "initialAccumulatedDepreciation": {},
                  "entityFixedAssetTypeId": {
                    "type": "string",
                    "nullable": true
                  },
                  "assetNumber": {
                    "type": "string",
                    "nullable": true
                  },
                  "description": {
                    "type": "string",
                    "nullable": true
                  },
                  "businessUsePercentage": {
                    "type": "number",
                    "nullable": true
                  },
                  "depreciationMethod": {
                    "type": "string",
                    "enum": ["none", "straight_line", "diminishing_value"],
                    "nullable": true
                  },
                  "usefulLifeYears": {
                    "type": "number",
                    "nullable": true
                  },
                  "immediateExpensePercentage": {
                    "type": "number"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "assetNumber": {
                          "type": "string",
                          "nullable": true
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        },
                        "status": {
                          "type": "string"
                        },
                        "purchaseDate": {
                          "type": "string",
                          "nullable": true
                        },
                        "startDate": {
                          "type": "string",
                          "nullable": true
                        },
                        "purchasePrice": {
                          "type": "number",
                          "nullable": true
                        },
                        "residualValue": {
                          "type": "number",
                          "nullable": true
                        },
                        "businessUsePercentage": {
                          "type": "number",
                          "nullable": true
                        },
                        "initialAccumulatedDepreciation": {
                          "type": "number",
                          "nullable": true
                        },
                        "depreciationMethod": {
                          "type": "string",
                          "nullable": true
                        },
                        "usefulLifeYears": {
                          "type": "number",
                          "nullable": true
                        },
                        "depreciationRate": {
                          "type": "number",
                          "nullable": true
                        },
                        "methodParams": {},
                        "disposalDate": {
                          "type": "string",
                          "nullable": true
                        },
                        "disposalProceeds": {
                          "type": "number",
                          "nullable": true
                        },
                        "bookValue": {
                          "type": "number",
                          "nullable": true
                        },
                        "assetType": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": ["id", "name"],
                          "additionalProperties": false,
                          "nullable": true
                        },
                        "mostRecentDepreciationRun": {
                          "type": "object",
                          "properties": {
                            "year": {
                              "type": "number"
                            },
                            "month": {
                              "type": "number"
                            },
                            "accumulatedDepreciation": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "year",
                            "month",
                            "accumulatedDepreciation"
                          ],
                          "additionalProperties": false,
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string",
                          "nullable": true
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "assetNumber",
                        "description",
                        "status",
                        "purchaseDate",
                        "startDate",
                        "purchasePrice",
                        "residualValue",
                        "businessUsePercentage",
                        "initialAccumulatedDepreciation",
                        "depreciationMethod",
                        "usefulLifeYears",
                        "depreciationRate",
                        "methodParams",
                        "disposalDate",
                        "disposalProceeds",
                        "bookValue",
                        "assetType",
                        "mostRecentDepreciationRun",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid body, or depreciation, business use, asset number or dimension rules failed"
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "403": {
            "description": "Forbidden - No edit access to the specified entity"
          },
          "404": {
            "description": "Fixed asset or asset type not found"
          },
          "409": {
            "description": "The asset is not a draft"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "fixedAssets.update",
        "x-sdk-resource": "fixedAssets",
        "x-sdk-method": "update"
      }
    },
    "/api/public/v1/entities/{entityId}/fixed-assets": {
      "get": {
        "summary": "List fixed assets for an entity",
        "description": "Returns paginated fixed assets for the specified entity.\nIncludes asset details, depreciation information, and current book values.\n",
        "tags": ["Fixed Assets"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number (starts at 1)",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Number of items per page",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "description": "Filter by asset status",
            "schema": {
              "type": "string",
              "enum": ["draft", "active", "disposed"],
              "example": "active"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "assetNumber": {
                            "type": "string",
                            "nullable": true
                          },
                          "description": {
                            "type": "string",
                            "nullable": true
                          },
                          "status": {
                            "type": "string"
                          },
                          "purchaseDate": {
                            "type": "string",
                            "nullable": true
                          },
                          "startDate": {
                            "type": "string",
                            "nullable": true
                          },
                          "purchasePrice": {
                            "type": "number",
                            "nullable": true
                          },
                          "residualValue": {
                            "type": "number",
                            "nullable": true
                          },
                          "businessUsePercentage": {
                            "type": "number",
                            "nullable": true
                          },
                          "initialAccumulatedDepreciation": {
                            "type": "number",
                            "nullable": true
                          },
                          "depreciationMethod": {
                            "type": "string",
                            "nullable": true
                          },
                          "usefulLifeYears": {
                            "type": "number",
                            "nullable": true
                          },
                          "depreciationRate": {
                            "type": "number",
                            "nullable": true
                          },
                          "methodParams": {},
                          "disposalDate": {
                            "type": "string",
                            "nullable": true
                          },
                          "disposalProceeds": {
                            "type": "number",
                            "nullable": true
                          },
                          "bookValue": {
                            "type": "number",
                            "nullable": true
                          },
                          "assetType": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": ["id", "name"],
                            "additionalProperties": false,
                            "nullable": true
                          },
                          "mostRecentDepreciationRun": {
                            "type": "object",
                            "properties": {
                              "year": {
                                "type": "number"
                              },
                              "month": {
                                "type": "number"
                              },
                              "accumulatedDepreciation": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "year",
                              "month",
                              "accumulatedDepreciation"
                            ],
                            "additionalProperties": false,
                            "nullable": true
                          },
                          "createdAt": {
                            "type": "string"
                          },
                          "updatedAt": {
                            "type": "string",
                            "nullable": true
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "assetNumber",
                          "description",
                          "status",
                          "purchaseDate",
                          "startDate",
                          "purchasePrice",
                          "residualValue",
                          "businessUsePercentage",
                          "initialAccumulatedDepreciation",
                          "depreciationMethod",
                          "usefulLifeYears",
                          "depreciationRate",
                          "methodParams",
                          "disposalDate",
                          "disposalProceeds",
                          "bookValue",
                          "assetType",
                          "mostRecentDepreciationRun",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "currentPage": {
                          "type": "number"
                        },
                        "pageSize": {
                          "type": "number"
                        },
                        "totalCount": {
                          "type": "number"
                        },
                        "totalPages": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        },
                        "hasPreviousPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "currentPage",
                        "pageSize",
                        "totalCount",
                        "totalPages",
                        "hasNextPage",
                        "hasPreviousPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data", "pagination"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "fixedAssets.list",
        "x-sdk-resource": "fixedAssets",
        "x-sdk-method": "list"
      },
      "post": {
        "summary": "Create a new fixed asset",
        "description": "Creates a new fixed asset for the specified entity.\nCan create the asset as either a draft or immediately as active.\nWhen creating as active, all required fields must be provided and pass validation.\n",
        "tags": ["Fixed Assets"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "entityFixedAssetTypeId": {},
                      "purchaseDate": {
                        "type": "string"
                      },
                      "startDate": {
                        "type": "string"
                      },
                      "purchasePrice": {},
                      "depreciationMethod": {
                        "type": "string"
                      },
                      "assetNumber": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "costLimit": {},
                      "residualValue": {},
                      "businessUsePercentage": {
                        "type": "number"
                      },
                      "initialAccumulatedDepreciation": {},
                      "usefulLifeYears": {
                        "type": "number"
                      },
                      "depreciationRate": {
                        "type": "number",
                        "nullable": true
                      },
                      "immediateExpensePercentage": {
                        "type": "number"
                      },
                      "dimensionOptionIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "status": {
                        "type": "string",
                        "enum": ["active"]
                      }
                    },
                    "required": [
                      "name",
                      "entityFixedAssetTypeId",
                      "purchaseDate",
                      "startDate",
                      "purchasePrice",
                      "depreciationMethod",
                      "status"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "entityFixedAssetTypeId": {
                        "type": "string",
                        "nullable": true
                      },
                      "assetNumber": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "purchaseDate": {
                        "type": "string"
                      },
                      "startDate": {
                        "type": "string"
                      },
                      "purchasePrice": {},
                      "costLimit": {},
                      "residualValue": {},
                      "businessUsePercentage": {
                        "type": "number"
                      },
                      "initialAccumulatedDepreciation": {},
                      "depreciationMethod": {
                        "type": "string",
                        "nullable": true
                      },
                      "usefulLifeYears": {
                        "type": "number"
                      },
                      "depreciationRate": {
                        "type": "number",
                        "nullable": true
                      },
                      "immediateExpensePercentage": {
                        "type": "number"
                      },
                      "dimensionOptionIds": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "status": {
                        "type": "string",
                        "enum": ["draft"]
                      }
                    },
                    "required": ["name"],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "assetNumber": {
                          "type": "string",
                          "nullable": true
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        },
                        "status": {
                          "type": "string"
                        },
                        "purchaseDate": {
                          "type": "string",
                          "nullable": true
                        },
                        "startDate": {
                          "type": "string",
                          "nullable": true
                        },
                        "purchasePrice": {
                          "type": "number",
                          "nullable": true
                        },
                        "residualValue": {
                          "type": "number",
                          "nullable": true
                        },
                        "businessUsePercentage": {
                          "type": "number",
                          "nullable": true
                        },
                        "initialAccumulatedDepreciation": {
                          "type": "number",
                          "nullable": true
                        },
                        "depreciationMethod": {
                          "type": "string",
                          "nullable": true
                        },
                        "usefulLifeYears": {
                          "type": "number",
                          "nullable": true
                        },
                        "depreciationRate": {
                          "type": "number",
                          "nullable": true
                        },
                        "methodParams": {},
                        "disposalDate": {
                          "type": "string",
                          "nullable": true
                        },
                        "disposalProceeds": {
                          "type": "number",
                          "nullable": true
                        },
                        "bookValue": {
                          "type": "number",
                          "nullable": true
                        },
                        "assetType": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "name": {
                              "type": "string"
                            }
                          },
                          "required": ["id", "name"],
                          "additionalProperties": false,
                          "nullable": true
                        },
                        "mostRecentDepreciationRun": {
                          "type": "object",
                          "properties": {
                            "year": {
                              "type": "number"
                            },
                            "month": {
                              "type": "number"
                            },
                            "accumulatedDepreciation": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "year",
                            "month",
                            "accumulatedDepreciation"
                          ],
                          "additionalProperties": false,
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "type": "string",
                          "nullable": true
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "assetNumber",
                        "description",
                        "status",
                        "purchaseDate",
                        "startDate",
                        "purchasePrice",
                        "residualValue",
                        "businessUsePercentage",
                        "initialAccumulatedDepreciation",
                        "depreciationMethod",
                        "usefulLifeYears",
                        "depreciationRate",
                        "methodParams",
                        "disposalDate",
                        "disposalProceeds",
                        "bookValue",
                        "assetType",
                        "mostRecentDepreciationRun",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation failed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "field": {
                            "type": "string"
                          },
                          "message": {
                            "type": "string"
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "missingRequiredField": {
                    "summary": "Missing required field for active asset",
                    "value": {
                      "error": "Validation failed",
                      "code": "VALIDATION_ERROR",
                      "errors": [
                        {
                          "field": "purchaseDate",
                          "message": "Purchase date is required to activate"
                        }
                      ]
                    }
                  },
                  "invalidDepreciation": {
                    "summary": "Invalid depreciation configuration",
                    "value": {
                      "error": "Either useful life years or depreciation rate is required.",
                      "code": "DEPRECIATION_VALIDATION_ERROR"
                    }
                  },
                  "duplicateAssetNumber": {
                    "summary": "Asset number already exists",
                    "value": {
                      "error": "Asset number \"FA-001\" is already in use for this entity",
                      "code": "DUPLICATE_ASSET_NUMBER"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Asset type not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "fixedAssets.create",
        "x-sdk-resource": "fixedAssets",
        "x-sdk-method": "create"
      }
    },
    "/api/public/v1/entities/{entityId}/general-ledger/account": {
      "get": {
        "summary": "Get general ledger grouped by account",
        "description": "Returns journal entries grouped by account with running balances and period totals. Supports various period presets and custom date ranges.",
        "tags": ["Reports"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "periodType",
            "in": "query",
            "required": false,
            "description": "Period preset for date range filtering",
            "schema": {
              "type": "string",
              "enum": [
                "custom",
                "this-month",
                "last-month",
                "this-quarter",
                "last-quarter",
                "this-financial-year",
                "last-financial-year",
                "month-to-date",
                "quarter-to-date",
                "year-to-date"
              ]
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "description": "Start date. Required when periodType is `custom`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "description": "End date. Required when periodType is `custom`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountIds",
            "in": "query",
            "required": false,
            "description": "Comma-separated list of entity account IDs to filter by",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": false
          },
          {
            "name": "includeVoided",
            "in": "query",
            "required": false,
            "description": "Include voided journals (default false)",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "entityId": {
                          "type": "string"
                        },
                        "entityName": {
                          "type": "string"
                        },
                        "periodDescription": {
                          "type": "string"
                        },
                        "startDate": {
                          "type": "string"
                        },
                        "endDate": {
                          "type": "string"
                        },
                        "generatedAt": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "entityId",
                        "entityName",
                        "periodDescription",
                        "startDate",
                        "endDate",
                        "generatedAt",
                        "currency"
                      ],
                      "additionalProperties": false
                    },
                    "accounts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "accountId": {
                            "type": "string"
                          },
                          "accountCode": {
                            "type": "string"
                          },
                          "accountMappedCode": {
                            "type": "string",
                            "nullable": true
                          },
                          "accountName": {
                            "type": "string"
                          },
                          "accountType": {
                            "type": "string"
                          },
                          "accountSubtype": {
                            "type": "string"
                          },
                          "beginningBalance": {
                            "type": "string"
                          },
                          "endingBalance": {
                            "type": "string"
                          },
                          "totalDebits": {
                            "type": "string"
                          },
                          "totalCredits": {
                            "type": "string"
                          },
                          "netMovement": {
                            "type": "string"
                          },
                          "entries": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "journalId": {
                                  "type": "string"
                                },
                                "logicalJournalId": {
                                  "type": "string"
                                },
                                "date": {
                                  "type": "string"
                                },
                                "narration": {
                                  "type": "string"
                                },
                                "description": {
                                  "type": "string"
                                },
                                "lineType": {
                                  "type": "string"
                                },
                                "parentId": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "source": {
                                  "type": "string"
                                },
                                "journalStatus": {
                                  "type": "string"
                                },
                                "debit": {
                                  "type": "string"
                                },
                                "credit": {
                                  "type": "string"
                                },
                                "net": {
                                  "type": "string"
                                },
                                "gross": {
                                  "type": "string"
                                },
                                "runningBalance": {
                                  "type": "string"
                                },
                                "gstAmount": {
                                  "type": "string"
                                },
                                "taxRate": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "rate": {
                                      "type": "string"
                                    }
                                  },
                                  "required": ["id", "name", "rate"],
                                  "additionalProperties": false
                                },
                                "bankTransaction": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "date": {
                                      "type": "string"
                                    },
                                    "amount": {
                                      "type": "string"
                                    },
                                    "type": {
                                      "type": "string"
                                    },
                                    "description": {
                                      "type": "string"
                                    },
                                    "particulars": {
                                      "type": "string"
                                    },
                                    "code": {
                                      "type": "string"
                                    },
                                    "merchant": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        },
                                        "provider": {
                                          "type": "string"
                                        },
                                        "identifier": {
                                          "type": "string"
                                        }
                                      },
                                      "required": ["id", "name"],
                                      "additionalProperties": false
                                    },
                                    "category": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        },
                                        "groupName": {
                                          "type": "string"
                                        },
                                        "provider": {
                                          "type": "string"
                                        }
                                      },
                                      "required": ["id", "name"],
                                      "additionalProperties": false
                                    },
                                    "bankAccount": {
                                      "type": "object",
                                      "properties": {
                                        "name": {
                                          "type": "string"
                                        },
                                        "accountNumber": {
                                          "type": "string"
                                        },
                                        "institution": {
                                          "type": "string"
                                        }
                                      },
                                      "required": ["name"],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "date",
                                    "amount",
                                    "type",
                                    "description",
                                    "bankAccount"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "id",
                                "journalId",
                                "logicalJournalId",
                                "date",
                                "narration",
                                "description",
                                "lineType",
                                "parentId",
                                "source",
                                "journalStatus",
                                "debit",
                                "credit",
                                "net",
                                "gross",
                                "runningBalance",
                                "gstAmount"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "accountId",
                          "accountCode",
                          "accountMappedCode",
                          "accountName",
                          "accountType",
                          "accountSubtype",
                          "beginningBalance",
                          "endingBalance",
                          "totalDebits",
                          "totalCredits",
                          "netMovement",
                          "entries"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "totalDebits": {
                          "type": "string"
                        },
                        "totalCredits": {
                          "type": "string"
                        },
                        "netMovement": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "totalDebits",
                        "totalCredits",
                        "netMovement"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["metadata", "accounts", "totals"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters"
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "403": {
            "description": "Forbidden - No access to the specified entity"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "generalLedger.byAccount",
        "x-sdk-resource": "generalLedger",
        "x-sdk-method": "byAccount"
      }
    },
    "/api/public/v1/entities/{entityId}/general-ledger/transaction": {
      "get": {
        "summary": "Get general ledger as flat entry list",
        "description": "Returns a flat list of journal entries with embedded account metadata. Entries are ordered by date, createdAt, and id for deterministic results.",
        "tags": ["Reports"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "periodType",
            "in": "query",
            "required": false,
            "description": "Period preset for date range filtering",
            "schema": {
              "type": "string",
              "enum": [
                "custom",
                "this-month",
                "last-month",
                "this-quarter",
                "last-quarter",
                "this-financial-year",
                "last-financial-year",
                "month-to-date",
                "quarter-to-date",
                "year-to-date"
              ]
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "description": "Start date. Required when periodType is `custom`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "description": "End date. Required when periodType is `custom`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "accountIds",
            "in": "query",
            "required": false,
            "description": "Comma-separated list of entity account IDs to filter by",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": false
          },
          {
            "name": "includeVoided",
            "in": "query",
            "required": false,
            "description": "Include voided journals (default false)",
            "schema": {
              "type": "boolean",
              "default": false
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "entityId": {
                          "type": "string"
                        },
                        "entityName": {
                          "type": "string"
                        },
                        "periodDescription": {
                          "type": "string"
                        },
                        "startDate": {
                          "type": "string"
                        },
                        "endDate": {
                          "type": "string"
                        },
                        "generatedAt": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "entityId",
                        "entityName",
                        "periodDescription",
                        "startDate",
                        "endDate",
                        "generatedAt",
                        "currency"
                      ],
                      "additionalProperties": false
                    },
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "account": {
                            "type": "object",
                            "properties": {
                              "accountId": {
                                "type": "string"
                              },
                              "accountCode": {
                                "type": "string"
                              },
                              "accountMappedCode": {
                                "type": "string",
                                "nullable": true
                              },
                              "accountName": {
                                "type": "string"
                              },
                              "accountType": {
                                "type": "string"
                              },
                              "accountSubtype": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "accountId",
                              "accountCode",
                              "accountMappedCode",
                              "accountName",
                              "accountType",
                              "accountSubtype"
                            ],
                            "additionalProperties": false
                          },
                          "id": {
                            "type": "string"
                          },
                          "journalId": {
                            "type": "string"
                          },
                          "logicalJournalId": {
                            "type": "string"
                          },
                          "date": {
                            "type": "string"
                          },
                          "narration": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "lineType": {
                            "type": "string"
                          },
                          "parentId": {
                            "type": "string",
                            "nullable": true
                          },
                          "source": {
                            "type": "string"
                          },
                          "journalStatus": {
                            "type": "string"
                          },
                          "debit": {
                            "type": "string"
                          },
                          "credit": {
                            "type": "string"
                          },
                          "net": {
                            "type": "string"
                          },
                          "gross": {
                            "type": "string"
                          },
                          "runningBalance": {
                            "type": "string"
                          },
                          "gstAmount": {
                            "type": "string"
                          },
                          "taxRate": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "rate": {
                                "type": "string"
                              }
                            },
                            "required": ["id", "name", "rate"],
                            "additionalProperties": false
                          },
                          "bankTransaction": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "date": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "particulars": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "merchant": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "provider": {
                                    "type": "string"
                                  },
                                  "identifier": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false
                              },
                              "category": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "groupName": {
                                    "type": "string"
                                  },
                                  "provider": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false
                              },
                              "bankAccount": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "accountNumber": {
                                    "type": "string"
                                  },
                                  "institution": {
                                    "type": "string"
                                  }
                                },
                                "required": ["name"],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "id",
                              "date",
                              "amount",
                              "type",
                              "description",
                              "bankAccount"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "account",
                          "id",
                          "journalId",
                          "logicalJournalId",
                          "date",
                          "narration",
                          "description",
                          "lineType",
                          "parentId",
                          "source",
                          "journalStatus",
                          "debit",
                          "credit",
                          "net",
                          "gross",
                          "runningBalance",
                          "gstAmount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "totalDebits": {
                          "type": "string"
                        },
                        "totalCredits": {
                          "type": "string"
                        },
                        "netMovement": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "totalDebits",
                        "totalCredits",
                        "netMovement"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["metadata", "entries", "totals"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters"
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "403": {
            "description": "Forbidden - No access to the specified entity"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "generalLedger.byTransaction",
        "x-sdk-resource": "generalLedger",
        "x-sdk-method": "byTransaction"
      }
    },
    "/api/public/v1/entities/{entityId}/gst-returns/{gstReturnId}": {
      "get": {
        "summary": "Get a single GST return with its IRD box amounts",
        "description": "Returns one GST return, including the IRD return boxes 5 to 15.\n\n**Where the numbers come from depends on the return's status**, and `amountsSource`\nsays which. A `draft` return has no persisted totals, so the boxes are calculated\nlive from posted journal lines and will move as coding changes — `amountsSource` is\n`calculated`. Every other status reads the snapshot taken at finalisation, which is\nwhat was, or will be, filed with IRD — `amountsSource` is `finalised`.\n\n**Period and due dates are New Zealand calendar days** (`YYYY-MM-DD`), not UTC instants.\n\nIRD submission keys, raw IRD response payloads and amendment original values are\ninternal and are never returned.\n",
        "tags": ["GST Returns"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "gstReturnId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "amountsSource": {
                          "type": "string",
                          "enum": ["finalised", "calculated"]
                        },
                        "totalSalesAndIncome": {
                          "type": "number",
                          "nullable": true
                        },
                        "zeroRatedSupplies": {
                          "type": "number",
                          "nullable": true
                        },
                        "netGstSalesAndIncome": {
                          "type": "number",
                          "nullable": true
                        },
                        "totalGstSalesAndIncome": {
                          "type": "number",
                          "nullable": true
                        },
                        "debitAdjustments": {
                          "type": "number",
                          "nullable": true
                        },
                        "lateClaimsAmount": {
                          "type": "number",
                          "nullable": true
                        },
                        "lateClaimsType": {
                          "type": "string",
                          "enum": ["sales", "purchases"],
                          "nullable": true
                        },
                        "totalDebitAdjustments": {
                          "type": "number",
                          "nullable": true
                        },
                        "totalGstCollected": {
                          "type": "number",
                          "nullable": true
                        },
                        "totalPurchasesAndExpenses": {
                          "type": "number",
                          "nullable": true
                        },
                        "totalGstCreditsOnPurchasesAndExpenses": {
                          "type": "number",
                          "nullable": true
                        },
                        "creditAdjustments": {
                          "type": "number",
                          "nullable": true
                        },
                        "totalCreditAdjustments": {
                          "type": "number",
                          "nullable": true
                        },
                        "totalGstCredit": {
                          "type": "number",
                          "nullable": true
                        },
                        "id": {
                          "type": "string"
                        },
                        "entityId": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "rejected",
                            "completed",
                            "draft",
                            "finalised",
                            "filed",
                            "filed_externally",
                            "accepted",
                            "awaiting_payment"
                          ]
                        },
                        "dateFrom": {
                          "type": "string"
                        },
                        "dateTo": {
                          "type": "string"
                        },
                        "dueDate": {
                          "type": "string"
                        },
                        "isOverdue": {
                          "type": "boolean"
                        },
                        "netGstPosition": {
                          "type": "number",
                          "nullable": true
                        },
                        "unreconciledTransactionCount": {
                          "type": "number"
                        },
                        "hasAmendment": {
                          "type": "boolean"
                        },
                        "finalisedAt": {
                          "type": "string",
                          "nullable": true
                        },
                        "irdFiledAt": {
                          "type": "string",
                          "nullable": true
                        },
                        "updatedAt": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "amountsSource",
                        "totalSalesAndIncome",
                        "zeroRatedSupplies",
                        "netGstSalesAndIncome",
                        "totalGstSalesAndIncome",
                        "debitAdjustments",
                        "lateClaimsAmount",
                        "lateClaimsType",
                        "totalDebitAdjustments",
                        "totalGstCollected",
                        "totalPurchasesAndExpenses",
                        "totalGstCreditsOnPurchasesAndExpenses",
                        "creditAdjustments",
                        "totalCreditAdjustments",
                        "totalGstCredit",
                        "id",
                        "entityId",
                        "name",
                        "description",
                        "status",
                        "dateFrom",
                        "dateTo",
                        "dueDate",
                        "isOverdue",
                        "netGstPosition",
                        "unreconciledTransactionCount",
                        "hasAmendment",
                        "finalisedAt",
                        "irdFiledAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Malformed GST return id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "No such GST return for this entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "operationId": "gstReturns.retrieve",
        "x-sdk-resource": "gstReturns",
        "x-sdk-method": "retrieve"
      }
    },
    "/api/public/v1/entities/{entityId}/gst-returns": {
      "get": {
        "summary": "List GST returns for an entity",
        "description": "Returns paginated GST returns for the specified entity, newest period first.\n\nEach row carries the return's lifecycle status, its period, its filing due date,\nits net GST position (IRD Box 15) and a count of bank transactions in the period\nthat are not yet reconciled.\n\n**Box 15 is only present once the return has been calculated.** A draft that has\nnever been finalised reports `netGstPosition: null`. Use the detail endpoint to get\nlive, calculated box amounts for a draft.\n\n**Period and due dates are New Zealand calendar days** (`YYYY-MM-DD`), not UTC\ninstants. A GST period runs from the first moment of `dateFrom` to the last moment\nof `dateTo`, both in NZ time.\n\nBy default, draft returns whose period has not started yet are hidden, matching\nwhat the Prosaic UI shows. Pass `includeFutureDrafts=true` to see them.\n",
        "tags": ["GST Returns"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Return only GST returns in these lifecycle statuses. Repeatable, and\na comma-separated list means the same thing — `?status=draft&status=filed`\nand `?status=draft,filed` are equivalent. Omit for every status;\nnothing is filtered out by default, so completed returns appear\nalongside outstanding ones. To see only live work, list the seven\nstatuses other than `completed`.\n",
            "style": "form"
          },
          {
            "name": "dateFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return only GST returns whose period ends on or after this NZ date"
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return only GST returns whose period starts on or before this NZ date"
          },
          {
            "name": "dueAfter",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return only GST returns due on or after this NZ date"
          },
          {
            "name": "dueBefore",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return only GST returns due on or before this NZ date"
          },
          {
            "name": "includeFutureDrafts",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["false", "true"]
            },
            "description": "Include draft returns whose period has not started yet (default false)"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Page number (default 1)"
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "description": "Items per page (default 100)"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "rejected",
                              "completed",
                              "draft",
                              "finalised",
                              "filed",
                              "filed_externally",
                              "accepted",
                              "awaiting_payment"
                            ]
                          },
                          "dateFrom": {
                            "type": "string"
                          },
                          "dateTo": {
                            "type": "string"
                          },
                          "dueDate": {
                            "type": "string"
                          },
                          "isOverdue": {
                            "type": "boolean"
                          },
                          "netGstPosition": {
                            "type": "number",
                            "nullable": true
                          },
                          "unreconciledTransactionCount": {
                            "type": "number"
                          },
                          "hasAmendment": {
                            "type": "boolean"
                          },
                          "finalisedAt": {
                            "type": "string",
                            "nullable": true
                          },
                          "irdFiledAt": {
                            "type": "string",
                            "nullable": true
                          },
                          "updatedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "name",
                          "description",
                          "status",
                          "dateFrom",
                          "dateTo",
                          "dueDate",
                          "isOverdue",
                          "netGstPosition",
                          "unreconciledTransactionCount",
                          "hasAmendment",
                          "finalisedAt",
                          "irdFiledAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "currentPage": {
                          "type": "number"
                        },
                        "pageSize": {
                          "type": "number"
                        },
                        "totalCount": {
                          "type": "number"
                        },
                        "totalPages": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        },
                        "hasPreviousPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "currentPage",
                        "pageSize",
                        "totalCount",
                        "totalPages",
                        "hasNextPage",
                        "hasPreviousPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data", "pagination"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Entity not found or not accessible with these credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "operationId": "gstReturns.listForEntity",
        "x-sdk-resource": "gstReturns",
        "x-sdk-method": "listForEntity"
      }
    },
    "/api/public/v1/entities/{entityId}/invoices/{invoiceId}": {
      "get": {
        "summary": "Get an invoice by ID for an entity",
        "tags": ["Invoices"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "invoiceId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "entityId": {
                          "type": "string"
                        },
                        "workspaceId": {
                          "type": "string"
                        },
                        "fileId": {
                          "type": "string",
                          "nullable": true
                        },
                        "invoiceNumber": {
                          "type": "string",
                          "nullable": true
                        },
                        "status": {
                          "type": "string"
                        },
                        "taxMode": {
                          "type": "string"
                        },
                        "issueDate": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "dueDate": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "sentAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "recipientName": {
                          "type": "string"
                        },
                        "recipientEmail": {
                          "type": "string",
                          "nullable": true
                        },
                        "recipientAddress": {
                          "type": "string",
                          "nullable": true
                        },
                        "bankAccountId": {
                          "type": "string",
                          "nullable": true
                        },
                        "bankAccountName": {
                          "type": "string",
                          "nullable": true
                        },
                        "subtotal": {
                          "type": "number"
                        },
                        "taxTotal": {
                          "type": "number"
                        },
                        "total": {
                          "type": "number"
                        },
                        "amountDue": {
                          "type": "number",
                          "nullable": true
                        },
                        "notes": {
                          "type": "string",
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "quantity": {
                                "type": "number"
                              },
                              "unitPrice": {
                                "type": "number"
                              },
                              "taxRate": {
                                "type": "number"
                              },
                              "taxRateCode": {
                                "type": "string",
                                "nullable": true
                              },
                              "entityAccountId": {
                                "type": "string",
                                "nullable": true
                              },
                              "amount": {
                                "type": "number"
                              },
                              "taxAmount": {
                                "type": "number"
                              },
                              "position": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "id",
                              "description",
                              "quantity",
                              "unitPrice",
                              "taxRate",
                              "taxRateCode",
                              "entityAccountId",
                              "amount",
                              "taxAmount",
                              "position"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "entityId",
                        "workspaceId",
                        "fileId",
                        "invoiceNumber",
                        "status",
                        "taxMode",
                        "issueDate",
                        "dueDate",
                        "sentAt",
                        "recipientName",
                        "recipientEmail",
                        "recipientAddress",
                        "bankAccountId",
                        "bankAccountName",
                        "subtotal",
                        "taxTotal",
                        "total",
                        "amountDue",
                        "notes",
                        "createdAt",
                        "updatedAt",
                        "lines"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid invoice ID."
          },
          "401": {
            "description": "Unauthorized."
          },
          "404": {
            "description": "Invoice, entity, or workspace not found."
          },
          "500": {
            "description": "Internal server error."
          }
        },
        "operationId": "invoices.retrieve",
        "x-sdk-resource": "invoices",
        "x-sdk-method": "retrieve"
      }
    },
    "/api/public/v1/entities/{entityId}/invoices": {
      "post": {
        "summary": "Create a finalised invoice",
        "description": "Creates a complete, finalised invoice for the specified entity. The\nentity is taken from the URL; `status` cannot be supplied. Finalised\ninvoices are not automatically delivered to the recipient.\n\nWhere the workspace records invoices as receivables (accrual\naccounting), finalising posts the invoice to the ledger, which needs a\n`contactId`. Without one the request is refused with 409\n`INVOICE_NOT_EDITABLE` and nothing is created.\n",
        "tags": ["Invoices"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "taxMode": {
                    "type": "string",
                    "enum": ["NO_TAX", "TAX_INCLUSIVE", "TAX_EXCLUSIVE"]
                  },
                  "issueDate": {
                    "type": "string"
                  },
                  "recipientName": {
                    "type": "string"
                  },
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "description": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "string"
                        },
                        "unitPrice": {
                          "type": "string"
                        },
                        "taxRateCode": {
                          "type": "string"
                        },
                        "entityAccountId": {
                          "type": "string"
                        },
                        "taxRate": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "description",
                        "quantity",
                        "unitPrice",
                        "taxRateCode",
                        "entityAccountId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "bankAccountId": {
                    "type": "string",
                    "nullable": true
                  },
                  "notes": {
                    "type": "string",
                    "nullable": true
                  },
                  "contactId": {
                    "type": "string",
                    "nullable": true
                  },
                  "dueDate": {
                    "type": "string",
                    "nullable": true
                  },
                  "bankAccountName": {
                    "type": "string",
                    "nullable": true
                  },
                  "invoiceNumber": {
                    "type": "string"
                  },
                  "recipientEmail": {
                    "type": "string",
                    "nullable": true
                  },
                  "recipientAddress": {
                    "type": "string",
                    "nullable": true
                  },
                  "recipientEmails": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": ["taxMode", "issueDate", "recipientName", "lines"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "entityId": {
                          "type": "string"
                        },
                        "workspaceId": {
                          "type": "string"
                        },
                        "fileId": {
                          "type": "string",
                          "nullable": true
                        },
                        "invoiceNumber": {
                          "type": "string",
                          "nullable": true
                        },
                        "status": {
                          "type": "string"
                        },
                        "taxMode": {
                          "type": "string"
                        },
                        "issueDate": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "dueDate": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "sentAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "recipientName": {
                          "type": "string"
                        },
                        "recipientEmail": {
                          "type": "string",
                          "nullable": true
                        },
                        "recipientAddress": {
                          "type": "string",
                          "nullable": true
                        },
                        "bankAccountId": {
                          "type": "string",
                          "nullable": true
                        },
                        "bankAccountName": {
                          "type": "string",
                          "nullable": true
                        },
                        "subtotal": {
                          "type": "number"
                        },
                        "taxTotal": {
                          "type": "number"
                        },
                        "total": {
                          "type": "number"
                        },
                        "amountDue": {
                          "type": "number",
                          "nullable": true
                        },
                        "notes": {
                          "type": "string",
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "quantity": {
                                "type": "number"
                              },
                              "unitPrice": {
                                "type": "number"
                              },
                              "taxRate": {
                                "type": "number"
                              },
                              "taxRateCode": {
                                "type": "string",
                                "nullable": true
                              },
                              "entityAccountId": {
                                "type": "string",
                                "nullable": true
                              },
                              "amount": {
                                "type": "number"
                              },
                              "taxAmount": {
                                "type": "number"
                              },
                              "position": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "id",
                              "description",
                              "quantity",
                              "unitPrice",
                              "taxRate",
                              "taxRateCode",
                              "entityAccountId",
                              "amount",
                              "taxAmount",
                              "position"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "entityId",
                        "workspaceId",
                        "fileId",
                        "invoiceNumber",
                        "status",
                        "taxMode",
                        "issueDate",
                        "dueDate",
                        "sentAt",
                        "recipientName",
                        "recipientEmail",
                        "recipientAddress",
                        "bankAccountId",
                        "bankAccountName",
                        "subtotal",
                        "taxTotal",
                        "total",
                        "amountDue",
                        "notes",
                        "createdAt",
                        "updatedAt",
                        "lines"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or invoice input, or system account setup is missing or invalid (SYSTEM_ACCOUNT_VALIDATION)."
          },
          "401": {
            "description": "Unauthorized."
          },
          "404": {
            "description": "Entity or workspace not found."
          },
          "409": {
            "description": "The invoice can't be finalised, for example it has no contact where the workspace uses accrual accounting."
          },
          "500": {
            "description": "Invoice creation failed."
          }
        },
        "operationId": "invoices.create",
        "x-sdk-resource": "invoices",
        "x-sdk-method": "create"
      }
    },
    "/api/public/v1/entities/{entityId}/journals/{journalId}/attachments": {
      "post": {
        "summary": "Attach files to an existing journal",
        "description": "Attaches one or more previously uploaded files to a journal. Files must already be uploaded to the entity via the file upload endpoint. Requires API key authentication and entity access.",
        "tags": ["Journals"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "journalId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "fileIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": ["fileIds"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "attachments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "fileId": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": ["id", "fileId", "createdAt"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": ["success", "attachments"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation failed or files not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "details": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found - Journal not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "journals.attachFiles",
        "x-sdk-resource": "journals",
        "x-sdk-method": "attachFiles"
      }
    },
    "/api/public/v1/entities/{entityId}/journals/{journalId}/void": {
      "patch": {
        "summary": "Void a journal",
        "description": "Voids a posted journal for the specified entity. Only posted journals can be voided. Requires API key authentication and entity access.",
        "tags": ["Journals"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "journalId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "originalJournal": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "voidedAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "voidedBy": {
                          "type": "string",
                          "nullable": true
                        }
                      },
                      "required": ["id", "status", "voidedAt", "voidedBy"],
                      "additionalProperties": false
                    },
                    "reversalJournal": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "postedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "postedBy": {
                          "type": "string"
                        },
                        "voidedJournalId": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "status",
                        "postedAt",
                        "postedBy",
                        "voidedJournalId"
                      ],
                      "additionalProperties": false
                    },
                    "voidedAt": {
                      "type": "string",
                      "format": "date-time"
                    }
                  },
                  "required": [
                    "originalJournal",
                    "reversalJournal",
                    "voidedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Journal is not in a voidable state"
          },
          "404": {
            "description": "Journal not found"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "journals.void",
        "x-sdk-resource": "journals",
        "x-sdk-method": "void"
      }
    },
    "/api/public/v1/entities/{entityId}/journals/bulk": {
      "post": {
        "summary": "Create several manual journals at once",
        "description": "Creates up to 100 manual journals, with at most 1,000 lines between them, in one transaction:\neither every journal is recorded or none is. Each journal takes the same fields as\n`POST /api/public/v1/entities/{entityId}/journals`, including dimensions and `fileIds`.\n\n`autoPost` is required and applies to the whole set. `true` posts every journal to the ledger,\nand `false` saves every journal as a draft.\n\n## Retrying safely\n\nSend an `idempotencyKey` to make a retry safe. A repeat of the same request with the same key\nreturns the journals it created, with `replayed: true` and status 200, and records nothing new.\nA replay shows each journal's current status, which may have changed since it was created.\nThe same key with different journals is refused with a 409. Without a key, a retry after a\ntimeout can record the whole set twice.\n\n## Fixing a rejected set\n\nA 422 lists problems by each journal's position in `journals`, counting from 0. Nothing was\nrecorded, so fix them and send the whole set again.\n",
        "tags": ["Journals"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "autoPost": {
                    "type": "boolean"
                  },
                  "journals": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string"
                        },
                        "narration": {
                          "type": "string"
                        },
                        "lines": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "entityAccountCode": {
                                "type": "string"
                              },
                              "entityAccountName": {
                                "type": "string"
                              },
                              "taxRateName": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "credit": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  }
                                ]
                              },
                              "debit": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  }
                                ]
                              },
                              "taxRateId": {
                                "type": "string"
                              },
                              "dimensionOptionIds": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "taxMode": {
                          "type": "string",
                          "enum": ["NO_TAX", "TAX_INCLUSIVE", "TAX_EXCLUSIVE"]
                        },
                        "fileIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": ["date", "narration", "lines"],
                      "additionalProperties": false
                    }
                  },
                  "idempotencyKey": {
                    "type": "string"
                  }
                },
                "required": ["autoPost", "journals"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "replayed": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "logicalJournalId": {
                            "type": "string",
                            "nullable": true
                          },
                          "narration": {
                            "type": "string",
                            "nullable": true
                          },
                          "date": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "status": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "logicalJournalId",
                          "narration",
                          "date",
                          "status"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["replayed", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "replayed": {
                      "type": "boolean"
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "logicalJournalId": {
                            "type": "string",
                            "nullable": true
                          },
                          "narration": {
                            "type": "string",
                            "nullable": true
                          },
                          "date": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "status": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "logicalJournalId",
                          "narration",
                          "date",
                          "status"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["replayed", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "The request is malformed, or a taxed journal needs a GST account the entity lacks (SYSTEM_ACCOUNT_VALIDATION). Nothing was recorded."
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "404": {
            "description": "Not found - Entity not found or access denied"
          },
          "409": {
            "description": "This idempotency key was already used for different journals (IDEMPOTENCY_KEY_REUSED)"
          },
          "422": {
            "description": "One or more journals can't be recorded (JOURNALS_REJECTED); `details.problems` lists each with its index. Nothing was recorded.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "details": {
                      "type": "object",
                      "properties": {
                        "problems": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "index": {
                                "type": "integer"
                              },
                              "message": {
                                "type": "string"
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "journals.createBulk",
        "x-sdk-resource": "journals",
        "x-sdk-method": "createBulk"
      }
    },
    "/api/public/v1/entities/{entityId}/journals": {
      "get": {
        "summary": "List manual journals",
        "description": "Returns paginated manual journals for the specified entity with optional date range filtering. Requires API key authentication and entity access. Only returns journals of type MANUAL (excludes automatic and reversal journals).",
        "tags": ["Journals"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number (starts at 1)",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Number of items per page",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "required": false,
            "description": "Start date for filtering journals (ISO 8601 format)",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2024-01-01"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": false,
            "description": "End date for filtering journals (ISO 8601 format)",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2024-12-31"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "logicalJournalId": {
                            "type": "string",
                            "nullable": true
                          },
                          "postedAt": {
                            "type": "string",
                            "format": "date-time",
                            "nullable": true
                          },
                          "postedBy": {
                            "type": "string",
                            "nullable": true
                          },
                          "poster": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string",
                                "nullable": true
                              },
                              "tradingName": {
                                "type": "string",
                                "nullable": true
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            },
                            "required": [
                              "id",
                              "email",
                              "name",
                              "tradingName",
                              "createdAt"
                            ],
                            "additionalProperties": false,
                            "nullable": true
                          },
                          "lines": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "journalId": {
                                  "type": "string"
                                },
                                "parentId": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "entityAccountId": {
                                  "type": "string"
                                },
                                "lineNumber": {
                                  "type": "number"
                                },
                                "type": {
                                  "type": "string"
                                },
                                "description": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "credit": {
                                  "type": "string",
                                  "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                },
                                "debit": {
                                  "type": "string",
                                  "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                },
                                "taxRateId": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "entityAccount": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "code": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": ["id", "code", "name"],
                                  "additionalProperties": false
                                },
                                "taxRate": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "code": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "description": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "rate": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "code",
                                    "name",
                                    "description",
                                    "rate"
                                  ],
                                  "additionalProperties": false,
                                  "nullable": true
                                }
                              },
                              "required": [
                                "id",
                                "journalId",
                                "parentId",
                                "entityAccountId",
                                "lineNumber",
                                "type",
                                "description",
                                "credit",
                                "debit",
                                "taxRateId",
                                "entityAccount",
                                "taxRate"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "id": {
                            "type": "string"
                          },
                          "narration": {
                            "type": "string"
                          },
                          "date": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "status": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "reconciliations": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "bankTransaction": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "description": {
                                      "type": "string"
                                    },
                                    "merchant": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": ["id", "name"],
                                      "additionalProperties": false,
                                      "nullable": true
                                    }
                                  },
                                  "required": ["id", "description", "merchant"],
                                  "additionalProperties": false
                                }
                              },
                              "required": ["bankTransaction"],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "logicalJournalId",
                          "postedAt",
                          "postedBy",
                          "lines",
                          "id",
                          "narration",
                          "date",
                          "status",
                          "type",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "currentPage": {
                          "type": "number"
                        },
                        "pageSize": {
                          "type": "number"
                        },
                        "totalCount": {
                          "type": "number"
                        },
                        "totalPages": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        },
                        "hasPreviousPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "currentPage",
                        "pageSize",
                        "totalCount",
                        "totalPages",
                        "hasNextPage",
                        "hasPreviousPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data", "pagination"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "journals.list",
        "x-sdk-resource": "journals",
        "x-sdk-method": "list"
      },
      "post": {
        "summary": "Create a manual journal",
        "description": "Creates a new manual journal in either draft or posted status. By default, journals are automatically posted (status=POSTED).\nSet `autoPost: false` to create in draft status (status=DRAFT), which allows for review before posting.\n\nThe journal must have balanced debits and credits. Lines are validated against the entity's chart of accounts and tax rates.\nRequires API key authentication and entity access.\n\n## Prerequisites — Finding Tax Codes and Account Codes\n\nBefore creating a journal, you need two pieces of information:\n\n- **Account codes**: Retrieve the entity's chart of accounts via `GET /api/public/v1/entities/{entityId}/charts`. Use the account `code` field (e.g., \"2030\") as the `entityAccountCode` in journal lines.\n- **Tax rate IDs**: Retrieve the entity's tax rates via `GET /api/public/v1/entities` (filter by `entityId`). Use the `taxRates[].id` field as the `taxRateId` in journal lines. Common tax codes include GST15, EXEMPT, and ZERO.\n\n## Dimensions (optional)\n\nLines can be tagged with dimensions (tracking categories such as Property or Department) by passing\n`dimensionOptionIds` on each line — an array of dimension option UUIDs, at most one option per\ndimension. Retrieve the entity's dimensions and option ids via\n`GET /api/public/v1/entities/{entityId}/dimensions`. Options must belong to the entity;\nunknown option ids or two options from the same dimension are rejected with a 400. Tagged lines\ndrive the dimension filter and \"Segment by\" columns on financial reports.\n",
        "tags": ["Journals"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "narration": {
                    "type": "string"
                  },
                  "date": {
                    "type": "string"
                  },
                  "lines": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "entityAccountCode": {
                          "type": "string"
                        },
                        "entityAccountName": {
                          "type": "string"
                        },
                        "taxRateName": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "credit": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "number"
                            }
                          ]
                        },
                        "debit": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "number"
                            }
                          ]
                        },
                        "taxRateId": {
                          "type": "string"
                        },
                        "dimensionOptionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "additionalProperties": false
                    }
                  },
                  "editReason": {
                    "type": "string"
                  },
                  "taxMode": {
                    "type": "string",
                    "enum": ["NO_TAX", "TAX_INCLUSIVE", "TAX_EXCLUSIVE"]
                  },
                  "fileIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "autoPost": {
                    "type": "boolean"
                  }
                },
                "required": ["narration", "date", "lines"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "logicalJournalId": {
                      "type": "string",
                      "nullable": true
                    },
                    "postedAt": {
                      "type": "string",
                      "format": "date-time",
                      "nullable": true
                    },
                    "postedBy": {
                      "type": "string",
                      "nullable": true
                    },
                    "poster": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string",
                          "nullable": true
                        },
                        "tradingName": {
                          "type": "string",
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "email",
                        "name",
                        "tradingName",
                        "createdAt"
                      ],
                      "additionalProperties": false,
                      "nullable": true
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "journalId": {
                            "type": "string"
                          },
                          "parentId": {
                            "type": "string",
                            "nullable": true
                          },
                          "entityAccountId": {
                            "type": "string"
                          },
                          "lineNumber": {
                            "type": "number"
                          },
                          "type": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string",
                            "nullable": true
                          },
                          "credit": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          },
                          "debit": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          },
                          "taxRateId": {
                            "type": "string",
                            "nullable": true
                          },
                          "entityAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": ["id", "code", "name"],
                            "additionalProperties": false
                          },
                          "taxRate": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string",
                                "nullable": true
                              },
                              "rate": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name",
                              "description",
                              "rate"
                            ],
                            "additionalProperties": false,
                            "nullable": true
                          }
                        },
                        "required": [
                          "id",
                          "journalId",
                          "parentId",
                          "entityAccountId",
                          "lineNumber",
                          "type",
                          "description",
                          "credit",
                          "debit",
                          "taxRateId",
                          "entityAccount",
                          "taxRate"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "id": {
                      "type": "string"
                    },
                    "narration": {
                      "type": "string"
                    },
                    "date": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "status": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    },
                    "createdAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "updatedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "reconciliations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "bankTransaction": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "merchant": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false,
                                "nullable": true
                              }
                            },
                            "required": ["id", "description", "merchant"],
                            "additionalProperties": false
                          }
                        },
                        "required": ["bankTransaction"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "logicalJournalId",
                    "postedAt",
                    "postedBy",
                    "lines",
                    "id",
                    "narration",
                    "date",
                    "status",
                    "type",
                    "createdAt",
                    "updatedAt"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation failed, invalid account codes, an unbalanced journal, or missing/invalid system account setup (SYSTEM_ACCOUNT_VALIDATION).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "details": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not found - Entity not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "journals.create",
        "x-sdk-resource": "journals",
        "x-sdk-method": "create"
      }
    },
    "/api/public/v1/entities/{entityId}/ledger": {
      "get": {
        "summary": "Get ledger entries",
        "deprecated": true,
        "description": "**Deprecated.** This was the original general ledger endpoint and has been replaced by the general ledger report endpoints. New integrations should use `GET /api/public/v1/entities/{entityId}/general-ledger/transaction` (flat entry list) or `GET /api/public/v1/entities/{entityId}/general-ledger/account` (grouped by account) instead. Returns paginated journal lines (ledger entries) for an entity with optional date range and account filtering. Only includes posted journals, excluding reversal entries.",
        "tags": ["Reports"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number (starts at 1)",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Number of items per page",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "required": false,
            "description": "Start date for filtering ledger entries (ISO 8601 format YYYY-MM-DD, interpreted in NZ timezone)",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2024-01-01"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": false,
            "description": "End date for filtering ledger entries (ISO 8601 format YYYY-MM-DD, interpreted in NZ timezone)",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2024-12-31"
            }
          },
          {
            "name": "accountIds",
            "in": "query",
            "required": false,
            "description": "Comma-separated list of entity account IDs to filter by",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "style": "form",
            "explode": false
          },
          {
            "name": "journalId",
            "in": "query",
            "required": false,
            "description": "Filter by journal ID to get all ledger entries for a specific journal",
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "123e4567-e89b-12d3-a456-426614174000"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "narration": {
                            "type": "string"
                          },
                          "journalType": {
                            "type": "string"
                          },
                          "bankTransactionId": {
                            "type": "string",
                            "nullable": true
                          },
                          "gst": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string",
                            "nullable": true
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "parentId": {
                            "type": "string",
                            "nullable": true
                          },
                          "journalId": {
                            "type": "string"
                          },
                          "entityAccountId": {
                            "type": "string"
                          },
                          "taxRateId": {
                            "type": "string"
                          },
                          "credit": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          },
                          "debit": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          },
                          "entityAccount": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              }
                            },
                            "required": ["id", "name", "code"],
                            "additionalProperties": false
                          },
                          "taxRate": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string",
                                "nullable": true
                              },
                              "code": {
                                "type": "string"
                              },
                              "rate": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "description",
                              "code",
                              "rate"
                            ],
                            "additionalProperties": false
                          },
                          "accountVersion": {
                            "type": "number",
                            "nullable": true
                          },
                          "lineNumber": {
                            "type": "number"
                          },
                          "sumAccountCredits": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic.",
                            "nullable": true
                          },
                          "sumAccountDebits": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic.",
                            "nullable": true
                          }
                        },
                        "required": [
                          "narration",
                          "journalType",
                          "bankTransactionId",
                          "gst",
                          "id",
                          "description",
                          "updatedAt",
                          "createdAt",
                          "parentId",
                          "journalId",
                          "entityAccountId",
                          "taxRateId",
                          "credit",
                          "debit",
                          "entityAccount",
                          "taxRate",
                          "accountVersion",
                          "lineNumber",
                          "sumAccountCredits",
                          "sumAccountDebits"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "currentPage": {
                          "type": "number"
                        },
                        "pageSize": {
                          "type": "number"
                        },
                        "totalCount": {
                          "type": "number"
                        },
                        "totalPages": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        },
                        "hasPreviousPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "currentPage",
                        "pageSize",
                        "totalCount",
                        "totalPages",
                        "hasNextPage",
                        "hasPreviousPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data", "pagination"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "ledger.list",
        "x-sdk-resource": "ledger",
        "x-sdk-method": "list"
      }
    },
    "/api/public/v1/entities/{entityId}/report-categories": {
      "get": {
        "summary": "List report groups and categories for an entity",
        "description": "Returns the complete stored taxonomy for the authorised entity's country. Parent IDs and sort order describe the group tree. Headings are structure only; isAssignable=false prevents their selection. An ordinary group may allow a null category, but bank and asset-account functions can still require one. Category placements are exact, not inherited.\nExamples: Operating expenses (exp.operating) is assignable with no category; Retained earnings (equ.retainedearnings) also permits a null category. Expenses (exp) is a heading and cannot be assigned. This endpoint does not change accounts. No country parameter or pagination is required.\n",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string"
                        },
                        "legacyDefaults": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "globalAccountId": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "groupKey": {
                                "type": "string"
                              },
                              "categoryKey": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": [
                              "globalAccountId",
                              "code",
                              "groupKey",
                              "categoryKey"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "groups": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "key": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "accountType": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string",
                                "nullable": true
                              },
                              "parentId": {
                                "type": "string",
                                "nullable": true
                              },
                              "sortOrder": {
                                "type": "number"
                              },
                              "isHeading": {
                                "type": "boolean"
                              },
                              "isAssignable": {
                                "type": "boolean"
                              },
                              "allowGroupOnly": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "key",
                              "name",
                              "status",
                              "accountType",
                              "description",
                              "parentId",
                              "sortOrder",
                              "isHeading",
                              "isAssignable",
                              "allowGroupOnly"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "categories": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "key": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "codingGuidance": {
                                "type": "string",
                                "nullable": true
                              },
                              "defaultGroupId": {
                                "type": "string"
                              },
                              "allowedGroupIds": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "id",
                              "key",
                              "name",
                              "status",
                              "description",
                              "codingGuidance",
                              "defaultGroupId",
                              "allowedGroupIds"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "reportingInputsEnabled": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "country",
                        "groups",
                        "categories",
                        "reportingInputsEnabled"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid entity ID"
          },
          "401": {
            "description": "Missing or invalid bearer authentication"
          },
          "403": {
            "description": "Bearer token is pinned to another entity"
          },
          "404": {
            "description": "Entity not found or access denied"
          },
          "500": {
            "description": "Unexpected failure loading the taxonomy"
          },
          "503": {
            "description": "Permission service temporarily unavailable"
          }
        },
        "operationId": "reportCategories.list",
        "x-sdk-resource": "reportCategories",
        "x-sdk-method": "list"
      }
    },
    "/api/public/v1/entities/{entityId}/reports/balance-sheet": {
      "get": {
        "summary": "Get balance sheet report",
        "description": "Returns a balance sheet report for the specified entity.",
        "tags": ["Reports"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "asOfDate",
            "in": "query",
            "required": false,
            "description": "As-of date for the report. Defaults to today.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeZeroBalances",
            "in": "query",
            "required": false,
            "description": "Include accounts with zero balances",
            "schema": {
              "type": "string",
              "enum": ["false", "true"]
            }
          },
          {
            "name": "comparison",
            "in": "query",
            "required": false,
            "description": "Whether to include comparison columns",
            "schema": {
              "type": "string",
              "enum": ["none", "periods"]
            }
          },
          {
            "name": "comparisonType",
            "in": "query",
            "required": false,
            "description": "Type of comparison period",
            "schema": {
              "type": "string",
              "enum": ["year", "month"]
            }
          },
          {
            "name": "comparisonPeriods",
            "in": "query",
            "required": false,
            "description": "Number of comparison periods (1-12)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "entityId": {
                              "type": "string"
                            },
                            "entityName": {
                              "type": "string"
                            },
                            "generatedAt": {
                              "type": "string"
                            },
                            "currency": {
                              "type": "string"
                            },
                            "reportType": {
                              "type": "string",
                              "enum": ["balance-sheet"]
                            },
                            "asOfDate": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "entityId",
                            "entityName",
                            "generatedAt",
                            "currency",
                            "reportType",
                            "asOfDate"
                          ],
                          "additionalProperties": false
                        },
                        "sections": {
                          "type": "object",
                          "properties": {
                            "assets": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": ["Equity", "Assets", "Liabilities"]
                                },
                                "name": {
                                  "type": "string"
                                },
                                "groups": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "accounts": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "accountId": {
                                              "type": "string"
                                            },
                                            "accountCode": {
                                              "type": "string"
                                            },
                                            "accountName": {
                                              "type": "string"
                                            },
                                            "accountType": {
                                              "type": "string",
                                              "enum": [
                                                "Equity",
                                                "Asset",
                                                "Liability"
                                              ]
                                            },
                                            "accountSubtype": {
                                              "type": "string"
                                            },
                                            "earningsType": {
                                              "type": "string",
                                              "enum": [
                                                "retained",
                                                "current-year"
                                              ]
                                            },
                                            "balance": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalCredit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalDebit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            }
                                          },
                                          "required": [
                                            "accountId",
                                            "accountCode",
                                            "accountName",
                                            "accountType",
                                            "accountSubtype",
                                            "balance",
                                            "totalCredit",
                                            "totalDebit"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "subtotal": {
                                        "type": "string",
                                        "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "name",
                                      "accounts",
                                      "subtotal"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "total": {
                                  "type": "string",
                                  "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                }
                              },
                              "required": ["type", "name", "groups", "total"],
                              "additionalProperties": false
                            },
                            "liabilities": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": ["Equity", "Assets", "Liabilities"]
                                },
                                "name": {
                                  "type": "string"
                                },
                                "groups": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "accounts": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "accountId": {
                                              "type": "string"
                                            },
                                            "accountCode": {
                                              "type": "string"
                                            },
                                            "accountName": {
                                              "type": "string"
                                            },
                                            "accountType": {
                                              "type": "string",
                                              "enum": [
                                                "Equity",
                                                "Asset",
                                                "Liability"
                                              ]
                                            },
                                            "accountSubtype": {
                                              "type": "string"
                                            },
                                            "earningsType": {
                                              "type": "string",
                                              "enum": [
                                                "retained",
                                                "current-year"
                                              ]
                                            },
                                            "balance": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalCredit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalDebit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            }
                                          },
                                          "required": [
                                            "accountId",
                                            "accountCode",
                                            "accountName",
                                            "accountType",
                                            "accountSubtype",
                                            "balance",
                                            "totalCredit",
                                            "totalDebit"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "subtotal": {
                                        "type": "string",
                                        "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "name",
                                      "accounts",
                                      "subtotal"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "total": {
                                  "type": "string",
                                  "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                }
                              },
                              "required": ["type", "name", "groups", "total"],
                              "additionalProperties": false
                            },
                            "equity": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": ["Equity", "Assets", "Liabilities"]
                                },
                                "name": {
                                  "type": "string"
                                },
                                "groups": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "accounts": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "accountId": {
                                              "type": "string"
                                            },
                                            "accountCode": {
                                              "type": "string"
                                            },
                                            "accountName": {
                                              "type": "string"
                                            },
                                            "accountType": {
                                              "type": "string",
                                              "enum": [
                                                "Equity",
                                                "Asset",
                                                "Liability"
                                              ]
                                            },
                                            "accountSubtype": {
                                              "type": "string"
                                            },
                                            "earningsType": {
                                              "type": "string",
                                              "enum": [
                                                "retained",
                                                "current-year"
                                              ]
                                            },
                                            "balance": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalCredit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalDebit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            }
                                          },
                                          "required": [
                                            "accountId",
                                            "accountCode",
                                            "accountName",
                                            "accountType",
                                            "accountSubtype",
                                            "balance",
                                            "totalCredit",
                                            "totalDebit"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "subtotal": {
                                        "type": "string",
                                        "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "name",
                                      "accounts",
                                      "subtotal"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "total": {
                                  "type": "string",
                                  "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                }
                              },
                              "required": ["type", "name", "groups", "total"],
                              "additionalProperties": false
                            }
                          },
                          "required": ["assets", "liabilities", "equity"],
                          "additionalProperties": false
                        },
                        "totals": {
                          "type": "object",
                          "properties": {
                            "totalAssets": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "totalLiabilities": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "totalEquity": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "netAssets": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "isBalanced": {
                              "type": "boolean"
                            },
                            "variance": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            }
                          },
                          "required": [
                            "totalAssets",
                            "totalLiabilities",
                            "totalEquity",
                            "netAssets",
                            "isBalanced",
                            "variance"
                          ],
                          "additionalProperties": false
                        },
                        "earningsBreakdown": {
                          "type": "object",
                          "properties": {
                            "currentYearEarnings": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "retainedEarnings": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            }
                          },
                          "required": [
                            "currentYearEarnings",
                            "retainedEarnings"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": ["metadata", "sections", "totals"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "entityId": {
                              "type": "string"
                            },
                            "entityName": {
                              "type": "string"
                            },
                            "generatedAt": {
                              "type": "string"
                            },
                            "currency": {
                              "type": "string"
                            },
                            "reportType": {
                              "type": "string",
                              "enum": ["balance-sheet-comparison"]
                            },
                            "asOfDate": {
                              "type": "string"
                            },
                            "comparisonPeriods": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "comparisonPeriodDates": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "comparisonType": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "entityId",
                            "entityName",
                            "generatedAt",
                            "currency",
                            "reportType",
                            "asOfDate",
                            "comparisonPeriods",
                            "comparisonType"
                          ],
                          "additionalProperties": false
                        },
                        "sections": {
                          "type": "object",
                          "properties": {
                            "assets": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": ["Equity", "Assets", "Liabilities"]
                                },
                                "name": {
                                  "type": "string"
                                },
                                "groups": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "accounts": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "comparisonPeriods": {
                                              "type": "object",
                                              "properties": {},
                                              "additionalProperties": {
                                                "type": "object",
                                                "properties": {
                                                  "balance": {
                                                    "type": "string",
                                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                                  }
                                                },
                                                "required": ["balance"],
                                                "additionalProperties": false
                                              }
                                            },
                                            "accountId": {
                                              "type": "string"
                                            },
                                            "accountCode": {
                                              "type": "string"
                                            },
                                            "accountName": {
                                              "type": "string"
                                            },
                                            "accountType": {
                                              "type": "string",
                                              "enum": [
                                                "Equity",
                                                "Asset",
                                                "Liability"
                                              ]
                                            },
                                            "accountSubtype": {
                                              "type": "string"
                                            },
                                            "earningsType": {
                                              "type": "string",
                                              "enum": [
                                                "retained",
                                                "current-year"
                                              ]
                                            },
                                            "balance": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalCredit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalDebit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            }
                                          },
                                          "required": [
                                            "comparisonPeriods",
                                            "accountId",
                                            "accountCode",
                                            "accountName",
                                            "accountType",
                                            "accountSubtype",
                                            "balance",
                                            "totalCredit",
                                            "totalDebit"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "subtotal": {
                                        "type": "string",
                                        "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                      },
                                      "comparisonSubtotals": {
                                        "type": "object",
                                        "properties": {},
                                        "additionalProperties": {
                                          "type": "string",
                                          "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                        }
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "name",
                                      "accounts",
                                      "subtotal",
                                      "comparisonSubtotals"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "total": {
                                  "type": "string",
                                  "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                },
                                "comparisonTotals": {
                                  "type": "object",
                                  "properties": {},
                                  "additionalProperties": {
                                    "type": "string",
                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "name",
                                "groups",
                                "total",
                                "comparisonTotals"
                              ],
                              "additionalProperties": false
                            },
                            "liabilities": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": ["Equity", "Assets", "Liabilities"]
                                },
                                "name": {
                                  "type": "string"
                                },
                                "groups": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "accounts": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "comparisonPeriods": {
                                              "type": "object",
                                              "properties": {},
                                              "additionalProperties": {
                                                "type": "object",
                                                "properties": {
                                                  "balance": {
                                                    "type": "string",
                                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                                  }
                                                },
                                                "required": ["balance"],
                                                "additionalProperties": false
                                              }
                                            },
                                            "accountId": {
                                              "type": "string"
                                            },
                                            "accountCode": {
                                              "type": "string"
                                            },
                                            "accountName": {
                                              "type": "string"
                                            },
                                            "accountType": {
                                              "type": "string",
                                              "enum": [
                                                "Equity",
                                                "Asset",
                                                "Liability"
                                              ]
                                            },
                                            "accountSubtype": {
                                              "type": "string"
                                            },
                                            "earningsType": {
                                              "type": "string",
                                              "enum": [
                                                "retained",
                                                "current-year"
                                              ]
                                            },
                                            "balance": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalCredit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalDebit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            }
                                          },
                                          "required": [
                                            "comparisonPeriods",
                                            "accountId",
                                            "accountCode",
                                            "accountName",
                                            "accountType",
                                            "accountSubtype",
                                            "balance",
                                            "totalCredit",
                                            "totalDebit"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "subtotal": {
                                        "type": "string",
                                        "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                      },
                                      "comparisonSubtotals": {
                                        "type": "object",
                                        "properties": {},
                                        "additionalProperties": {
                                          "type": "string",
                                          "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                        }
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "name",
                                      "accounts",
                                      "subtotal",
                                      "comparisonSubtotals"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "total": {
                                  "type": "string",
                                  "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                },
                                "comparisonTotals": {
                                  "type": "object",
                                  "properties": {},
                                  "additionalProperties": {
                                    "type": "string",
                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "name",
                                "groups",
                                "total",
                                "comparisonTotals"
                              ],
                              "additionalProperties": false
                            },
                            "equity": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": ["Equity", "Assets", "Liabilities"]
                                },
                                "name": {
                                  "type": "string"
                                },
                                "groups": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "accounts": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "comparisonPeriods": {
                                              "type": "object",
                                              "properties": {},
                                              "additionalProperties": {
                                                "type": "object",
                                                "properties": {
                                                  "balance": {
                                                    "type": "string",
                                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                                  }
                                                },
                                                "required": ["balance"],
                                                "additionalProperties": false
                                              }
                                            },
                                            "accountId": {
                                              "type": "string"
                                            },
                                            "accountCode": {
                                              "type": "string"
                                            },
                                            "accountName": {
                                              "type": "string"
                                            },
                                            "accountType": {
                                              "type": "string",
                                              "enum": [
                                                "Equity",
                                                "Asset",
                                                "Liability"
                                              ]
                                            },
                                            "accountSubtype": {
                                              "type": "string"
                                            },
                                            "earningsType": {
                                              "type": "string",
                                              "enum": [
                                                "retained",
                                                "current-year"
                                              ]
                                            },
                                            "balance": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalCredit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            },
                                            "totalDebit": {
                                              "type": "string",
                                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                            }
                                          },
                                          "required": [
                                            "comparisonPeriods",
                                            "accountId",
                                            "accountCode",
                                            "accountName",
                                            "accountType",
                                            "accountSubtype",
                                            "balance",
                                            "totalCredit",
                                            "totalDebit"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "subtotal": {
                                        "type": "string",
                                        "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                      },
                                      "comparisonSubtotals": {
                                        "type": "object",
                                        "properties": {},
                                        "additionalProperties": {
                                          "type": "string",
                                          "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                        }
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "name",
                                      "accounts",
                                      "subtotal",
                                      "comparisonSubtotals"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "total": {
                                  "type": "string",
                                  "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                },
                                "comparisonTotals": {
                                  "type": "object",
                                  "properties": {},
                                  "additionalProperties": {
                                    "type": "string",
                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                  }
                                }
                              },
                              "required": [
                                "type",
                                "name",
                                "groups",
                                "total",
                                "comparisonTotals"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": ["assets", "liabilities", "equity"],
                          "additionalProperties": false
                        },
                        "totals": {
                          "type": "object",
                          "properties": {
                            "totalAssets": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "totalLiabilities": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "totalEquity": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "netAssets": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "isBalanced": {
                              "type": "boolean"
                            },
                            "variance": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            }
                          },
                          "required": [
                            "totalAssets",
                            "totalLiabilities",
                            "totalEquity",
                            "netAssets",
                            "isBalanced",
                            "variance"
                          ],
                          "additionalProperties": false
                        },
                        "comparisonTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "totalAssets": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "totalLiabilities": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "totalEquity": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "netAssets": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "isBalanced": {
                                "type": "boolean"
                              },
                              "variance": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              }
                            },
                            "required": [
                              "totalAssets",
                              "totalLiabilities",
                              "totalEquity",
                              "netAssets",
                              "isBalanced",
                              "variance"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "earningsBreakdown": {
                          "type": "object",
                          "properties": {
                            "currentYearEarnings": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "retainedEarnings": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "comparisonEarnings": {
                              "type": "object",
                              "properties": {},
                              "additionalProperties": {
                                "type": "object",
                                "properties": {
                                  "currentYearEarnings": {
                                    "type": "string",
                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                  },
                                  "retainedEarnings": {
                                    "type": "string",
                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                  }
                                },
                                "required": [
                                  "currentYearEarnings",
                                  "retainedEarnings"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "currentYearEarnings",
                            "retainedEarnings",
                            "comparisonEarnings"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "metadata",
                        "sections",
                        "totals",
                        "comparisonTotals"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid query parameters or missing/invalid system account setup (SYSTEM_ACCOUNT_VALIDATION)."
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "403": {
            "description": "Forbidden - No access to the specified entity"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "reports.balanceSheet",
        "x-sdk-resource": "reports",
        "x-sdk-method": "balanceSheet"
      }
    },
    "/api/public/v1/entities/{entityId}/reports/current-accounts": {
      "get": {
        "summary": "Get current accounts report",
        "description": "Returns a current accounts report for the specified entity.",
        "tags": ["Reports"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "periodType",
            "in": "query",
            "required": false,
            "description": "Period type for the report. Matches the presets available in the Prosaic UI. Relative periods (this-month, this-quarter, etc.) are resolved to full NZ calendar periods, so omit startDate/endDate when using them. Use custom to supply explicit startDate and endDate.",
            "schema": {
              "type": "string",
              "enum": [
                "custom",
                "this-month",
                "last-month",
                "this-quarter",
                "last-quarter",
                "this-financial-year",
                "last-financial-year"
              ]
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "description": "Start date for custom period. Required when periodType is `custom`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "description": "End date for custom period. Required when periodType is `custom`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "comparison",
            "in": "query",
            "required": false,
            "description": "Whether to include comparison columns",
            "schema": {
              "type": "string",
              "enum": ["none", "periods"]
            }
          },
          {
            "name": "comparisonType",
            "in": "query",
            "required": false,
            "description": "Granularity of each comparison period. For UI-consistent results, pair month with this-month/last-month, quarter with this-quarter/last-quarter, and year with the financial-year periods.",
            "schema": {
              "type": "string",
              "enum": ["custom", "year", "month", "quarter"]
            }
          },
          {
            "name": "comparisonPeriods",
            "in": "query",
            "required": false,
            "description": "Number of comparison periods (1-12)",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "entityId": {
                          "type": "string"
                        },
                        "entityName": {
                          "type": "string"
                        },
                        "entityType": {
                          "type": "string"
                        },
                        "generatedAt": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "reportType": {
                          "type": "string"
                        },
                        "startDate": {
                          "type": "string"
                        },
                        "endDate": {
                          "type": "string"
                        },
                        "periodDescription": {
                          "type": "string"
                        },
                        "reportTitle": {
                          "type": "string"
                        },
                        "comparisonPeriods": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "comparisonPeriodRanges": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "label": {
                                "type": "string"
                              },
                              "startDate": {
                                "type": "string"
                              },
                              "endDate": {
                                "type": "string"
                              }
                            },
                            "required": ["label", "startDate", "endDate"],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "entityId",
                        "entityName",
                        "entityType",
                        "generatedAt",
                        "currency",
                        "reportType",
                        "startDate",
                        "endDate",
                        "periodDescription",
                        "reportTitle"
                      ],
                      "additionalProperties": false
                    },
                    "openingBalance": {
                      "type": "string",
                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                    },
                    "openingBalanceComparison": {
                      "type": "object",
                      "properties": {},
                      "additionalProperties": {
                        "type": "string",
                        "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                      }
                    },
                    "increases": {
                      "type": "object",
                      "properties": {
                        "accounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "accountId": {
                                "type": "string"
                              },
                              "accountCode": {
                                "type": "string"
                              },
                              "accountName": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "comparisonPeriods": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "amount": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": ["amount"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "accountId",
                              "accountCode",
                              "accountName",
                              "amount"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "total": {
                          "type": "string",
                          "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                        },
                        "comparisonTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        }
                      },
                      "required": ["accounts", "total"],
                      "additionalProperties": false
                    },
                    "decreases": {
                      "type": "object",
                      "properties": {
                        "accounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "accountId": {
                                "type": "string"
                              },
                              "accountCode": {
                                "type": "string"
                              },
                              "accountName": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "comparisonPeriods": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "amount": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": ["amount"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "accountId",
                              "accountCode",
                              "accountName",
                              "amount"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "total": {
                          "type": "string",
                          "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                        },
                        "comparisonTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        }
                      },
                      "required": ["accounts", "total"],
                      "additionalProperties": false
                    },
                    "closingBalance": {
                      "type": "string",
                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                    },
                    "closingBalanceComparison": {
                      "type": "object",
                      "properties": {},
                      "additionalProperties": {
                        "type": "string",
                        "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                      }
                    }
                  },
                  "required": [
                    "metadata",
                    "openingBalance",
                    "increases",
                    "decreases",
                    "closingBalance"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid query parameters"
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "403": {
            "description": "Forbidden - No access to the specified entity"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "reports.currentAccounts",
        "x-sdk-resource": "reports",
        "x-sdk-method": "currentAccounts"
      }
    },
    "/api/public/v1/entities/{entityId}/reports/depreciation-schedule": {
      "get": {
        "summary": "Get depreciation schedule report",
        "description": "Returns a depreciation schedule report for the specified entity.",
        "tags": ["Reports"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": true,
            "description": "Start date for the schedule.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": true,
            "description": "End date for the schedule.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "entityId": {
                          "type": "string"
                        },
                        "entityName": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "startDate": {
                          "type": "string"
                        },
                        "endDate": {
                          "type": "string"
                        },
                        "generatedAt": {
                          "type": "string"
                        },
                        "periodDescription": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "entityId",
                        "entityName",
                        "currency",
                        "startDate",
                        "endDate",
                        "generatedAt",
                        "periodDescription"
                      ],
                      "additionalProperties": false
                    },
                    "assets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "assetId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "assetTypeName": {
                            "type": "string",
                            "nullable": true
                          },
                          "costAccountName": {
                            "type": "string",
                            "nullable": true
                          },
                          "expenseAccountName": {
                            "type": "string",
                            "nullable": true
                          },
                          "method": {
                            "type": "string"
                          },
                          "rate": {
                            "type": "number",
                            "nullable": true
                          },
                          "privateUsePercentage": {
                            "type": "number"
                          },
                          "purchaseDate": {
                            "type": "string",
                            "nullable": true
                          },
                          "cost": {
                            "type": "number"
                          },
                          "openingValue": {
                            "type": "number"
                          },
                          "purchases": {
                            "type": "number"
                          },
                          "disposals": {
                            "type": "number"
                          },
                          "depreciation": {
                            "type": "number"
                          },
                          "investmentBoost": {
                            "type": "number"
                          },
                          "accumulatedDepreciation": {
                            "type": "number"
                          },
                          "closingValue": {
                            "type": "number"
                          },
                          "privateUseAmount": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "assetId",
                          "name",
                          "assetTypeName",
                          "costAccountName",
                          "expenseAccountName",
                          "method",
                          "rate",
                          "privateUsePercentage",
                          "purchaseDate",
                          "cost",
                          "openingValue",
                          "purchases",
                          "disposals",
                          "depreciation",
                          "accumulatedDepreciation",
                          "closingValue",
                          "privateUseAmount"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "cost": {
                          "type": "number"
                        },
                        "openingValue": {
                          "type": "number"
                        },
                        "purchases": {
                          "type": "number"
                        },
                        "disposals": {
                          "type": "number"
                        },
                        "depreciation": {
                          "type": "number"
                        },
                        "investmentBoost": {
                          "type": "number"
                        },
                        "accumulatedDepreciation": {
                          "type": "number"
                        },
                        "closingValue": {
                          "type": "number"
                        },
                        "privateUseAmount": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "cost",
                        "openingValue",
                        "purchases",
                        "disposals",
                        "depreciation",
                        "accumulatedDepreciation",
                        "closingValue",
                        "privateUseAmount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["metadata", "assets", "totals"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid or missing query parameters"
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "403": {
            "description": "Forbidden - No access to the specified entity"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "reports.depreciationSchedule",
        "x-sdk-resource": "reports",
        "x-sdk-method": "depreciationSchedule"
      }
    },
    "/api/public/v1/entities/{entityId}/reports/profit-loss": {
      "get": {
        "summary": "Get profit & loss report",
        "description": "Returns a profit & loss report for the specified entity.",
        "tags": ["Reports"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "periodType",
            "in": "query",
            "required": false,
            "description": "Period type for the report. Matches the presets available in the Prosaic UI. Relative periods (this-month, this-quarter, etc.) are resolved to full NZ calendar periods, so omit startDate/endDate when using them. Use custom to supply explicit startDate and endDate.",
            "schema": {
              "type": "string",
              "enum": [
                "custom",
                "this-month",
                "last-month",
                "this-quarter",
                "last-quarter",
                "this-financial-year",
                "last-financial-year"
              ]
            }
          },
          {
            "name": "startDate",
            "in": "query",
            "required": false,
            "description": "Start date for custom period. Required when periodType is `custom`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "endDate",
            "in": "query",
            "required": false,
            "description": "End date for custom period. Required when periodType is `custom`.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "comparison",
            "in": "query",
            "required": false,
            "description": "Whether to include comparison columns",
            "schema": {
              "type": "string",
              "enum": ["none", "periods"]
            }
          },
          {
            "name": "comparisonType",
            "in": "query",
            "required": false,
            "description": "Granularity of each comparison period. For UI-consistent results, pair month with this-month/last-month, quarter with this-quarter/last-quarter, and year with the financial-year periods.",
            "schema": {
              "type": "string",
              "enum": ["custom", "year", "month", "quarter"]
            }
          },
          {
            "name": "comparisonPeriods",
            "in": "query",
            "required": false,
            "description": "Number of comparison periods (1-12)",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "includeZeroBalances",
            "in": "query",
            "required": false,
            "description": "Include accounts with zero balances",
            "schema": {
              "type": "string",
              "enum": ["false", "true"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "metadata": {
                      "type": "object",
                      "properties": {
                        "entityId": {
                          "type": "string"
                        },
                        "entityName": {
                          "type": "string"
                        },
                        "generatedAt": {
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "reportType": {
                          "type": "string",
                          "enum": ["profit-loss"]
                        },
                        "startDate": {
                          "type": "string"
                        },
                        "endDate": {
                          "type": "string"
                        },
                        "periodDescription": {
                          "type": "string"
                        },
                        "comparisonPeriods": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "comparisonPeriodRanges": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "label": {
                                "type": "string"
                              },
                              "startDate": {
                                "type": "string"
                              },
                              "endDate": {
                                "type": "string"
                              }
                            },
                            "required": ["label", "startDate", "endDate"],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "entityId",
                        "entityName",
                        "generatedAt",
                        "currency",
                        "reportType",
                        "startDate",
                        "endDate",
                        "periodDescription"
                      ],
                      "additionalProperties": false
                    },
                    "tradingIncome": {
                      "type": "object",
                      "properties": {
                        "header": {
                          "type": "string"
                        },
                        "totalLabel": {
                          "type": "string"
                        },
                        "accounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "accountId": {
                                "type": "string"
                              },
                              "accountCode": {
                                "type": "string"
                              },
                              "accountName": {
                                "type": "string"
                              },
                              "accountType": {
                                "type": "string",
                                "enum": ["Revenue", "Expense"]
                              },
                              "accountSubtype": {
                                "type": "string"
                              },
                              "totalCredit": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "totalDebit": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "balance": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "comparisonPeriods": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "balance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": ["balance"],
                                  "additionalProperties": false
                                }
                              },
                              "segments": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "balance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": ["balance"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "accountId",
                              "accountCode",
                              "accountName",
                              "accountType",
                              "accountSubtype",
                              "totalCredit",
                              "totalDebit",
                              "balance"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "total": {
                          "type": "string",
                          "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                        },
                        "comparisonTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        },
                        "segmentTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        }
                      },
                      "required": [
                        "header",
                        "totalLabel",
                        "accounts",
                        "total",
                        "comparisonTotals"
                      ],
                      "additionalProperties": false
                    },
                    "costOfSales": {
                      "type": "object",
                      "properties": {
                        "header": {
                          "type": "string"
                        },
                        "totalLabel": {
                          "type": "string"
                        },
                        "accounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "accountId": {
                                "type": "string"
                              },
                              "accountCode": {
                                "type": "string"
                              },
                              "accountName": {
                                "type": "string"
                              },
                              "accountType": {
                                "type": "string",
                                "enum": ["Revenue", "Expense"]
                              },
                              "accountSubtype": {
                                "type": "string"
                              },
                              "totalCredit": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "totalDebit": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "balance": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "comparisonPeriods": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "balance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": ["balance"],
                                  "additionalProperties": false
                                }
                              },
                              "segments": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "balance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": ["balance"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "accountId",
                              "accountCode",
                              "accountName",
                              "accountType",
                              "accountSubtype",
                              "totalCredit",
                              "totalDebit",
                              "balance"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "total": {
                          "type": "string",
                          "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                        },
                        "comparisonTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        },
                        "segmentTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        }
                      },
                      "required": [
                        "header",
                        "totalLabel",
                        "accounts",
                        "total",
                        "comparisonTotals"
                      ],
                      "additionalProperties": false
                    },
                    "otherIncome": {
                      "type": "object",
                      "properties": {
                        "header": {
                          "type": "string"
                        },
                        "totalLabel": {
                          "type": "string"
                        },
                        "accounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "accountId": {
                                "type": "string"
                              },
                              "accountCode": {
                                "type": "string"
                              },
                              "accountName": {
                                "type": "string"
                              },
                              "accountType": {
                                "type": "string",
                                "enum": ["Revenue", "Expense"]
                              },
                              "accountSubtype": {
                                "type": "string"
                              },
                              "totalCredit": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "totalDebit": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "balance": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "comparisonPeriods": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "balance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": ["balance"],
                                  "additionalProperties": false
                                }
                              },
                              "segments": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "balance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": ["balance"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "accountId",
                              "accountCode",
                              "accountName",
                              "accountType",
                              "accountSubtype",
                              "totalCredit",
                              "totalDebit",
                              "balance"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "total": {
                          "type": "string",
                          "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                        },
                        "comparisonTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        },
                        "segmentTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        }
                      },
                      "required": [
                        "header",
                        "totalLabel",
                        "accounts",
                        "total",
                        "comparisonTotals"
                      ],
                      "additionalProperties": false
                    },
                    "operatingExpenses": {
                      "type": "object",
                      "properties": {
                        "header": {
                          "type": "string"
                        },
                        "totalLabel": {
                          "type": "string"
                        },
                        "accounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "accountId": {
                                "type": "string"
                              },
                              "accountCode": {
                                "type": "string"
                              },
                              "accountName": {
                                "type": "string"
                              },
                              "accountType": {
                                "type": "string",
                                "enum": ["Revenue", "Expense"]
                              },
                              "accountSubtype": {
                                "type": "string"
                              },
                              "totalCredit": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "totalDebit": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "balance": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "comparisonPeriods": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "balance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": ["balance"],
                                  "additionalProperties": false
                                }
                              },
                              "segments": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "balance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": ["balance"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "accountId",
                              "accountCode",
                              "accountName",
                              "accountType",
                              "accountSubtype",
                              "totalCredit",
                              "totalDebit",
                              "balance"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "total": {
                          "type": "string",
                          "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                        },
                        "comparisonTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        },
                        "segmentTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        }
                      },
                      "required": [
                        "header",
                        "totalLabel",
                        "accounts",
                        "total",
                        "comparisonTotals"
                      ],
                      "additionalProperties": false
                    },
                    "hasTradingSection": {
                      "type": "boolean"
                    },
                    "totals": {
                      "type": "object",
                      "properties": {
                        "grossProfit": {
                          "type": "string",
                          "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                        },
                        "grossProfitComparison": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        },
                        "netProfit": {
                          "type": "string",
                          "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                        },
                        "netProfitComparison": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "string",
                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                          }
                        }
                      },
                      "required": [
                        "grossProfit",
                        "grossProfitComparison",
                        "netProfit",
                        "netProfitComparison"
                      ],
                      "additionalProperties": false
                    },
                    "segmentColumns": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "isArchived": {
                            "type": "boolean"
                          },
                          "dimensionId": {
                            "type": "string"
                          },
                          "dimensionName": {
                            "type": "string"
                          }
                        },
                        "required": ["key", "label", "isArchived"],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "metadata",
                    "tradingIncome",
                    "costOfSales",
                    "otherIncome",
                    "operatingExpenses",
                    "hasTradingSection",
                    "totals"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid query parameters"
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "403": {
            "description": "Forbidden - No access to the specified entity"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "reports.profitLoss",
        "x-sdk-resource": "reports",
        "x-sdk-method": "profitLoss"
      }
    },
    "/api/public/v1/entities/{entityId}/transactions/{transactionId}/reconcile": {
      "post": {
        "summary": "Reconcile a bank transaction",
        "description": "Reconciles a single bank transaction by creating journal entries with automatic tax calculations.\n\n## Tax Handling\n\nThe system supports three tax modes:\n\n### NO_TAX\n- No tax calculations are performed\n- Assignment amounts are used as-is in journal entries\n- Use for transfers between accounts or tax-exempt transactions\n\n### TAX_INCLUSIVE (Default for NZ)\n- Assignment amounts **include** tax\n- System automatically splits the amount into base and tax components\n- **Formula**: `baseAmount = amount / (1 + rate)`, `taxAmount = amount - baseAmount`\n- **Example**: $115 with GST 15% → $100 base + $15 GST\n- Common for expenses where you know the total paid (including GST)\n\n### TAX_EXCLUSIVE\n- Assignment amounts **exclude** tax\n- System adds tax on top of the specified amount\n- **Formula**: `taxAmount = amount × rate`, `totalAmount = amount + taxAmount`\n- **Example**: $1000 with GST 15% → $1000 base + $150 GST = $1150 total\n- Common for income where you invoice a base amount plus GST\n\n## Prerequisites — Finding Tax Codes and Account Codes\n\nBefore reconciling, you need two pieces of information:\n\n- **Account codes**: Retrieve the entity's chart of accounts via `GET /api/public/v1/entities/{entityId}/charts`. Use the `code` field (e.g., \"2030\") in the assignment `code` field below.\n- **Tax codes**: Retrieve the entity's tax rates via `GET /api/public/v1/entities` (filter by `entityId`). The `taxRates[].code` field (e.g., \"GST15\", \"EXEMPT\", \"ZERO\") is used in the assignment `taxCode` field below.\n\n## Integration Flow\n\n1. **GET `/entities`** - Retrieve entity with available `taxRates[]`\n2. **GET `/entities/{entityId}/transactions`** - List unreconciled transactions\n3. **POST `/entities/{entityId}/transactions/{transactionId}/reconcile`** - Reconcile with:\n   - Select appropriate account (from entity's chart of accounts)\n   - Select tax rate using `taxCode` from step 1\n   - Specify `taxMode` based on whether your amounts include/exclude tax\n4. System validates and creates journal entries with tax lines automatically\n\n## Important Notes\n\n- The transaction amount must equal the sum of assignment debits/credits\n- Each assignment line requires a valid `taxCode` from the entity's tax rates\n- Generated tax lines are automatically created and linked to parent lines\n- Use the entity's `defaultTaxAccountId` (GST account) for tax collection/payment\n",
        "tags": ["Transactions"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "transactionId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "assignment": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "taxCode": {
                          "type": "string"
                        },
                        "credit": {
                          "type": "number"
                        },
                        "debit": {
                          "type": "number"
                        },
                        "description": {
                          "type": "string"
                        },
                        "dimensionOptionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": ["code", "name", "taxCode"],
                      "additionalProperties": false
                    }
                  },
                  "narration": {
                    "type": "string"
                  },
                  "taxMode": {
                    "type": "string",
                    "enum": ["NO_TAX", "TAX_INCLUSIVE", "TAX_EXCLUSIVE"]
                  },
                  "fileIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": ["assignment"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "transactionId": {
                          "type": "string"
                        },
                        "journalId": {
                          "type": "string"
                        },
                        "logicalJournalId": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "transactionId",
                        "journalId",
                        "logicalJournalId"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["success", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation error or missing/invalid system account setup (SYSTEM_ACCOUNT_VALIDATION).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Transaction not found or already reconciled",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "transactions.reconcile",
        "x-sdk-resource": "transactions",
        "x-sdk-method": "reconcile"
      }
    },
    "/api/public/v1/entities/{entityId}/transactions/{transactionId}/reverse": {
      "post": {
        "summary": "Reverse a bank transaction reconciliation",
        "description": "Reverses a previously reconciled bank transaction, making it available for reconciliation again.\n\n## Business Rules\n\n- Only reconciled transactions can be reversed\n- Only bank reconciliation journals (AUTOMATIC type) can be reversed\n- The journal must be in POSTED status\n- The transaction must belong to the specified entity\n\n## What Happens During Reversal\n\n1. Creates a reversal journal entry that negates the original reconciliation\n2. Updates the reconciliation status to REVERSED\n3. Makes the bank transaction available for reconciliation again\n4. Maintains full audit trail of the reversal\n\n## Integration Flow\n\n1. **GET `/entities/{entityId}/transactions`** - Find reconciled transactions to reverse\n2. **POST `/entities/{entityId}/transactions/{transactionId}/reverse`** - Reverse the reconciliation\n3. The transaction becomes available for new reconciliation via the reconcile endpoint\n",
        "tags": ["Transactions"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "transactionId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reverseReason": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "transactionId": {
                          "type": "string"
                        },
                        "logicalJournalId": {
                          "type": "string"
                        },
                        "reversalJournalId": {
                          "type": "string"
                        },
                        "reversedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "reverseReason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "transactionId",
                        "logicalJournalId",
                        "reversalJournalId",
                        "reversedAt",
                        "reverseReason"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["success", "data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation error or transaction cannot be reversed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "notReconciled": {
                    "summary": "Transaction not reconciled",
                    "value": {
                      "error": "Transaction is not reconciled and cannot be reversed",
                      "code": "TRANSACTION_NOT_RECONCILED"
                    }
                  },
                  "wrongJournalType": {
                    "summary": "Wrong journal type",
                    "value": {
                      "error": "Only bank reconciliation journals can be reversed",
                      "code": "INVALID_JOURNAL_TYPE"
                    }
                  },
                  "alreadyReversed": {
                    "summary": "Already reversed",
                    "value": {
                      "error": "Transaction reconciliation has already been reversed",
                      "code": "ALREADY_REVERSED"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Transaction not found or access denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "The receipt can't be unmatched because some of its credit was refunded\n(`PAYMENT_REFUNDED`). Unmatch the refund first.\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "transactions.reverse",
        "x-sdk-resource": "transactions",
        "x-sdk-method": "reverse"
      }
    },
    "/api/public/v1/entities/{entityId}/transactions": {
      "get": {
        "summary": "List bank transactions",
        "description": "Returns paginated bank transactions for the specified entity with optional date range filtering. By default, transactions dated before the entity's conversion date are hidden, matching the app, and a dateFrom earlier than the conversion date is moved up to it. Pass `includePreConversion=true` to see them. Requires API key authentication and entity access.",
        "tags": ["Transactions"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "description": "Page number (starts at 1)",
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "description": "Number of items per page",
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 500
            }
          },
          {
            "name": "dateFrom",
            "in": "query",
            "required": false,
            "description": "Start date for filtering transactions (ISO 8601 format)",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2024-01-01"
            }
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": false,
            "description": "End date for filtering transactions (ISO 8601 format)",
            "schema": {
              "type": "string",
              "format": "date",
              "example": "2024-12-31"
            }
          },
          {
            "name": "includePreConversion",
            "in": "query",
            "required": false,
            "description": "Include transactions dated before the entity's conversion date (default false)",
            "schema": {
              "type": "string",
              "enum": ["true", "false"]
            }
          },
          {
            "name": "journalId",
            "in": "query",
            "required": false,
            "description": "Filter by journal ID to get transactions reconciled to a specific journal",
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "123e4567-e89b-12d3-a456-426614174000"
            }
          },
          {
            "name": "reconciliationStatus",
            "in": "query",
            "required": false,
            "description": "Filter by reconciliation status",
            "schema": {
              "type": "string",
              "enum": ["reconciled", "unreconciled"]
            }
          },
          {
            "name": "view",
            "in": "query",
            "required": false,
            "description": "`full` (default) returns each transaction with its bank account, linked GL account, user, merchant, category and suggestions in full.\n`compact` returns what coding needs: the transaction's own fields, the bank account's id and name, merchant and category names, the reconciliation status, and each suggestion's source, confidence, rule name and lines as account code, account name, tax code, proportion, debit and credit.\n",
            "schema": {
              "type": "string",
              "enum": ["full", "compact"],
              "default": "full"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "entityId": {
                                "type": "string",
                                "nullable": true
                              },
                              "reconciliationStatus": {
                                "type": "string",
                                "enum": ["reconciled", "unreconciled"]
                              },
                              "journalId": {
                                "type": "string",
                                "nullable": true
                              },
                              "bankAccount": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "entityId": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "externalId": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "alias": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "institution": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "accountNumber": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "logoUrl": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "type": {
                                    "type": "string"
                                  },
                                  "sourceType": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "entityAccount": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "updatedAt": {
                                        "type": "string"
                                      },
                                      "reportCategoryReviewedAt": {
                                        "type": "string",
                                        "nullable": true
                                      },
                                      "reportCategoryReviewVersion": {
                                        "type": "number"
                                      },
                                      "code": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "type": {
                                        "type": "string"
                                      },
                                      "subtype": {
                                        "type": "string"
                                      },
                                      "reportGroup": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "key": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          },
                                          "status": {
                                            "type": "string"
                                          },
                                          "accountType": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "key",
                                          "name",
                                          "status",
                                          "accountType"
                                        ],
                                        "additionalProperties": false,
                                        "nullable": true
                                      },
                                      "reportCategory": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "key": {
                                            "type": "string"
                                          },
                                          "name": {
                                            "type": "string"
                                          },
                                          "status": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "key",
                                          "name",
                                          "status"
                                        ],
                                        "additionalProperties": false,
                                        "nullable": true
                                      },
                                      "taxCode": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string",
                                        "nullable": true
                                      },
                                      "mappedCode": {
                                        "type": "string",
                                        "nullable": true
                                      },
                                      "isSystem": {
                                        "type": "boolean"
                                      },
                                      "systemRole": {
                                        "type": "string",
                                        "nullable": true
                                      },
                                      "parentId": {
                                        "type": "string",
                                        "nullable": true
                                      },
                                      "isExcluded": {
                                        "type": "boolean"
                                      },
                                      "isIncluded": {
                                        "type": "boolean"
                                      },
                                      "source": {
                                        "type": "string",
                                        "enum": [
                                          "template",
                                          "overridden",
                                          "custom"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "code",
                                      "name",
                                      "type",
                                      "subtype",
                                      "reportGroup",
                                      "reportCategory",
                                      "taxCode",
                                      "description",
                                      "mappedCode",
                                      "isSystem"
                                    ],
                                    "additionalProperties": false,
                                    "nullable": true
                                  }
                                },
                                "required": [
                                  "id",
                                  "entityId",
                                  "externalId",
                                  "name",
                                  "alias",
                                  "institution",
                                  "accountNumber",
                                  "logoUrl",
                                  "type",
                                  "sourceType",
                                  "entityAccount"
                                ],
                                "additionalProperties": false
                              },
                              "merchant": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "provider": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "identifier": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "name",
                                  "provider",
                                  "identifier"
                                ],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "category": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "identifier": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name", "identifier"],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "user": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "email": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "tradingName": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "createdAt": {
                                    "type": "string",
                                    "format": "date-time"
                                  }
                                },
                                "required": [
                                  "id",
                                  "email",
                                  "name",
                                  "tradingName",
                                  "createdAt"
                                ],
                                "additionalProperties": false
                              },
                              "suggestions": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "sourceType": {
                                      "type": "string"
                                    },
                                    "confidence": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "status": {
                                      "type": "string"
                                    },
                                    "ruleId": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "ruleName": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "lines": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "id": {
                                            "type": "string"
                                          },
                                          "proportion": {
                                            "type": "string",
                                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic.",
                                            "nullable": true
                                          },
                                          "credit": {
                                            "type": "string",
                                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                          },
                                          "debit": {
                                            "type": "string",
                                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                          },
                                          "entityAccountId": {
                                            "type": "string"
                                          },
                                          "entityAccount": {
                                            "type": "object",
                                            "properties": {
                                              "id": {
                                                "type": "string"
                                              },
                                              "code": {
                                                "type": "string"
                                              },
                                              "name": {
                                                "type": "string"
                                              }
                                            },
                                            "required": ["id", "code", "name"],
                                            "additionalProperties": false
                                          },
                                          "taxRateId": {
                                            "type": "string",
                                            "nullable": true
                                          },
                                          "taxRate": {
                                            "type": "object",
                                            "properties": {
                                              "id": {
                                                "type": "string"
                                              },
                                              "code": {
                                                "type": "string"
                                              },
                                              "name": {
                                                "type": "string"
                                              },
                                              "description": {
                                                "type": "string",
                                                "nullable": true
                                              },
                                              "rate": {
                                                "type": "string",
                                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                              }
                                            },
                                            "required": [
                                              "id",
                                              "code",
                                              "name",
                                              "description",
                                              "rate"
                                            ],
                                            "additionalProperties": false,
                                            "nullable": true
                                          }
                                        },
                                        "required": [
                                          "id",
                                          "proportion",
                                          "credit",
                                          "debit",
                                          "entityAccountId",
                                          "entityAccount",
                                          "taxRateId",
                                          "taxRate"
                                        ],
                                        "additionalProperties": false
                                      }
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "sourceType",
                                    "confidence",
                                    "status",
                                    "ruleId",
                                    "ruleName",
                                    "lines"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "id": {
                                "type": "string"
                              },
                              "date": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "amount": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "description": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "particulars": {
                                "type": "string",
                                "nullable": true
                              },
                              "code": {
                                "type": "string",
                                "nullable": true
                              },
                              "reference": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": [
                              "entityId",
                              "reconciliationStatus",
                              "journalId",
                              "bankAccount",
                              "merchant",
                              "category",
                              "user",
                              "id",
                              "date",
                              "amount",
                              "description",
                              "type",
                              "particulars",
                              "code",
                              "reference"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "bankAccount": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false
                              },
                              "merchant": {
                                "type": "string",
                                "nullable": true
                              },
                              "category": {
                                "type": "string",
                                "nullable": true
                              },
                              "reconciliationStatus": {
                                "type": "string",
                                "enum": ["reconciled", "unreconciled"]
                              },
                              "journalId": {
                                "type": "string",
                                "nullable": true
                              },
                              "suggestions": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "sourceType": {
                                      "type": "string"
                                    },
                                    "confidence": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "ruleName": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "lines": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "accountCode": {
                                            "type": "string"
                                          },
                                          "accountName": {
                                            "type": "string"
                                          },
                                          "taxCode": {
                                            "type": "string"
                                          },
                                          "proportion": {
                                            "type": "string",
                                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic.",
                                            "nullable": true
                                          },
                                          "debit": {
                                            "type": "string",
                                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                          },
                                          "credit": {
                                            "type": "string",
                                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                          }
                                        },
                                        "required": [
                                          "accountCode",
                                          "accountName",
                                          "taxCode",
                                          "proportion",
                                          "debit",
                                          "credit"
                                        ],
                                        "additionalProperties": false
                                      }
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "sourceType",
                                    "confidence",
                                    "ruleName",
                                    "lines"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "id": {
                                "type": "string"
                              },
                              "date": {
                                "type": "string",
                                "format": "date-time"
                              },
                              "amount": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "description": {
                                "type": "string"
                              },
                              "type": {
                                "type": "string"
                              },
                              "particulars": {
                                "type": "string",
                                "nullable": true
                              },
                              "code": {
                                "type": "string",
                                "nullable": true
                              },
                              "reference": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": [
                              "bankAccount",
                              "merchant",
                              "category",
                              "reconciliationStatus",
                              "journalId",
                              "suggestions",
                              "id",
                              "date",
                              "amount",
                              "description",
                              "type",
                              "particulars",
                              "code",
                              "reference"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "currentPage": {
                          "type": "number"
                        },
                        "pageSize": {
                          "type": "number"
                        },
                        "totalCount": {
                          "type": "number"
                        },
                        "totalPages": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        },
                        "hasPreviousPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "currentPage",
                        "pageSize",
                        "totalCount",
                        "totalPages",
                        "hasNextPage",
                        "hasPreviousPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data", "pagination"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - missing or invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "field": {
                      "type": "string"
                    },
                    "value": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden - No access to the specified entity",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "transactions.list",
        "x-sdk-resource": "transactions",
        "x-sdk-method": "list"
      }
    },
    "/api/public/v1/entities/{entityId}/trial-balance": {
      "get": {
        "summary": "Get trial balance report",
        "description": "Returns a trial balance report for the specified entity. Supports cumulative\nand movement modes, optional period comparisons, and flexible grouping.\n\n**Cumulative mode** (default): Balance sheet accounts show all-time cumulative\nbalances; P&L accounts show current financial year activity.\n\n**Movement mode**: Shows only journal activity within a specified date range\nfor all account types. Use `movementStartDate` and `movementEndDate` to specify\nthe range; when omitted the service defaults to the current financial year.\n",
        "tags": ["Reports"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "entityId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "asOfDate",
            "in": "query",
            "required": false,
            "description": "As-of date for cumulative mode. Defaults to today.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reportMode",
            "in": "query",
            "required": false,
            "description": "Report calculation mode",
            "schema": {
              "type": "string",
              "enum": ["cumulative", "movement"]
            }
          },
          {
            "name": "movementStartDate",
            "in": "query",
            "required": false,
            "description": "Start date for movement mode.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "movementEndDate",
            "in": "query",
            "required": false,
            "description": "End date for movement mode.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "groupBy",
            "in": "query",
            "required": false,
            "description": "How to group accounts. Use `reportGroup` for saved report groups in the entity's country order. Each group's `type` is its stable key and `name` is its label. Accounts without a saved group appear together under `unassigned`. Use `none` to group rows yourself.\n**Deprecated.** Use `groupBy=reportGroup` in place of `groupBy=subtype`.\n",
            "schema": {
              "type": "string",
              "enum": ["type", "subtype", "reportGroup", "none"]
            }
          },
          {
            "name": "includeZeroBalances",
            "in": "query",
            "required": false,
            "description": "Include accounts with zero balances",
            "schema": {
              "type": "string",
              "enum": ["false", "true"]
            }
          },
          {
            "name": "comparison",
            "in": "query",
            "required": false,
            "description": "Whether to include comparison columns",
            "schema": {
              "type": "string",
              "enum": ["none", "periods"]
            }
          },
          {
            "name": "comparisonType",
            "in": "query",
            "required": false,
            "description": "Type of comparison period. Used when comparison=periods.",
            "schema": {
              "type": "string",
              "enum": ["year", "month"]
            }
          },
          {
            "name": "comparisonPeriods",
            "in": "query",
            "required": false,
            "description": "Number of comparison periods (1-12). Used when comparison=periods.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "compareToEndOfMonth",
            "in": "query",
            "required": false,
            "description": "Snap comparison dates to end of month",
            "schema": {
              "type": "string",
              "enum": ["false", "true"]
            }
          },
          {
            "name": "compareToEndOfFinancialYear",
            "in": "query",
            "required": false,
            "description": "Snap comparison dates to end of financial year (31 March)",
            "schema": {
              "type": "string",
              "enum": ["false", "true"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "entityId": {
                              "type": "string"
                            },
                            "entityName": {
                              "type": "string"
                            },
                            "generatedAt": {
                              "type": "string"
                            },
                            "currency": {
                              "type": "string"
                            },
                            "timezone": {
                              "type": "string"
                            },
                            "reportType": {
                              "type": "string",
                              "enum": ["trial-balance"]
                            },
                            "asOfDate": {
                              "type": "string"
                            },
                            "movementStartDate": {
                              "type": "string"
                            },
                            "movementEndDate": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "entityId",
                            "entityName",
                            "generatedAt",
                            "currency",
                            "timezone",
                            "reportType",
                            "asOfDate"
                          ],
                          "additionalProperties": false
                        },
                        "totals": {
                          "type": "object",
                          "properties": {
                            "totalDebits": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "totalCredits": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "isBalanced": {
                              "type": "boolean"
                            },
                            "variance": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            }
                          },
                          "required": [
                            "totalDebits",
                            "totalCredits",
                            "isBalanced",
                            "variance"
                          ],
                          "additionalProperties": false
                        },
                        "accountGroups": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "accounts": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "accountId": {
                                      "type": "string"
                                    },
                                    "accountCode": {
                                      "type": "string"
                                    },
                                    "accountName": {
                                      "type": "string"
                                    },
                                    "accountType": {
                                      "type": "string",
                                      "enum": [
                                        "Equity",
                                        "Revenue",
                                        "Expense",
                                        "Asset",
                                        "Liability"
                                      ]
                                    },
                                    "accountSubtype": {
                                      "type": "string"
                                    },
                                    "reportGroupKey": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "reportGroupName": {
                                      "type": "string"
                                    },
                                    "reportCategoryKey": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "reportGroup": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": ["key", "name"],
                                      "additionalProperties": false,
                                      "nullable": true
                                    },
                                    "reportCategory": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": ["key", "name"],
                                      "additionalProperties": false,
                                      "nullable": true
                                    },
                                    "debitBalance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "creditBalance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "netBalance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "totalCredit": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "totalDebit": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "isSystemGenerated": {
                                      "type": "boolean"
                                    },
                                    "earningsType": {
                                      "type": "string",
                                      "enum": ["retained"],
                                      "nullable": true
                                    }
                                  },
                                  "required": [
                                    "accountId",
                                    "accountCode",
                                    "accountName",
                                    "accountType",
                                    "accountSubtype",
                                    "debitBalance",
                                    "creditBalance",
                                    "netBalance",
                                    "totalCredit",
                                    "totalDebit"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "subtotal": {
                                "type": "object",
                                "properties": {
                                  "debits": {
                                    "type": "string",
                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                  },
                                  "credits": {
                                    "type": "string",
                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                  },
                                  "net": {
                                    "type": "string",
                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                  }
                                },
                                "required": ["debits", "credits", "net"],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "type",
                              "name",
                              "accounts",
                              "subtotal"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": ["metadata", "totals", "accountGroups"],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "metadata": {
                          "type": "object",
                          "properties": {
                            "entityId": {
                              "type": "string"
                            },
                            "entityName": {
                              "type": "string"
                            },
                            "generatedAt": {
                              "type": "string"
                            },
                            "currency": {
                              "type": "string"
                            },
                            "timezone": {
                              "type": "string"
                            },
                            "reportType": {
                              "type": "string",
                              "enum": ["trial-balance-comparison"]
                            },
                            "asOfDate": {
                              "type": "string"
                            },
                            "comparisonPeriods": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "comparisonPeriodDates": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "comparisonType": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "entityId",
                            "entityName",
                            "generatedAt",
                            "currency",
                            "timezone",
                            "reportType",
                            "asOfDate",
                            "comparisonPeriods",
                            "comparisonType"
                          ],
                          "additionalProperties": false
                        },
                        "totals": {
                          "type": "object",
                          "properties": {
                            "totalDebits": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "totalCredits": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            },
                            "isBalanced": {
                              "type": "boolean"
                            },
                            "variance": {
                              "type": "string",
                              "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                            }
                          },
                          "required": [
                            "totalDebits",
                            "totalCredits",
                            "isBalanced",
                            "variance"
                          ],
                          "additionalProperties": false
                        },
                        "comparisonTotals": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "totalDebits": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "totalCredits": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              },
                              "isBalanced": {
                                "type": "boolean"
                              },
                              "variance": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              }
                            },
                            "required": [
                              "totalDebits",
                              "totalCredits",
                              "isBalanced",
                              "variance"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "accountGroups": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "accounts": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "comparisonPeriods": {
                                      "type": "object",
                                      "properties": {},
                                      "additionalProperties": {
                                        "type": "object",
                                        "properties": {
                                          "debitBalance": {
                                            "type": "string",
                                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                          },
                                          "creditBalance": {
                                            "type": "string",
                                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                          },
                                          "netBalance": {
                                            "type": "string",
                                            "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                          }
                                        },
                                        "required": [
                                          "debitBalance",
                                          "creditBalance",
                                          "netBalance"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "accountId": {
                                      "type": "string"
                                    },
                                    "accountCode": {
                                      "type": "string"
                                    },
                                    "accountName": {
                                      "type": "string"
                                    },
                                    "accountType": {
                                      "type": "string",
                                      "enum": [
                                        "Equity",
                                        "Revenue",
                                        "Expense",
                                        "Asset",
                                        "Liability"
                                      ]
                                    },
                                    "accountSubtype": {
                                      "type": "string"
                                    },
                                    "reportGroupKey": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "reportGroupName": {
                                      "type": "string"
                                    },
                                    "reportCategoryKey": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "reportGroup": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": ["key", "name"],
                                      "additionalProperties": false,
                                      "nullable": true
                                    },
                                    "reportCategory": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        }
                                      },
                                      "required": ["key", "name"],
                                      "additionalProperties": false,
                                      "nullable": true
                                    },
                                    "debitBalance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "creditBalance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "netBalance": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "totalCredit": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "totalDebit": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "isSystemGenerated": {
                                      "type": "boolean"
                                    },
                                    "earningsType": {
                                      "type": "string",
                                      "enum": ["retained"],
                                      "nullable": true
                                    }
                                  },
                                  "required": [
                                    "comparisonPeriods",
                                    "accountId",
                                    "accountCode",
                                    "accountName",
                                    "accountType",
                                    "accountSubtype",
                                    "debitBalance",
                                    "creditBalance",
                                    "netBalance",
                                    "totalCredit",
                                    "totalDebit"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "subtotal": {
                                "type": "object",
                                "properties": {
                                  "debits": {
                                    "type": "string",
                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                  },
                                  "credits": {
                                    "type": "string",
                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                  },
                                  "net": {
                                    "type": "string",
                                    "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                  }
                                },
                                "required": ["debits", "credits", "net"],
                                "additionalProperties": false
                              },
                              "comparisonSubtotals": {
                                "type": "object",
                                "properties": {},
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "debits": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "credits": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    },
                                    "net": {
                                      "type": "string",
                                      "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                    }
                                  },
                                  "required": ["debits", "credits", "net"],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "type",
                              "name",
                              "accounts",
                              "subtotal",
                              "comparisonSubtotals"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "metadata",
                        "totals",
                        "comparisonTotals",
                        "accountGroups"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid query parameters or missing/invalid system account setup (SYSTEM_ACCOUNT_VALIDATION)."
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "403": {
            "description": "Forbidden - No access to the specified entity"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "reports.trialBalance",
        "x-sdk-resource": "reports",
        "x-sdk-method": "trialBalance"
      }
    },
    "/api/public/v1/entities": {
      "get": {
        "summary": "List entities",
        "description": "Returns all entities that the authenticated user has access to within their workspace. Optionally filter by entity ID or client ID.\n\n**Important**: This endpoint is the primary source for entity-level reference data including:\n- `taxRates[]` — Available tax rates (GST codes) for each entity. Use `taxRates[].code` when reconciling transactions or creating chart accounts.\n- `bankAccounts[]` — Linked bank accounts for each entity. Each bank account includes its linked GL account at `bankAccounts[].entityAccount` (use `entityAccount.id` when posting journals or reconciling against the bank).\n- `clients[]` — Client users associated with each entity.\n\n**Chart of accounts**: The `currentTemplateId` field references the *template* the entity was provisioned from — it is **not** the entity's actual chart of accounts. To fetch the entity's GL accounts (including bank-account-linked accounts and any custom accounts), call `GET /api/public/v1/entities/{entityId}/charts`.\n",
        "tags": ["Entities"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "entityId",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter entities by specific entity ID"
          },
          {
            "in": "query",
            "name": "clientId",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Filter entities by client user ID (returns entities where the user is a member)"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "currentTemplateId": {
                            "type": "string",
                            "nullable": true
                          },
                          "defaultTaxAccountId": {
                            "type": "string",
                            "nullable": true
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "isGstRegistered": {
                            "type": "boolean",
                            "nullable": true
                          },
                          "gstPeriodMonths": {
                            "type": "number",
                            "nullable": true
                          },
                          "gstBasis": {
                            "type": "string",
                            "nullable": true
                          },
                          "financialYearStartMonth": {
                            "type": "number"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "bankAccounts": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "entityId": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "externalId": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "alias": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "institution": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "accountNumber": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "logoUrl": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "type": {
                                  "type": "string"
                                },
                                "sourceType": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "entityAccount": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "updatedAt": {
                                      "type": "string"
                                    },
                                    "reportCategoryReviewedAt": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "reportCategoryReviewVersion": {
                                      "type": "number"
                                    },
                                    "code": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    },
                                    "type": {
                                      "type": "string"
                                    },
                                    "subtype": {
                                      "type": "string"
                                    },
                                    "reportGroup": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "key": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        },
                                        "status": {
                                          "type": "string"
                                        },
                                        "accountType": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "key",
                                        "name",
                                        "status",
                                        "accountType"
                                      ],
                                      "additionalProperties": false,
                                      "nullable": true
                                    },
                                    "reportCategory": {
                                      "type": "object",
                                      "properties": {
                                        "id": {
                                          "type": "string"
                                        },
                                        "key": {
                                          "type": "string"
                                        },
                                        "name": {
                                          "type": "string"
                                        },
                                        "status": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "id",
                                        "key",
                                        "name",
                                        "status"
                                      ],
                                      "additionalProperties": false,
                                      "nullable": true
                                    },
                                    "taxCode": {
                                      "type": "string"
                                    },
                                    "description": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "mappedCode": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "isSystem": {
                                      "type": "boolean"
                                    },
                                    "systemRole": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "parentId": {
                                      "type": "string",
                                      "nullable": true
                                    },
                                    "isExcluded": {
                                      "type": "boolean"
                                    },
                                    "isIncluded": {
                                      "type": "boolean"
                                    },
                                    "source": {
                                      "type": "string",
                                      "enum": [
                                        "template",
                                        "overridden",
                                        "custom"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "code",
                                    "name",
                                    "type",
                                    "subtype",
                                    "reportGroup",
                                    "reportCategory",
                                    "taxCode",
                                    "description",
                                    "mappedCode",
                                    "isSystem"
                                  ],
                                  "additionalProperties": false,
                                  "nullable": true
                                }
                              },
                              "required": [
                                "id",
                                "entityId",
                                "externalId",
                                "name",
                                "alias",
                                "institution",
                                "accountNumber",
                                "logoUrl",
                                "type",
                                "sourceType",
                                "entityAccount"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "clients": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "email": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "tradingName": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "createdAt": {
                                  "type": "string",
                                  "format": "date-time"
                                }
                              },
                              "required": [
                                "id",
                                "email",
                                "name",
                                "tradingName",
                                "createdAt"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "taxRates": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "code": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "description": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "rate": {
                                  "type": "string",
                                  "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                                }
                              },
                              "required": [
                                "id",
                                "code",
                                "name",
                                "description",
                                "rate"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "type",
                          "currentTemplateId",
                          "defaultTaxAccountId",
                          "createdAt",
                          "isGstRegistered",
                          "gstPeriodMonths",
                          "gstBasis",
                          "financialYearStartMonth",
                          "currency",
                          "bankAccounts",
                          "clients",
                          "taxRates"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "entities.list",
        "x-sdk-resource": "entities",
        "x-sdk-method": "list"
      },
      "post": {
        "summary": "Create an entity",
        "description": "Creates a new entity in the workspace associated with the API key. Supports full entity configuration including GST settings, client assignment, and bank account linking.",
        "tags": ["Entities"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "accountTemplateId": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "individual",
                      "company",
                      "trust",
                      "partnership",
                      "rental",
                      "other"
                    ]
                  },
                  "name": {
                    "type": "string"
                  },
                  "workspaceDimensionIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "isGstRegistered": {
                    "type": "boolean"
                  },
                  "areGstReportsAutomated": {
                    "type": "boolean"
                  },
                  "gstNumber": {
                    "type": "string"
                  },
                  "irdNumber": {
                    "type": "string"
                  },
                  "gstPeriod": {
                    "type": "string",
                    "enum": ["2", "1", "3", "6", "12"]
                  },
                  "gstFilingStartDate": {
                    "type": "string"
                  },
                  "nzbn": {
                    "type": "string"
                  },
                  "industryCode": {
                    "type": "string"
                  },
                  "conversionDate": {
                    "type": "string",
                    "nullable": true
                  },
                  "clientIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "bankAccountIds": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "isDemo": {
                    "type": "boolean"
                  },
                  "demoType": {
                    "type": "string"
                  },
                  "parties": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "roles": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "enum": [
                              "other",
                              "director",
                              "shareholder",
                              "trustee",
                              "partner",
                              "beneficiary",
                              "settlor",
                              "owner"
                            ]
                          }
                        },
                        "id": {
                          "type": "string"
                        },
                        "isOrganisation": {
                          "type": "boolean"
                        },
                        "nzbn": {
                          "type": "string"
                        },
                        "shares": {
                          "type": "number"
                        },
                        "source": {
                          "type": "string",
                          "enum": ["manual", "nzbn"]
                        },
                        "sourceReferences": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "source": {
                                "type": "string",
                                "enum": ["nzbn-role"]
                              },
                              "sourceEntityNzbn": {
                                "type": "string"
                              },
                              "uniqueIdentifier": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "source",
                              "sourceEntityNzbn",
                              "uniqueIdentifier"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": ["name", "roles"],
                      "additionalProperties": false
                    }
                  },
                  "registeredAddress": {
                    "type": "string"
                  },
                  "postalAddress": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string"
                  },
                  "website": {
                    "type": "string"
                  },
                  "tradingNames": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "registrationDate": {
                    "type": "string"
                  },
                  "entityStatus": {
                    "type": "string"
                  },
                  "entityTypeDescription": {
                    "type": "string"
                  },
                  "companyNumber": {
                    "type": "string"
                  }
                },
                "required": ["accountTemplateId", "type", "name"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "type": {
                          "type": "string"
                        },
                        "currentTemplateId": {
                          "type": "string",
                          "nullable": true
                        },
                        "defaultTaxAccountId": {
                          "type": "string",
                          "nullable": true
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "isGstRegistered": {
                          "type": "boolean",
                          "nullable": true
                        },
                        "gstPeriodMonths": {
                          "type": "number",
                          "nullable": true
                        },
                        "gstBasis": {
                          "type": "string",
                          "nullable": true
                        },
                        "financialYearStartMonth": {
                          "type": "number"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "bankAccounts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "entityId": {
                                "type": "string",
                                "nullable": true
                              },
                              "externalId": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "alias": {
                                "type": "string",
                                "nullable": true
                              },
                              "institution": {
                                "type": "string",
                                "nullable": true
                              },
                              "accountNumber": {
                                "type": "string",
                                "nullable": true
                              },
                              "logoUrl": {
                                "type": "string",
                                "nullable": true
                              },
                              "type": {
                                "type": "string"
                              },
                              "sourceType": {
                                "type": "string",
                                "nullable": true
                              },
                              "entityAccount": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "updatedAt": {
                                    "type": "string"
                                  },
                                  "reportCategoryReviewedAt": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "reportCategoryReviewVersion": {
                                    "type": "number"
                                  },
                                  "code": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "type": "string"
                                  },
                                  "subtype": {
                                    "type": "string"
                                  },
                                  "reportGroup": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "key": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "status": {
                                        "type": "string"
                                      },
                                      "accountType": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "key",
                                      "name",
                                      "status",
                                      "accountType"
                                    ],
                                    "additionalProperties": false,
                                    "nullable": true
                                  },
                                  "reportCategory": {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "key": {
                                        "type": "string"
                                      },
                                      "name": {
                                        "type": "string"
                                      },
                                      "status": {
                                        "type": "string"
                                      }
                                    },
                                    "required": ["id", "key", "name", "status"],
                                    "additionalProperties": false,
                                    "nullable": true
                                  },
                                  "taxCode": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "mappedCode": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "isSystem": {
                                    "type": "boolean"
                                  },
                                  "systemRole": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "parentId": {
                                    "type": "string",
                                    "nullable": true
                                  },
                                  "isExcluded": {
                                    "type": "boolean"
                                  },
                                  "isIncluded": {
                                    "type": "boolean"
                                  },
                                  "source": {
                                    "type": "string",
                                    "enum": ["template", "overridden", "custom"]
                                  }
                                },
                                "required": [
                                  "id",
                                  "code",
                                  "name",
                                  "type",
                                  "subtype",
                                  "reportGroup",
                                  "reportCategory",
                                  "taxCode",
                                  "description",
                                  "mappedCode",
                                  "isSystem"
                                ],
                                "additionalProperties": false,
                                "nullable": true
                              }
                            },
                            "required": [
                              "id",
                              "entityId",
                              "externalId",
                              "name",
                              "alias",
                              "institution",
                              "accountNumber",
                              "logoUrl",
                              "type",
                              "sourceType",
                              "entityAccount"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "clients": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "email": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string",
                                "nullable": true
                              },
                              "tradingName": {
                                "type": "string",
                                "nullable": true
                              },
                              "createdAt": {
                                "type": "string",
                                "format": "date-time"
                              }
                            },
                            "required": [
                              "id",
                              "email",
                              "name",
                              "tradingName",
                              "createdAt"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "taxRates": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string",
                                "nullable": true
                              },
                              "rate": {
                                "type": "string",
                                "description": "Exact decimal serialized as a string. Use Decimal.js for arithmetic."
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name",
                              "description",
                              "rate"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "type",
                        "currentTemplateId",
                        "defaultTaxAccountId",
                        "createdAt",
                        "isGstRegistered",
                        "gstPeriodMonths",
                        "gstBasis",
                        "financialYearStartMonth",
                        "currency",
                        "bankAccounts",
                        "clients",
                        "taxRates"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation failed, or system account setup is missing or invalid (SYSTEM_ACCOUNT_VALIDATION).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "details": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden. Either the token is scoped to a single entity\n(`TOKEN_ENTITY_SCOPE`), or the token's workspace role is not a firm\nstaff role — advisor, admin or workspace owner (`INSUFFICIENT_ROLE`).\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Workspace not found or access denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "One or more of the supplied `bankAccountIds` is already linked to a\ndifferent entity (`BANK_ACCOUNT_ASSIGNED_TO_DIFFERENT_ENTITY`). Bank\naccounts may only be linked while unassigned.\n",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "entities.create",
        "x-sdk-resource": "entities",
        "x-sdk-method": "create",
        "parameters": []
      }
    },
    "/api/public/v1/extensions/{extensionId}/http": {
      "post": {
        "summary": "Make an outbound request through an extension connection",
        "description": "Performs one guarded HTTP request to a third party on behalf of an\nextension. The credential for the named connection is attached\nserver-side — the caller never supplies or receives it.\n\nRequires a token minted for the extension named in the path. API keys\nand ordinary user tokens are rejected.\n\nRequires an extension-scoped token whose ext_id matches extensionId. Ordinary API keys and user OAuth tokens cannot call this endpoint. The embedded status/ok describe the upstream response, which can fail inside HTTP 200.",
        "tags": ["Extensions"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "number"
                    },
                    "ok": {
                      "type": "boolean"
                    },
                    "headers": {
                      "type": "object",
                      "properties": {},
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "body": {}
                  },
                  "required": ["status", "ok", "headers", "body"],
                  "additionalProperties": false
                }
              }
            }
          },
          "403": {
            "description": "The token is not for this extension, or the host is not allowed"
          },
          "409": {
            "description": "The connection is not connected"
          }
        },
        "operationId": "extensions.request",
        "x-sdk-resource": "extensions",
        "x-sdk-method": "request",
        "parameters": [
          {
            "in": "path",
            "name": "extensionId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "connection": {
                    "type": "string"
                  },
                  "path": {
                    "type": "string"
                  },
                  "method": {
                    "type": "string"
                  },
                  "headers": {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": {
                      "type": "string"
                    }
                  },
                  "body": {},
                  "timeoutMs": {
                    "type": "number"
                  },
                  "entityId": {
                    "type": "string"
                  }
                },
                "required": ["connection", "path"],
                "additionalProperties": false
              }
            }
          }
        }
      }
    },
    "/api/public/v1/global-accounts": {
      "get": {
        "summary": "List all global accounts",
        "description": "Returns the full system account library (global accounts). These are the master accounts from which templates are built. Requires API key authentication.",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string",
                            "nullable": true
                          },
                          "type": {
                            "type": "string"
                          },
                          "subtype": {
                            "type": "string"
                          },
                          "isSystem": {
                            "type": "boolean"
                          },
                          "taxCode": {
                            "type": "string",
                            "nullable": true
                          },
                          "metadata": {}
                        },
                        "required": [
                          "id",
                          "code",
                          "name",
                          "description",
                          "type",
                          "subtype",
                          "isSystem",
                          "taxCode",
                          "metadata"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          }
        },
        "operationId": "globalAccounts.list",
        "x-sdk-resource": "globalAccounts",
        "x-sdk-method": "list",
        "parameters": []
      }
    },
    "/api/public/v1/gst-returns": {
      "get": {
        "summary": "List GST returns across the workspace",
        "description": "Returns paginated GST returns for every entity in the workspace the\ncaller can see, newest period first. The entity-scoped endpoint\n(`/entities/{entityId}/gst-returns`) returns the same rows for one\nentity; use `entityId` here to narrow without changing endpoint.\n\nEach row carries the return's lifecycle status, its period, its filing due date,\nits net GST position (IRD Box 15) and a count of bank transactions in the period\nthat are not yet reconciled.\n\n**Box 15 is only present once the return has been calculated.** A draft that has\nnever been finalised reports `netGstPosition: null`. Use the entity detail endpoint\nto get live, calculated box amounts for a draft.\n\n**Period and due dates are New Zealand calendar days** (`YYYY-MM-DD`), not UTC\ninstants. A GST period runs from the first moment of `dateFrom` to the last moment\nof `dateTo`, both in NZ time.\n\nBy default, draft returns whose period has not started yet are hidden, matching\nwhat the Prosaic UI shows. Pass `includeFutureDrafts=true` to see them.\n",
        "tags": ["GST Returns"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return only GST returns for this entity"
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "description": "Return only GST returns in these lifecycle statuses. Repeatable, and\na comma-separated list means the same thing — `?status=draft&status=filed`\nand `?status=draft,filed` are equivalent. Omit for every status;\nnothing is filtered out by default, so completed returns appear\nalongside outstanding ones. To see only live work, list the seven\nstatuses other than `completed`.\n",
            "style": "form"
          },
          {
            "name": "dateFrom",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return only GST returns whose period ends on or after this NZ date"
          },
          {
            "name": "dateTo",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return only GST returns whose period starts on or before this NZ date"
          },
          {
            "name": "dueAfter",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return only GST returns due on or after this NZ date"
          },
          {
            "name": "dueBefore",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return only GST returns due on or before this NZ date"
          },
          {
            "name": "includeFutureDrafts",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["false", "true"]
            },
            "description": "Include draft returns whose period has not started yet (default false)"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Page number (default 1)"
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            },
            "description": "Items per page (default 100)"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "rejected",
                              "completed",
                              "draft",
                              "finalised",
                              "filed",
                              "filed_externally",
                              "accepted",
                              "awaiting_payment"
                            ]
                          },
                          "dateFrom": {
                            "type": "string"
                          },
                          "dateTo": {
                            "type": "string"
                          },
                          "dueDate": {
                            "type": "string"
                          },
                          "isOverdue": {
                            "type": "boolean"
                          },
                          "netGstPosition": {
                            "type": "number",
                            "nullable": true
                          },
                          "unreconciledTransactionCount": {
                            "type": "number"
                          },
                          "hasAmendment": {
                            "type": "boolean"
                          },
                          "finalisedAt": {
                            "type": "string",
                            "nullable": true
                          },
                          "irdFiledAt": {
                            "type": "string",
                            "nullable": true
                          },
                          "updatedAt": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "name",
                          "description",
                          "status",
                          "dateFrom",
                          "dateTo",
                          "dueDate",
                          "isOverdue",
                          "netGstPosition",
                          "unreconciledTransactionCount",
                          "hasAmendment",
                          "finalisedAt",
                          "irdFiledAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "currentPage": {
                          "type": "number"
                        },
                        "pageSize": {
                          "type": "number"
                        },
                        "totalCount": {
                          "type": "number"
                        },
                        "totalPages": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        },
                        "hasPreviousPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "currentPage",
                        "pageSize",
                        "totalCount",
                        "totalPages",
                        "hasNextPage",
                        "hasPreviousPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data", "pagination"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "An entity-scoped token asked for an entity it is not pinned to",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Workspace not found or not accessible with these credentials",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ApiErrorResponse"
                }
              }
            }
          }
        },
        "operationId": "gstReturns.list",
        "x-sdk-resource": "gstReturns",
        "x-sdk-method": "list"
      }
    },
    "/api/public/v1/invoices": {
      "get": {
        "summary": "List invoices",
        "description": "Returns invoices in the active workspace that the authenticated user can\naccess. Results are paginated and can be narrowed by client or entity.\nWhen both filters are supplied, an invoice must match both.\n",
        "tags": ["Invoices"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "entityId",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return invoices for one entity."
          },
          {
            "in": "query",
            "name": "clientId",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return invoices whose entity is associated with this client user."
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "type": "string",
              "enum": ["DRAFT", "FINALISED", "PAID", "VOIDED"]
            },
            "description": "Filter by persisted invoice lifecycle status."
          },
          {
            "in": "query",
            "name": "updatedSince",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Return invoices updated on or after this ISO 8601 timestamp."
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "in": "query",
            "name": "pageSize",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 20,
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string"
                          },
                          "workspaceId": {
                            "type": "string"
                          },
                          "fileId": {
                            "type": "string",
                            "nullable": true
                          },
                          "invoiceNumber": {
                            "type": "string",
                            "nullable": true
                          },
                          "status": {
                            "type": "string"
                          },
                          "taxMode": {
                            "type": "string"
                          },
                          "issueDate": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "dueDate": {
                            "type": "string",
                            "format": "date-time",
                            "nullable": true
                          },
                          "sentAt": {
                            "type": "string",
                            "format": "date-time",
                            "nullable": true
                          },
                          "recipientName": {
                            "type": "string"
                          },
                          "recipientEmail": {
                            "type": "string",
                            "nullable": true
                          },
                          "recipientAddress": {
                            "type": "string",
                            "nullable": true
                          },
                          "bankAccountId": {
                            "type": "string",
                            "nullable": true
                          },
                          "bankAccountName": {
                            "type": "string",
                            "nullable": true
                          },
                          "subtotal": {
                            "type": "number"
                          },
                          "taxTotal": {
                            "type": "number"
                          },
                          "total": {
                            "type": "number"
                          },
                          "amountDue": {
                            "type": "number",
                            "nullable": true
                          },
                          "notes": {
                            "type": "string",
                            "nullable": true
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "lines": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "description": {
                                  "type": "string"
                                },
                                "quantity": {
                                  "type": "number"
                                },
                                "unitPrice": {
                                  "type": "number"
                                },
                                "taxRate": {
                                  "type": "number"
                                },
                                "taxRateCode": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "entityAccountId": {
                                  "type": "string",
                                  "nullable": true
                                },
                                "amount": {
                                  "type": "number"
                                },
                                "taxAmount": {
                                  "type": "number"
                                },
                                "position": {
                                  "type": "number"
                                }
                              },
                              "required": [
                                "id",
                                "description",
                                "quantity",
                                "unitPrice",
                                "taxRate",
                                "taxRateCode",
                                "entityAccountId",
                                "amount",
                                "taxAmount",
                                "position"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "id",
                          "entityId",
                          "workspaceId",
                          "fileId",
                          "invoiceNumber",
                          "status",
                          "taxMode",
                          "issueDate",
                          "dueDate",
                          "sentAt",
                          "recipientName",
                          "recipientEmail",
                          "recipientAddress",
                          "bankAccountId",
                          "bankAccountName",
                          "subtotal",
                          "taxTotal",
                          "total",
                          "amountDue",
                          "notes",
                          "createdAt",
                          "updatedAt",
                          "lines"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "currentPage": {
                          "type": "number"
                        },
                        "pageSize": {
                          "type": "number"
                        },
                        "totalCount": {
                          "type": "number"
                        },
                        "totalPages": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        },
                        "hasPreviousPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "currentPage",
                        "pageSize",
                        "totalCount",
                        "totalPages",
                        "hasNextPage",
                        "hasPreviousPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data", "pagination"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid query parameters."
          },
          "401": {
            "description": "Unauthorized."
          },
          "403": {
            "description": "Insufficient role."
          },
          "404": {
            "description": "Workspace not found."
          },
          "500": {
            "description": "Internal server error."
          }
        },
        "operationId": "invoices.list",
        "x-sdk-resource": "invoices",
        "x-sdk-method": "list"
      }
    },
    "/api/public/v1/me": {
      "get": {
        "summary": "Get current user information",
        "description": "Returns the authenticated user's information including their workspaces\nand whether they have connected bank accounts.\n\nThis endpoint is intended for the Expenses app to determine:\n- User type (accountant vs individual) based on workspace roles\n- Whether to prompt for bank account connection\n- Which workspaces/clients the user has access to\n",
        "tags": ["User"],
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "OAuth2": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string",
                          "nullable": true
                        },
                        "workspaces": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "role": {
                                "type": "string",
                                "enum": [
                                  "client",
                                  "standard_user",
                                  "admin",
                                  "accountant",
                                  "advisor",
                                  "workspace_owner"
                                ]
                              },
                              "subscriptionState": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name",
                              "role",
                              "subscriptionState"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "hasConnectedBankAccounts": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "id",
                        "email",
                        "name",
                        "workspaces",
                        "hasConnectedBankAccounts"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key/token",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "User not found",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "me.retrieve",
        "x-sdk-resource": "me",
        "x-sdk-method": "retrieve",
        "parameters": []
      }
    },
    "/api/public/v1/report-categories": {
      "get": {
        "summary": "List report groups and categories for the authorised workspace",
        "description": "Returns the complete stored taxonomy for the authorised workspace's country. Parent IDs and sort order describe the group tree. Headings are structure only; isAssignable=false prevents their selection. An ordinary group may allow a null category, but bank and asset-account functions can still require one. Category placements are exact, not inherited.\nExamples: Operating expenses (exp.operating) is assignable with no category; Retained earnings (equ.retainedearnings) also permits a null category. Expenses (exp) is a heading and cannot be assigned. This endpoint does not change accounts. No country parameter or pagination is required.\n",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string"
                        },
                        "legacyDefaults": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "globalAccountId": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "groupKey": {
                                "type": "string"
                              },
                              "categoryKey": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": [
                              "globalAccountId",
                              "code",
                              "groupKey",
                              "categoryKey"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "groups": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "key": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "accountType": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string",
                                "nullable": true
                              },
                              "parentId": {
                                "type": "string",
                                "nullable": true
                              },
                              "sortOrder": {
                                "type": "number"
                              },
                              "isHeading": {
                                "type": "boolean"
                              },
                              "isAssignable": {
                                "type": "boolean"
                              },
                              "allowGroupOnly": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "key",
                              "name",
                              "status",
                              "accountType",
                              "description",
                              "parentId",
                              "sortOrder",
                              "isHeading",
                              "isAssignable",
                              "allowGroupOnly"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "categories": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "key": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "codingGuidance": {
                                "type": "string",
                                "nullable": true
                              },
                              "defaultGroupId": {
                                "type": "string"
                              },
                              "allowedGroupIds": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": [
                              "id",
                              "key",
                              "name",
                              "status",
                              "description",
                              "codingGuidance",
                              "defaultGroupId",
                              "allowedGroupIds"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "workspaceId": {
                          "type": "string"
                        },
                        "reportingInputsEnabled": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "country",
                        "groups",
                        "categories",
                        "workspaceId",
                        "reportingInputsEnabled"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid entity ID"
          },
          "401": {
            "description": "Missing or invalid bearer authentication"
          },
          "403": {
            "description": "Bearer token is pinned to another entity"
          },
          "404": {
            "description": "Entity not found or access denied"
          },
          "500": {
            "description": "Unexpected failure loading the taxonomy"
          },
          "503": {
            "description": "Permission service temporarily unavailable"
          }
        },
        "operationId": "reportCategories.listForWorkspace",
        "x-sdk-resource": "reportCategories",
        "x-sdk-method": "listForWorkspace",
        "parameters": []
      }
    },
    "/api/public/v1": {
      "get": {
        "summary": "API version information",
        "description": "Returns information about the Prosaic Public API v1",
        "tags": ["Version"],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": ["version", "name", "status"],
                  "additionalProperties": false
                }
              }
            }
          }
        },
        "operationId": "version.retrieve",
        "x-sdk-resource": "version",
        "x-sdk-method": "retrieve",
        "parameters": []
      }
    },
    "/api/public/v1/rules/{ruleId}": {
      "get": {
        "summary": "Get a rule by ID",
        "tags": ["Rules"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "ruleId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        },
                        "isActive": {
                          "type": "boolean"
                        },
                        "targetType": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "conditions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "field": {
                                "type": "string"
                              },
                              "operator": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "secondValue": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": [
                              "id",
                              "field",
                              "operator",
                              "value",
                              "secondValue"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "actions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "actionType": {
                                "type": "string"
                              },
                              "payload": {}
                            },
                            "required": ["id", "actionType", "payload"],
                            "additionalProperties": false
                          }
                        },
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "scopeType": {
                                "type": "string"
                              },
                              "entity": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "bankAccount": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "accountTemplate": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false,
                                "nullable": true
                              }
                            },
                            "required": [
                              "id",
                              "scopeType",
                              "entity",
                              "bankAccount",
                              "accountTemplate"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "description",
                        "isActive",
                        "targetType",
                        "createdAt",
                        "updatedAt",
                        "conditions",
                        "actions",
                        "scopes"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid rule ID"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Insufficient role"
          },
          "404": {
            "description": "Rule or workspace not found"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "rules.retrieve",
        "x-sdk-resource": "rules",
        "x-sdk-method": "retrieve"
      },
      "patch": {
        "summary": "Update a rule",
        "tags": ["Rules"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "ruleId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string",
                    "nullable": true
                  },
                  "isActive": {
                    "type": "boolean"
                  },
                  "conditions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "field": {
                          "type": "string",
                          "enum": [
                            "description",
                            "type",
                            "date",
                            "amount",
                            "category",
                            "merchant"
                          ]
                        },
                        "operator": {
                          "type": "string",
                          "enum": [
                            "endsWith",
                            "startsWith",
                            "is",
                            "equals",
                            "gte",
                            "contains",
                            "gt",
                            "lt",
                            "lte",
                            "between"
                          ]
                        },
                        "value": {
                          "type": "string"
                        },
                        "secondValue": {
                          "type": "string",
                          "nullable": true
                        }
                      },
                      "required": ["field", "operator", "value"],
                      "additionalProperties": false
                    }
                  },
                  "targetType": {
                    "type": "string",
                    "enum": ["bank_transaction"]
                  },
                  "actions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "actionType": {
                          "type": "string",
                          "enum": ["post_journal", "tag_dimensions"]
                        },
                        "payload": {}
                      },
                      "required": ["actionType", "payload"],
                      "additionalProperties": false
                    }
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "scopeType": {
                              "type": "string",
                              "enum": ["workspace"]
                            }
                          },
                          "required": ["scopeType"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "scopeType": {
                              "type": "string",
                              "enum": ["template"]
                            },
                            "accountTemplateId": {
                              "type": "string"
                            }
                          },
                          "required": ["scopeType", "accountTemplateId"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "scopeType": {
                              "type": "string",
                              "enum": ["entity"]
                            },
                            "entityId": {
                              "type": "string"
                            }
                          },
                          "required": ["scopeType", "entityId"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "scopeType": {
                              "type": "string",
                              "enum": ["bank_account"]
                            },
                            "bankAccountId": {
                              "type": "string"
                            }
                          },
                          "required": ["scopeType", "bankAccountId"],
                          "additionalProperties": false
                        }
                      ]
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        },
                        "isActive": {
                          "type": "boolean"
                        },
                        "targetType": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "conditions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "field": {
                                "type": "string"
                              },
                              "operator": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "secondValue": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": [
                              "id",
                              "field",
                              "operator",
                              "value",
                              "secondValue"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "actions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "actionType": {
                                "type": "string"
                              },
                              "payload": {}
                            },
                            "required": ["id", "actionType", "payload"],
                            "additionalProperties": false
                          }
                        },
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "scopeType": {
                                "type": "string"
                              },
                              "entity": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "bankAccount": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "accountTemplate": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false,
                                "nullable": true
                              }
                            },
                            "required": [
                              "id",
                              "scopeType",
                              "entity",
                              "bankAccount",
                              "accountTemplate"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "description",
                        "isActive",
                        "targetType",
                        "createdAt",
                        "updatedAt",
                        "conditions",
                        "actions",
                        "scopes"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation failed. Covers both shape errors (missing/invalid fields)\nand action-payload semantic errors caught by the request schema\n(e.g. proportion lines must sum to 1).\n"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Insufficient role"
          },
          "404": {
            "description": "Rule or workspace not found"
          },
          "422": {
            "description": "Rule failed service-level validation against workspace data\n(e.g. unknown tax rate codes, account codes not allowed by the\naction type). Distinct from 400, which is raised by the request\nschema before the service is called.\n"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "rules.update",
        "x-sdk-resource": "rules",
        "x-sdk-method": "update"
      },
      "delete": {
        "summary": "Soft-delete a rule",
        "tags": ["Rules"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "ruleId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "success": {
                          "type": "boolean",
                          "enum": [true]
                        }
                      },
                      "required": ["success"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid rule ID"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Insufficient role"
          },
          "404": {
            "description": "Rule or workspace not found"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "rules.del",
        "x-sdk-resource": "rules",
        "x-sdk-method": "del"
      }
    },
    "/api/public/v1/rules": {
      "get": {
        "summary": "List rules",
        "description": "Returns rules in the workspace associated with the API key. By default returns only active rules.",
        "tags": ["Rules"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "isActive",
            "schema": {
              "type": "string",
              "enum": ["all", "false", "true"]
            },
            "required": false,
            "description": "Filter rules by active status. `true` (default) returns only active rules,\n`false` returns only inactive rules, `all` returns both.\n"
          },
          {
            "in": "query",
            "name": "entityId",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Only rules whose scope reaches this entity: workspace-wide rules, rules on\nthe entity's chart template, rules on the entity itself, and rules on any of\nits bank accounts.\n"
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 1,
              "minimum": 1
            }
          },
          {
            "in": "query",
            "name": "pageSize",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string",
                            "nullable": true
                          },
                          "isActive": {
                            "type": "boolean"
                          },
                          "targetType": {
                            "type": "string"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "conditions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "field": {
                                  "type": "string"
                                },
                                "operator": {
                                  "type": "string"
                                },
                                "value": {
                                  "type": "string"
                                },
                                "secondValue": {
                                  "type": "string",
                                  "nullable": true
                                }
                              },
                              "required": [
                                "id",
                                "field",
                                "operator",
                                "value",
                                "secondValue"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "actions": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "actionType": {
                                  "type": "string"
                                },
                                "payload": {}
                              },
                              "required": ["id", "actionType", "payload"],
                              "additionalProperties": false
                            }
                          },
                          "scopes": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "scopeType": {
                                  "type": "string"
                                },
                                "entity": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": ["id", "name"],
                                  "additionalProperties": false,
                                  "nullable": true
                                },
                                "bankAccount": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": ["id", "name"],
                                  "additionalProperties": false,
                                  "nullable": true
                                },
                                "accountTemplate": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "name": {
                                      "type": "string"
                                    }
                                  },
                                  "required": ["id", "name"],
                                  "additionalProperties": false,
                                  "nullable": true
                                }
                              },
                              "required": [
                                "id",
                                "scopeType",
                                "entity",
                                "bankAccount",
                                "accountTemplate"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "description",
                          "isActive",
                          "targetType",
                          "createdAt",
                          "updatedAt",
                          "conditions",
                          "actions",
                          "scopes"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "currentPage": {
                          "type": "number"
                        },
                        "pageSize": {
                          "type": "number"
                        },
                        "totalCount": {
                          "type": "number"
                        },
                        "totalPages": {
                          "type": "number"
                        },
                        "hasNextPage": {
                          "type": "boolean"
                        },
                        "hasPreviousPage": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "currentPage",
                        "pageSize",
                        "totalCount",
                        "totalPages",
                        "hasNextPage",
                        "hasPreviousPage"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data", "pagination"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation failed"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Insufficient role"
          },
          "404": {
            "description": "Workspace not found, or entityId is not in the workspace"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "rules.list",
        "x-sdk-resource": "rules",
        "x-sdk-method": "list"
      },
      "post": {
        "summary": "Create a rule",
        "description": "Creates a new rule in the workspace associated with the API key.",
        "tags": ["Rules"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "conditions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "field": {
                          "type": "string",
                          "enum": [
                            "description",
                            "type",
                            "date",
                            "amount",
                            "category",
                            "merchant"
                          ]
                        },
                        "operator": {
                          "type": "string",
                          "enum": [
                            "endsWith",
                            "startsWith",
                            "is",
                            "equals",
                            "gte",
                            "contains",
                            "gt",
                            "lt",
                            "lte",
                            "between"
                          ]
                        },
                        "value": {
                          "type": "string"
                        },
                        "secondValue": {
                          "type": "string",
                          "nullable": true
                        }
                      },
                      "required": ["field", "operator", "value"],
                      "additionalProperties": false
                    }
                  },
                  "actions": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "actionType": {
                          "type": "string",
                          "enum": ["post_journal", "tag_dimensions"]
                        },
                        "payload": {}
                      },
                      "required": ["actionType", "payload"],
                      "additionalProperties": false
                    }
                  },
                  "scopes": {
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "scopeType": {
                              "type": "string",
                              "enum": ["workspace"]
                            }
                          },
                          "required": ["scopeType"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "scopeType": {
                              "type": "string",
                              "enum": ["template"]
                            },
                            "accountTemplateId": {
                              "type": "string"
                            }
                          },
                          "required": ["scopeType", "accountTemplateId"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "scopeType": {
                              "type": "string",
                              "enum": ["entity"]
                            },
                            "entityId": {
                              "type": "string"
                            }
                          },
                          "required": ["scopeType", "entityId"],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "scopeType": {
                              "type": "string",
                              "enum": ["bank_account"]
                            },
                            "bankAccountId": {
                              "type": "string"
                            }
                          },
                          "required": ["scopeType", "bankAccountId"],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "description": {
                    "type": "string",
                    "nullable": true
                  },
                  "isActive": {
                    "type": "boolean"
                  },
                  "targetType": {
                    "type": "string",
                    "enum": ["bank_transaction"]
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "ai",
                      "manual",
                      "duplicate",
                      "transactions_filters",
                      "transactions_reconcile",
                      "dimension_proposal",
                      "demo_seed"
                    ]
                  }
                },
                "required": ["name", "conditions", "actions", "scopes"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string",
                          "nullable": true
                        },
                        "isActive": {
                          "type": "boolean"
                        },
                        "targetType": {
                          "type": "string"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "conditions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "field": {
                                "type": "string"
                              },
                              "operator": {
                                "type": "string"
                              },
                              "value": {
                                "type": "string"
                              },
                              "secondValue": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": [
                              "id",
                              "field",
                              "operator",
                              "value",
                              "secondValue"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "actions": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "actionType": {
                                "type": "string"
                              },
                              "payload": {}
                            },
                            "required": ["id", "actionType", "payload"],
                            "additionalProperties": false
                          }
                        },
                        "scopes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "scopeType": {
                                "type": "string"
                              },
                              "entity": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "bankAccount": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false,
                                "nullable": true
                              },
                              "accountTemplate": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  }
                                },
                                "required": ["id", "name"],
                                "additionalProperties": false,
                                "nullable": true
                              }
                            },
                            "required": [
                              "id",
                              "scopeType",
                              "entity",
                              "bankAccount",
                              "accountTemplate"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "description",
                        "isActive",
                        "targetType",
                        "createdAt",
                        "updatedAt",
                        "conditions",
                        "actions",
                        "scopes"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation failed. Covers both shape errors (missing/invalid fields)\nand action-payload semantic errors caught by the request schema\n(e.g. proportion lines must sum to 1).\n"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Insufficient role"
          },
          "404": {
            "description": "Workspace not found"
          },
          "422": {
            "description": "Rule failed service-level validation against workspace data\n(e.g. unknown tax rate codes, account codes not allowed by the\naction type). Distinct from 400, which is raised by the request\nschema before the service is called.\n"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "rules.create",
        "x-sdk-resource": "rules",
        "x-sdk-method": "create",
        "parameters": []
      }
    },
    "/api/public/v1/scheduled-tasks/{id}": {
      "get": {
        "summary": "Get a scheduled task",
        "description": "Returns a single Prosaic AI scheduled task, including how its last run went.",
        "tags": ["Scheduled tasks"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "prompt": {
                          "type": "string"
                        },
                        "entityId": {
                          "type": "string",
                          "nullable": true
                        },
                        "cron": {
                          "type": "string"
                        },
                        "schedule": {
                          "type": "string"
                        },
                        "timezone": {
                          "type": "string"
                        },
                        "isEnabled": {
                          "type": "boolean"
                        },
                        "autoApproveWrites": {
                          "type": "boolean"
                        },
                        "emailTo": {
                          "type": "string",
                          "nullable": true
                        },
                        "lastRunAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "lastStatus": {
                          "type": "string",
                          "nullable": true
                        },
                        "lastError": {
                          "type": "string",
                          "nullable": true
                        },
                        "runCount": {
                          "type": "number"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "prompt",
                        "entityId",
                        "cron",
                        "schedule",
                        "timezone",
                        "isEnabled",
                        "autoApproveWrites",
                        "emailTo",
                        "lastRunAt",
                        "lastStatus",
                        "lastError",
                        "runCount",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Insufficient role"
          },
          "404": {
            "description": "Task not found"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "scheduledTasks.retrieve",
        "x-sdk-resource": "scheduledTasks",
        "x-sdk-method": "retrieve"
      },
      "patch": {
        "summary": "Update a scheduled task",
        "description": "Updates a Prosaic AI scheduled task. Every field is optional; omitted fields are\nleft as they are. Supplying `schedule` replaces the cadence, and `isEnabled`\nis how a task is paused or resumed.\n",
        "tags": ["Scheduled tasks"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "entityId": {
                    "type": "string",
                    "nullable": true
                  },
                  "schedule": {
                    "type": "object",
                    "properties": {
                      "cadence": {
                        "type": "string",
                        "enum": ["daily", "weekdays", "weekly", "monthly"]
                      },
                      "hour": {
                        "type": "number"
                      },
                      "minute": {
                        "type": "number"
                      },
                      "weekday": {
                        "type": "number"
                      },
                      "dayOfMonth": {
                        "type": "number"
                      }
                    },
                    "required": ["cadence", "hour", "minute"],
                    "additionalProperties": false
                  },
                  "isEnabled": {
                    "type": "boolean"
                  },
                  "autoApproveWrites": {
                    "type": "boolean"
                  },
                  "emailTo": {
                    "type": "string",
                    "nullable": true
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "prompt": {
                          "type": "string"
                        },
                        "entityId": {
                          "type": "string",
                          "nullable": true
                        },
                        "cron": {
                          "type": "string"
                        },
                        "schedule": {
                          "type": "string"
                        },
                        "timezone": {
                          "type": "string"
                        },
                        "isEnabled": {
                          "type": "boolean"
                        },
                        "autoApproveWrites": {
                          "type": "boolean"
                        },
                        "emailTo": {
                          "type": "string",
                          "nullable": true
                        },
                        "lastRunAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "lastStatus": {
                          "type": "string",
                          "nullable": true
                        },
                        "lastError": {
                          "type": "string",
                          "nullable": true
                        },
                        "runCount": {
                          "type": "number"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "prompt",
                        "entityId",
                        "cron",
                        "schedule",
                        "timezone",
                        "isEnabled",
                        "autoApproveWrites",
                        "emailTo",
                        "lastRunAt",
                        "lastStatus",
                        "lastError",
                        "runCount",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation failed, or the email recipient is not a workspace member"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Entity is outside the caller's access"
          },
          "404": {
            "description": "Task not found"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "scheduledTasks.update",
        "x-sdk-resource": "scheduledTasks",
        "x-sdk-method": "update"
      },
      "delete": {
        "summary": "Delete a scheduled task",
        "description": "Soft-deletes a Prosaic AI scheduled task and unregisters its schedule. The chat\nsessions its past runs produced are kept — they are the record of what was spent\nand what was changed.\n",
        "tags": ["Scheduled tasks"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "deleted": {
                          "type": "boolean"
                        }
                      },
                      "required": ["id", "deleted"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Insufficient role"
          },
          "404": {
            "description": "Task not found"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "scheduledTasks.del",
        "x-sdk-resource": "scheduledTasks",
        "x-sdk-method": "del"
      }
    },
    "/api/public/v1/scheduled-tasks/{id}/run": {
      "post": {
        "summary": "Run a scheduled task now",
        "description": "Queues one immediate run of the task without touching its schedule. The run is\nenqueued rather than executed inline, so a 202 means \"accepted\", not \"finished\" —\npoll the task and read `lastRunAt` / `lastStatus` to see how it went.\n\nNote the run executes with the task's own settings, which includes writing to the\nbooks unattended when `autoApproveWrites` is true.\n",
        "tags": ["Scheduled tasks"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "queued": {
                          "type": "boolean"
                        }
                      },
                      "required": ["id", "queued"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Invalid task ID"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Insufficient role"
          },
          "404": {
            "description": "Task not found"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "scheduledTasks.run",
        "x-sdk-resource": "scheduledTasks",
        "x-sdk-method": "run"
      }
    },
    "/api/public/v1/scheduled-tasks": {
      "get": {
        "summary": "List scheduled tasks",
        "description": "Returns the Prosaic AI scheduled tasks in the workspace associated with the API key, newest first.",
        "tags": ["Scheduled tasks"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "prompt": {
                            "type": "string"
                          },
                          "entityId": {
                            "type": "string",
                            "nullable": true
                          },
                          "cron": {
                            "type": "string"
                          },
                          "schedule": {
                            "type": "string"
                          },
                          "timezone": {
                            "type": "string"
                          },
                          "isEnabled": {
                            "type": "boolean"
                          },
                          "autoApproveWrites": {
                            "type": "boolean"
                          },
                          "emailTo": {
                            "type": "string",
                            "nullable": true
                          },
                          "lastRunAt": {
                            "type": "string",
                            "format": "date-time",
                            "nullable": true
                          },
                          "lastStatus": {
                            "type": "string",
                            "nullable": true
                          },
                          "lastError": {
                            "type": "string",
                            "nullable": true
                          },
                          "runCount": {
                            "type": "number"
                          },
                          "createdAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "updatedAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "prompt",
                          "entityId",
                          "cron",
                          "schedule",
                          "timezone",
                          "isEnabled",
                          "autoApproveWrites",
                          "emailTo",
                          "lastRunAt",
                          "lastStatus",
                          "lastError",
                          "runCount",
                          "createdAt",
                          "updatedAt"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Insufficient role"
          },
          "404": {
            "description": "Workspace not found"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "scheduledTasks.list",
        "x-sdk-resource": "scheduledTasks",
        "x-sdk-method": "list",
        "parameters": []
      },
      "post": {
        "summary": "Create a scheduled task",
        "description": "Creates a Prosaic AI scheduled task. The task runs its prompt unattended on the\ngiven cadence, in Pacific/Auckland time.\n\n`emailTo` must be the address of a member of the same workspace — a task is a\nstanding instruction to send a workspace's books somewhere, so arbitrary\nrecipients are refused with 400.\n",
        "tags": ["Scheduled tasks"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "prompt": {
                    "type": "string"
                  },
                  "schedule": {
                    "type": "object",
                    "properties": {
                      "cadence": {
                        "type": "string",
                        "enum": ["daily", "weekdays", "weekly", "monthly"]
                      },
                      "hour": {
                        "type": "number"
                      },
                      "minute": {
                        "type": "number"
                      },
                      "weekday": {
                        "type": "number"
                      },
                      "dayOfMonth": {
                        "type": "number"
                      }
                    },
                    "required": ["cadence", "hour", "minute"],
                    "additionalProperties": false
                  },
                  "entityId": {
                    "type": "string",
                    "nullable": true
                  },
                  "isEnabled": {
                    "type": "boolean"
                  },
                  "autoApproveWrites": {
                    "type": "boolean"
                  },
                  "emailTo": {
                    "type": "string",
                    "nullable": true
                  }
                },
                "required": ["name", "prompt", "schedule"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "prompt": {
                          "type": "string"
                        },
                        "entityId": {
                          "type": "string",
                          "nullable": true
                        },
                        "cron": {
                          "type": "string"
                        },
                        "schedule": {
                          "type": "string"
                        },
                        "timezone": {
                          "type": "string"
                        },
                        "isEnabled": {
                          "type": "boolean"
                        },
                        "autoApproveWrites": {
                          "type": "boolean"
                        },
                        "emailTo": {
                          "type": "string",
                          "nullable": true
                        },
                        "lastRunAt": {
                          "type": "string",
                          "format": "date-time",
                          "nullable": true
                        },
                        "lastStatus": {
                          "type": "string",
                          "nullable": true
                        },
                        "lastError": {
                          "type": "string",
                          "nullable": true
                        },
                        "runCount": {
                          "type": "number"
                        },
                        "createdAt": {
                          "type": "string",
                          "format": "date-time"
                        },
                        "updatedAt": {
                          "type": "string",
                          "format": "date-time"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "prompt",
                        "entityId",
                        "cron",
                        "schedule",
                        "timezone",
                        "isEnabled",
                        "autoApproveWrites",
                        "emailTo",
                        "lastRunAt",
                        "lastStatus",
                        "lastError",
                        "runCount",
                        "createdAt",
                        "updatedAt"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Validation failed, or the email recipient is not a workspace member"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Entity is outside the caller's access"
          },
          "404": {
            "description": "Workspace not found"
          },
          "409": {
            "description": "Workspace is at its scheduled-task limit"
          },
          "500": {
            "description": "Internal server error"
          }
        },
        "operationId": "scheduledTasks.create",
        "x-sdk-resource": "scheduledTasks",
        "x-sdk-method": "create",
        "parameters": []
      }
    },
    "/api/public/v1/transactions/reconcile": {
      "post": {
        "summary": "Reconcile bank transactions (bulk or single)",
        "description": "Reconciles one or more bank transactions by creating journal entries with automatic tax calculations.\nAll requests are processed asynchronously via background jobs.\n\n## Processing\n\n- All transactions are queued for background processing\n- Returns `requestId` for tracking\n- Transactions are grouped by entity automatically\n- Separate jobs created per entity for parallel processing\n\n## Entity Determination\n\nUnlike other endpoints, this endpoint does **not** require an `entityId` in the path.\nInstead, entities are determined from the transactions themselves:\n- Each transaction is associated with a bank account\n- Each bank account belongs to an entity\n- Transactions can span multiple entities (separate jobs per entity)\n\n## Tax Handling\n\nThe system supports three tax modes:\n\n### NO_TAX\n- No tax calculations are performed\n- Assignment amounts are used as-is in journal entries\n- Use for transfers between accounts or tax-exempt transactions\n\n### TAX_INCLUSIVE (Default for NZ)\n- Assignment amounts **include** tax\n- System automatically splits the amount into base and tax components\n- **Formula**: `baseAmount = amount / (1 + rate)`, `taxAmount = amount - baseAmount`\n- **Example**: $115 with GST 15% → $100 base + $15 GST\n- Common for expenses where you know the total paid (including GST)\n\n### TAX_EXCLUSIVE\n- Assignment amounts **exclude** tax\n- System adds tax on top of the specified amount\n- **Formula**: `taxAmount = amount × rate`, `totalAmount = amount + taxAmount`\n- **Example**: $1000 with GST 15% → $1000 base + $150 GST = $1150 total\n- Common for income where you invoice a base amount plus GST\n\n## Important Notes\n\n- Maximum 500 transactions per request\n- Each transaction amount must equal the sum of its assignment debits/credits\n- Each assignment line requires a valid `taxCode` from the entity's tax rates\n- Generated tax lines are automatically created and linked to parent lines\n- Transactions already being processed will return a 409 conflict error\n",
        "tags": ["Transactions"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "updates": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "invoiceId": {
                          "type": "string"
                        },
                        "invoiceAllocations": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "invoiceId": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "number"
                              }
                            },
                            "required": ["invoiceId", "amount"],
                            "additionalProperties": false
                          }
                        },
                        "billAllocations": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "billId": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "number"
                              }
                            },
                            "required": ["billId", "amount"],
                            "additionalProperties": false
                          }
                        },
                        "refundCredit": {
                          "type": "object",
                          "properties": {
                            "contactId": {
                              "type": "string"
                            }
                          },
                          "required": ["contactId"],
                          "additionalProperties": false
                        },
                        "creditHolding": {
                          "type": "object",
                          "properties": {
                            "accountCode": {
                              "type": "string"
                            },
                            "taxCode": {
                              "type": "string"
                            }
                          },
                          "required": ["accountCode", "taxCode"],
                          "additionalProperties": false
                        },
                        "fixedAssetDisposal": {
                          "type": "object",
                          "properties": {
                            "fixedAssetId": {
                              "type": "string"
                            },
                            "reverseLaterDepreciation": {
                              "type": "boolean"
                            },
                            "saleTaxCode": {
                              "type": "string"
                            },
                            "accountCodes": {
                              "type": "object",
                              "properties": {
                                "loss": {
                                  "type": "string"
                                },
                                "gain": {
                                  "type": "string"
                                },
                                "private_loss": {
                                  "type": "string"
                                },
                                "private_gain": {
                                  "type": "string"
                                },
                                "depreciation_recovery": {
                                  "type": "string"
                                },
                                "capital_gain": {
                                  "type": "string"
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "required": ["fixedAssetId"],
                          "additionalProperties": false
                        },
                        "fixedAssetPurchase": {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "entityFixedAssetTypeId": {
                              "type": "string"
                            },
                            "startDate": {
                              "type": "string"
                            },
                            "depreciationMethod": {
                              "type": "string"
                            },
                            "assetNumber": {
                              "type": "string"
                            },
                            "businessUsePercentage": {
                              "type": "number"
                            },
                            "taxCode": {
                              "type": "string"
                            },
                            "depreciationRate": {
                              "type": "number"
                            },
                            "usefulLifeYears": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "name",
                            "entityFixedAssetTypeId",
                            "startDate",
                            "depreciationMethod"
                          ],
                          "additionalProperties": false
                        },
                        "narration": {
                          "type": "string"
                        },
                        "taxMode": {
                          "type": "string",
                          "enum": ["NO_TAX", "TAX_INCLUSIVE", "TAX_EXCLUSIVE"]
                        },
                        "fileIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "destinationEntityId": {
                          "type": "string"
                        },
                        "assignment": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "taxCode": {
                                "type": "string"
                              },
                              "credit": {
                                "type": "number"
                              },
                              "debit": {
                                "type": "number"
                              },
                              "description": {
                                "type": "string"
                              },
                              "destinationEntityId": {
                                "type": "string"
                              },
                              "dimensionOptionIds": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            },
                            "required": ["code", "name", "taxCode"],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": ["id"],
                      "additionalProperties": false
                    }
                  }
                },
                "required": ["updates"],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "enum": [true]
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "requestId": {
                          "type": "string"
                        },
                        "transactionIds": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "status": {
                          "type": "string"
                        },
                        "entityJobs": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "entityId": {
                                "type": "string"
                              },
                              "jobId": {
                                "type": "string"
                              },
                              "transactionCount": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "entityId",
                              "jobId",
                              "transactionCount"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "requestId",
                        "transactionIds",
                        "status",
                        "entityJobs"
                      ],
                      "additionalProperties": false
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": ["success", "data", "message"],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Bad request - validation error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "validationError": {
                    "value": {
                      "error": "Validation error: updates.0.assignment: Must provide exactly one of 'credit' or 'debit' with a positive value",
                      "code": "VALIDATION_ERROR"
                    }
                  },
                  "bulkLimit": {
                    "value": {
                      "error": "Bulk reconciliation limited to 500 transactions at a time",
                      "code": "BULK_LIMIT_EXCEEDED"
                    }
                  },
                  "invalidAmounts": {
                    "value": {
                      "error": "Assignment amounts do not sum to transaction amounts",
                      "code": "INVALID_ASSIGNMENT_AMOUNTS"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Transaction(s) not found, already reconciled, or access denied",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                },
                "examples": {
                  "transactionNotFound": {
                    "value": {
                      "error": "Some transactions not found, already reconciled, or access denied",
                      "code": "TRANSACTIONS_NOT_FOUND"
                    }
                  },
                  "filesNotFound": {
                    "value": {
                      "error": "One or more files not found or have been deleted",
                      "code": "FILES_NOT_FOUND"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Conflict - transactions already being processed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "error": "Some transactions are already being processed: 550e8400-e29b-41d4-a716-446655440001, 550e8400-e29b-41d4-a716-446655440002",
                  "code": "TRANSACTIONS_ALREADY_PROCESSING"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "operationId": "transactions.reconcileBulk",
        "x-sdk-resource": "transactions",
        "x-sdk-method": "reconcileBulk",
        "parameters": []
      }
    },
    "/api/public/v1/xero-report-mappings": {
      "get": {
        "summary": "List approved Xero report-code mappings",
        "description": "Look up Xero Report Code values in the authorised workspace's country. Each entry gives the Prosaic report group and optional category. Only approved NZ placements that are valid in the current taxonomy are returned. Other countries return an empty lookup. Missing codes require review.\n",
        "tags": ["Charts"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "country": {
                          "type": "string"
                        },
                        "mappings": {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": {
                            "type": "object",
                            "properties": {
                              "groupKey": {
                                "type": "string"
                              },
                              "categoryKey": {
                                "type": "string",
                                "nullable": true
                              }
                            },
                            "required": ["groupKey", "categoryKey"],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": ["country", "mappings"],
                      "additionalProperties": false
                    },
                    "meta": {
                      "type": "object",
                      "properties": {
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": ["count"],
                      "additionalProperties": false
                    }
                  },
                  "required": ["data"],
                  "additionalProperties": false
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer authentication"
          },
          "403": {
            "description": "Workspace or API access denied"
          },
          "404": {
            "description": "Authorised workspace unavailable"
          },
          "500": {
            "description": "Unexpected failure loading mappings"
          }
        },
        "operationId": "charts.listXeroReportMappings",
        "x-sdk-resource": "charts",
        "x-sdk-method": "listXeroReportMappings",
        "parameters": []
      }
    }
  },
  "tags": []
}
