> ## 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.

# Download Bordereau CSV

> Downloads the bordereau report as a CSV file. Returns the same transaction-level
premium data as the [List Bordereau Rows](/api-reference/field-model/bordereau/list)
endpoint, serialized as RFC 4180 CSV with a `Content-Disposition: attachment` header.

The CSV includes fixed columns (Policy Number, Insured Name, Transaction Action,
Policy Version, Effective Date, Transaction Timestamp, Policy Start Date,
Policy End Date, Created At, Created By, Policy Premium, Policy Premium
Change) plus any additional columns specified via the `additionalColumns`
parameter.

Default limit is 50,000 rows (maximum 50,000).

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




## OpenAPI

````yaml /openapi/generated-external-api.yaml get /api/v1/external/companies/{companyId}/policies/bordereau/download
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/v1/external/companies/{companyId}/policies/bordereau/download:
    get:
      tags:
        - Field Model Bordereau
      summary: Download Bordereau CSV
      description: >
        Downloads the bordereau report as a CSV file. Returns the same
        transaction-level

        premium data as the [List Bordereau
        Rows](/api-reference/field-model/bordereau/list)

        endpoint, serialized as RFC 4180 CSV with a `Content-Disposition:
        attachment` header.


        The CSV includes fixed columns (Policy Number, Insured Name, Transaction
        Action,

        Policy Version, Effective Date, Transaction Timestamp, Policy Start
        Date,

        Policy End Date, Created At, Created By, Policy Premium, Policy Premium

        Change) plus any additional columns specified via the
        `additionalColumns`

        parameter.


        Default limit is 50,000 rows (maximum 50,000).


        **Required permission:** `company.policy:read`
      operationId: exportBordereauCsv
      parameters:
        - $ref: '#/components/parameters/companyId'
        - name: periodStart
          in: query
          schema:
            type: string
            format: date-time
          description: >
            Inclusive lower bound on `transactionTimestamp`. Only transactions
            at or after

            this timestamp are included.
        - name: periodEnd
          in: query
          schema:
            type: string
            format: date-time
          description: >
            Exclusive upper bound on `transactionTimestamp`. Only transactions
            before

            this timestamp are included.
        - name: actions
          in: query
          schema:
            type: string
          description: >
            Comma-separated list of transaction actions to include.

            Valid values: `NEW_BUSINESS`, `ENDORSE`, `CANCEL`, `REINSTATE`,
            `RENEW`.

            Omit to include all actions.


            **Note:** Unrecognized action values are not rejected — they
            silently

            match zero rows. Double-check spelling if results are unexpectedly
            empty.
        - name: additionalColumns
          in: query
          schema:
            type: string
          description: >
            JSON-encoded array of additional column definitions. Each element is
            an object

            with `path` (dot-separated path into the segment's policy data) and
            `columnHeader`

            (display name for the column). These columns are appended after the
            fixed columns.
          examples:
            taxes:
              summary: Add policy taxes column
              value: >-
                [{"path":"fullTermPolicyBilling.policyTaxes","columnHeader":"Policy
                Taxes"}]
        - name: sortBy
          in: query
          schema:
            type: string
            enum:
              - policyNumber
              - primaryInsuredName
              - effectiveDate
              - transactionTimestamp
              - createdAt
          description: Field to sort results by. Default `transactionTimestamp`.
        - name: sortDirection
          in: query
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
          description: Sort direction (default `desc`).
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 50000
            default: 50000
          description: Maximum number of rows to include. Default and maximum 50,000.
        - name: offset
          in: query
          schema:
            type: integer
            minimum: 0
            default: 0
          description: Number of rows to skip before starting the export. Default 0.
      responses:
        '200':
          description: CSV file download
          headers:
            Content-Disposition:
              schema:
                type: string
              description: |
                Attachment header with the suggested filename.
                Example: `attachment; filename="bordereau-export-acme.csv"`
          content:
            text/csv:
              schema:
                type: string
              examples:
                csvOutput:
                  summary: CSV with two transactions
                  value: >
                    Policy Number,Insured Name,Transaction Action,Policy
                    Version,Effective Date,Transaction Timestamp,Policy Start
                    Date,Policy End Date,Created At,Created By,Policy
                    Premium,Policy Premium Change

                    POL-2025-001,Mercy General
                    Hospital,NEW_BUSINESS,1,2025-01-01,2025-01-15T10:30:00.000Z,2025-01-01,2026-01-01,2025-01-15T10:30:00.000Z,api-key|abc123,85000,85000

                    POL-2025-001,Mercy General
                    Hospital,ENDORSE,2,2025-06-01,2025-06-01T14:00:00.000Z,2025-01-01,2026-01-01,2025-06-01T14:00:00.000Z,api-key|abc123,102000,17000
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidAdditionalColumns:
                  summary: Invalid JSON in additionalColumns
                  value:
                    error:
                      code: INVALID_REQUEST
                      message: additionalColumns must be valid JSON
                limitExceeded:
                  summary: Limit exceeds maximum
                  value:
                    error:
                      code: INVALID_REQUEST
                      message: limit must not exceed 50000
        '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
  schemas:
    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
  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.

````