> ## Documentation Index
> Fetch the complete documentation index at: https://docs.go.aiinsurance.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Entity Balances

> Returns one entity's financial balances in the same category-grouped
shape as the [global read](/api-reference/financials/get-balances) —
per-category rollups plus per-account detail, raw signed integer cents
with each account's `role` and provenance `direction` embedded (the
carrying side derives from role × direction). Also the read for an event
scope's current expected total before setting reserves.

Zero and absent are the same state: zero-amount accounts are dropped, a
category with nothing nonzero is dropped, and an entity with no balances
at all — unknown ids included — reads as empty balances rather than a
`404` (this is a pure balance read; it does not check entity existence).

**Required permission:** `company.payment:read`




## OpenAPI

````yaml /openapi/generated-external-api.yaml get /api/v1/companies/{companyId}/financials/entities/{entityType}/{entityId}/balances
openapi: 3.0.3
info:
  title: AI Insurance External API
  description: External API for AI Insurance platform
  version: 1.0.0
  contact:
    email: support@aiinsurance.io
servers:
  - url: https://go.aiinsurance.io
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/v1/companies/{companyId}/financials/entities/{entityType}/{entityId}/balances:
    get:
      tags:
        - Financials
      summary: Get Entity Balances
      description: |
        Returns one entity's financial balances in the same category-grouped
        shape as the [global read](/api-reference/financials/get-balances) —
        per-category rollups plus per-account detail, raw signed integer cents
        with each account's `role` and provenance `direction` embedded (the
        carrying side derives from role × direction). Also the read for an event
        scope's current expected total before setting reserves.

        Zero and absent are the same state: zero-amount accounts are dropped, a
        category with nothing nonzero is dropped, and an entity with no balances
        at all — unknown ids included — reads as empty balances rather than a
        `404` (this is a pure balance read; it does not check entity existence).

        **Required permission:** `company.payment:read`
      operationId: getFinancialsEntityBalances
      parameters:
        - $ref: '#/components/parameters/companyId'
        - name: entityType
          in: path
          required: true
          schema:
            type: string
            enum:
              - event
              - policy
              - payee
          description: >-
            The entity dimension to read balances for. Any other value is a
            `400`
        - name: entityId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: The entity's id
      responses:
        '200':
          description: >-
            The entity's nonzero balances (empty `categories` and `null` `cash`
            when the entity has none)
          content:
            application/json:
              schema:
                type: object
                required:
                  - categories
                  - cash
                properties:
                  categories:
                    type: array
                    description: Categories with at least one nonzero account balance
                    items:
                      $ref: '#/components/schemas/FinancialsV2CategoryBalances'
                  cash:
                    $ref: '#/components/schemas/FinancialsV2CashBalance'
              examples:
                success:
                  summary: An event with one reserved category in play
                  value:
                    categories:
                      - categoryId: 550e8400-e29b-41d4-a716-446655440100
                        name: Indemnity
                        kind: reserved
                        expectedDirection: payable
                        deprecatedAt: null
                        reservesCents: -6000
                        owedCents: 6000
                        paidCents: -4000
                        expectedTotalCents: -10000
                        accounts:
                          - accountId: 550e8400-e29b-41d4-a716-446655440101
                            key: indemnity-unpaid-losses-1
                            displayName: Indemnity Unpaid Losses
                            role: unpaid
                            direction: payable
                            lineItemTypeId: null
                            amountCents: -6000
                          - accountId: 550e8400-e29b-41d4-a716-446655440102
                            key: indemnity-payable-1
                            displayName: Indemnity Payable
                            role: payable
                            direction: payable
                            lineItemTypeId: 550e8400-e29b-41d4-a716-446655440110
                            amountCents: 6000
                          - accountId: 550e8400-e29b-41d4-a716-446655440103
                            key: indemnity-legal-1
                            displayName: Legal
                            role: line_item
                            direction: payable
                            lineItemTypeId: 550e8400-e29b-41d4-a716-446655440110
                            amountCents: -4000
                    cash: null
                emptyBalances:
                  summary: An entity with no balances (unknown ids included)
                  value:
                    categories: []
                    cash: null
        '400':
          description: >-
            Bad Request — an `entityType` outside `event` | `policy` | `payee`,
            or a malformed entity id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unknownEntityType:
                  summary: Unknown entity type
                  value:
                    error:
                      code: VALIDATION_ERROR
                      message: >-
                        entityType: Invalid option: expected one of
                        "event"|"policy"|"payee"
                      userMessages:
                        - >-
                          entityType: Invalid option: expected one of
                          "event"|"policy"|"payee"
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: >-
            Not Found — the company does not have this financials surface
            enabled (the endpoint behaves as if it does not exist)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                notFound:
                  summary: Not found
                  value:
                    error:
                      code: NotFoundError
                      message: Not found
                      userMessages:
                        - Not found
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    companyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Company identifier
  schemas:
    FinancialsV2CategoryBalances:
      type: object
      description: >-
        One category's balances: rollups plus per-account detail. Rollups are
        raw signed cents (never display-oriented): for a `reserved` category,
        `reservesCents` is the remaining reserves, `owedCents`
        invoiced-not-yet-paid, `paidCents` paid to date, and
        `expectedTotalCents` = paid + reserves; for an `operating` category
        `reservesCents` and `expectedTotalCents` are `null` — an operating
        category has no reserve position, and missing is `null` on this wire,
        never a `0` sentinel.
      required:
        - categoryId
        - name
        - kind
        - expectedDirection
        - deprecatedAt
        - reservesCents
        - owedCents
        - paidCents
        - expectedTotalCents
        - accounts
      properties:
        categoryId:
          type: string
          format: uuid
          description: The transaction category's id
        name:
          type: string
          description: The category's name
        kind:
          type: string
          enum:
            - operating
            - reserved
          description: >-
            `reserved` categories carry an expected-total/reserve position;
            `operating` categories do not
        expectedDirection:
          type: string
          enum:
            - payable
            - receivable
          description: >-
            The direction the category's money is expected to flow — `payable`
            (expect to pay out) or `receivable` (expect to collect). Always
            present. On a `reserved` category it is the direction its expected
            totals accrue, and it orients the accounts minted for the category;
            on an `operating` category it is a display label that orients
            nothing
        deprecatedAt:
          type: string
          format: date-time
          nullable: true
          description: >-
            When the category was deprecated, or `null` while live. Deprecated
            categories still appear here — they may carry balances
        reservesCents:
          type: integer
          nullable: true
          description: >-
            Remaining reserves in raw signed cents; `null` for `operating`
            categories
        owedCents:
          type: integer
          description: Invoiced but not yet paid, in raw signed cents
        paidCents:
          type: integer
          description: Paid to date, in raw signed cents
        expectedTotalCents:
          type: integer
          nullable: true
          description: >-
            The expected total (paid + reserves) in raw signed cents; `null` for
            `operating` categories
        accounts:
          type: array
          description: Per-account detail with account metadata embedded
          items:
            $ref: '#/components/schemas/FinancialsV2BalanceRow'
    FinancialsV2CashBalance:
      type: object
      nullable: true
      description: >-
        The one category-less cash account's balance with its metadata embedded,
        or `null` when there is nothing to show (no cash account on the global
        read; a zero cash balance on the entity read). `amountCents` is the raw
        signed balance in the ledger convention; cash sits in Assets (carries
        debit) and is the one account whose `direction` is `null`.
      required:
        - accountId
        - key
        - displayName
        - role
        - direction
        - lineItemTypeId
        - amountCents
      properties:
        accountId:
          type: string
          format: uuid
          description: The account's id
        key:
          type: string
          description: >-
            The account's machine key. Internal addressing — it can change when
            configuration is deprecated and recreated, so do not hardcode keys
        displayName:
          type: string
          description: The account's display label
        role:
          type: string
          enum:
            - cash
            - reserves
            - unpaid
            - payable
            - receivable
            - line_item
            - additional
          description: The account's role in the chart (`cash` here)
        direction:
          type: string
          enum:
            - payable
            - receivable
            - null
          nullable: true
          description: >-
            The account's provenance direction — always `null` for cash (it has
            no line-item or category provenance)
        lineItemTypeId:
          type: string
          format: uuid
          nullable: true
          description: Always `null` for cash (no line-item provenance)
        amountCents:
          type: integer
          description: The signed balance in integer cents, in the ledger convention
    ErrorResponse:
      type: object
      description: Standard error response for all external API endpoints
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Machine-readable error code
              example: VALIDATION_ERROR
            message:
              type: string
              description: Human-readable error message
              example: 'submissionId: Required field is missing'
            userMessages:
              type: array
              description: >-
                Clean, verbatim-displayable messages — one entry per failure,
                free of error-code tags, field paths, and internal noise.
                Suitable for showing to end users as-is.
              items:
                type: string
              example:
                - Exposures of type 'company' require an address
            details:
              type: array
              description: Additional details for validation errors (field-level errors)
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: The field that caused the error
                    example: submissionId
                  message:
                    type: string
                    description: Description of the field error
                    example: Required field is missing
    FinancialsV2BalanceRow:
      type: object
      description: >-
        One account balance with the account's metadata embedded, so balance
        reads are self-describing without a chart-of-accounts endpoint.
        `amountCents` is the raw signed balance in the ledger convention — the
        API never display-orients; the carrying side derives from `role` ×
        `direction` (assets/expenses-side accounts carry debit,
        liabilities/income-side carry credit), so orient displays from those two
        fields.
      required:
        - accountId
        - key
        - displayName
        - role
        - direction
        - lineItemTypeId
        - amountCents
      properties:
        accountId:
          type: string
          format: uuid
          description: The account's id
        key:
          type: string
          description: >-
            The account's machine key. Internal addressing — it can change when
            configuration is deprecated and recreated, so do not hardcode keys
        displayName:
          type: string
          description: The account's display label
        role:
          type: string
          enum:
            - cash
            - reserves
            - unpaid
            - payable
            - receivable
            - line_item
            - additional
          description: >-
            The account's role in the chart. Every role posts — chart structure
            (sections and grouping) is derived at read time, never stored as
            accounts
        direction:
          type: string
          enum:
            - payable
            - receivable
            - null
          nullable: true
          description: >-
            The account's provenance direction: a `line_item` leaf's or
            payable/receivable twin's line item type direction; a
            reserves/unpaid/additional account's category `expectedDirection`.
            `null` exactly for the cash account. Together with `role` this
            derives the carrying side for display orientation
        lineItemTypeId:
          type: string
          format: uuid
          nullable: true
          description: >-
            The line item type the account belongs to — set on `line_item`
            leaves and their payable/receivable balance twins (the per-line-item
            join handle), `null` on category-level and cash accounts
        amountCents:
          type: integer
          description: The signed balance in integer cents, in the ledger convention
  responses:
    Unauthorized:
      description: Unauthorized - Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            missingApiKey:
              summary: Missing API key
              value:
                error:
                  code: AuthenticationError
                  message: API key authentication required
                  userMessages:
                    - API key authentication required
            invalidApiKey:
              summary: >-
                Invalid API key (e.g. unknown key, or a Bearer token used
                instead of an API key)
              value:
                error:
                  code: AuthenticationError
                  message: Invalid API key
                  userMessages:
                    - Invalid API key
    Forbidden:
      description: Forbidden - Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            insufficientPermissions:
              summary: Insufficient permissions
              value:
                error:
                  code: AuthorizationError
                  message: User is not authorized to perform the requested action
                  userMessages:
                    - User is not authorized to perform the requested action
            companyMismatch:
              summary: A valid API key naming another company in the URL
              value:
                error:
                  code: AuthorizationError
                  message: API key is not scoped to the requested company
                  userMessages:
                    - API key is not scoped to the requested company
    InternalServerError:
      description: Internal Server Error - Unexpected error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            internalError:
              summary: Unexpected server error
              value:
                error:
                  code: UncaughtActionError
                  message: Uncaught error occurred in <actionName>
                  userMessages:
                    - An unexpected error occurred. Please try again later.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Send your raw API key as the `Authorization`
        header value with NO scheme prefix — `Authorization: YOUR-API-KEY`. Do
        NOT prefix it with `Bearer ` or `ApiKey `, and do not use an `X-API-Key`
        header; those are not accepted.

````