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

# List Event Financial Totals

> Returns a paginated list of all events with their financial totals for a specific transaction type.

Each event item includes:
- `hasCategoryTransactions`: Whether the event has any transactions of the specified type
- Financial totals (reserves, owed, paid, expectedTotal) - null if no transactions exist

**All amounts are in cents.**

**Note:** Sorting is limited to `createdAt` only. Computed financial values cannot be sorted.

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




## OpenAPI

````yaml /openapi/generated-external-api.yaml get /api/external/companies/{companyId}/events/financials/{transactionType}/totals
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://app.aiinsurance.io
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/external/companies/{companyId}/events/financials/{transactionType}/totals:
    get:
      tags:
        - Event Financials
      summary: List Event Financial Totals
      description: >
        Returns a paginated list of all events with their financial totals for a
        specific transaction type.


        Each event item includes:

        - `hasCategoryTransactions`: Whether the event has any transactions of
        the specified type

        - Financial totals (reserves, owed, paid, expectedTotal) - null if no
        transactions exist


        **All amounts are in cents.**


        **Note:** Sorting is limited to `createdAt` only. Computed financial
        values cannot be sorted.


        **Required permission:** `company.payment:read`
      operationId: listEventFinancialTotals
      parameters:
        - $ref: '#/components/parameters/companyId'
        - $ref: '#/components/parameters/transactionTypePath'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/financialTotalsSortBy'
        - $ref: '#/components/parameters/sortDirection'
      responses:
        '200':
          description: Paginated list of events with financial totals
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/EventFinancialTotalsItem'
                  totalCount:
                    type: integer
                    description: Total number of events across all pages
              examples:
                withTotals:
                  summary: Events with financial totals
                  value:
                    items:
                      - eventId: 550e8400-e29b-41d4-a716-446655440001
                        entityType: claim
                        hasCategoryTransactions: true
                        reserves: 1000000
                        owed: 200000
                        paid: 500000
                        expectedTotal: 1500000
                      - eventId: 550e8400-e29b-41d4-a716-446655440002
                        entityType: incident
                        hasCategoryTransactions: false
                        reserves: null
                        owed: null
                        paid: null
                        expectedTotal: null
                    totalCount: 2
                emptyList:
                  summary: No events
                  value:
                    items: []
                    totalCount: 0
        '400':
          description: Bad Request - Invalid transaction type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidTransactionType:
                  summary: Invalid transaction type
                  value:
                    error:
                      code: VALIDATION_ERROR
                      message: 'Invalid transaction type: unknown_type'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    companyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Company identifier
    transactionTypePath:
      name: transactionType
      in: path
      required: true
      schema:
        type: string
      description: >-
        Transaction category identifier (e.g., "indemnity_invoice",
        "alae_invoice")
    page:
      name: page
      in: query
      schema:
        type: integer
        minimum: 1
        default: 1
      description: Page number (1-based, default 1, page size 50)
    financialTotalsSortBy:
      name: sortBy
      in: query
      schema:
        type: string
        enum:
          - createdAt
        default: createdAt
      description: Field to sort by (only createdAt is supported)
    sortDirection:
      name: sortDirection
      in: query
      schema:
        type: string
        enum:
          - asc
          - desc
        default: desc
      description: Sort direction (default desc)
  schemas:
    EventFinancialTotalsItem:
      type: object
      description: Financial totals for an event by transaction type
      properties:
        eventId:
          type: string
          format: uuid
          description: Event identifier
        entityType:
          $ref: '#/components/schemas/EventType'
        hasCategoryTransactions:
          type: boolean
          description: Whether the event has transactions of the specified category
        reserves:
          type: integer
          nullable: true
          description: >-
            Reserve amount in cents (null if no transactions or category doesn't
            support reserves)
        owed:
          type: integer
          nullable: true
          description: Total owed amount in cents (null if no transactions)
        paid:
          type: integer
          nullable: true
          description: Total paid amount in cents (null if no transactions)
        expectedTotal:
          type: integer
          nullable: true
          description: Expected total amount in cents (null if no transactions)
    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'
            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
    EventType:
      type: string
      description: Type of event (claim or incident)
      enum:
        - claim
        - incident
  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: UNAUTHORIZED
                  message: Authorization header is required
            bearerTokenNotAllowed:
              summary: Bearer token used instead of API key
              value:
                error:
                  code: UNAUTHORIZED
                  message: External API endpoints require API key authentication
    Forbidden:
      description: Forbidden - Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            insufficientPermissions:
              summary: Insufficient permissions
              value:
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
    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: INTERNAL_ERROR
                  message: An unexpected error occurred. Please try again later.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Include your API key in the Authorization
        header.

````