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

# Get Policy Version

> Returns a specific version of a policy with all its derived segments.

Each segment contains the full policy state (policy-level fields and nested exposures)
for a contiguous date range. The `fullTermPolicyInfo` and `fullTermPolicyBilling`
fields are extracted from the segments for convenience — these are full-term invariant
fields that are identical across all segments in a version.

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




## OpenAPI

````yaml /openapi/generated-external-api.yaml get /api/v1/external/companies/{companyId}/policies/{policyId}/versions/{version}
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/{policyId}/versions/{version}:
    get:
      tags:
        - Field Model Policy Transactions
      summary: Get Policy Version
      description: >
        Returns a specific version of a policy with all its derived segments.


        Each segment contains the full policy state (policy-level fields and
        nested exposures)

        for a contiguous date range. The `fullTermPolicyInfo` and
        `fullTermPolicyBilling`

        fields are extracted from the segments for convenience — these are
        full-term invariant

        fields that are identical across all segments in a version.


        **Required permission:** `company.policy:read`
      operationId: getPolicyVersion
      parameters:
        - $ref: '#/components/parameters/companyId'
        - $ref: '#/components/parameters/policyIdPath'
        - $ref: '#/components/parameters/policyVersion'
      responses:
        '200':
          description: Policy version with segments
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PolicyTransactionVersionResponse'
              examples:
                success:
                  summary: Policy version response
                  value:
                    policyId: 550e8400-e29b-41d4-a716-446655440001
                    policyVersion: 1
                    transactionId: 550e8400-e29b-41d4-a716-446655440002
                    startDate: '2025-01-01'
                    endDate: '2026-01-01'
                    createdAt: '2025-01-15T10:30:00.000Z'
                    fullTermPolicyInfo:
                      policyStatus: Active
                      policyStartDate:
                        year: 2025
                        month: 1
                        day: 1
                        timezone: America/New_York
                      policyEndDate:
                        year: 2026
                        month: 1
                        day: 1
                        timezone: America/New_York
                      primaryInsuredId: 550e8400-e29b-41d4-a716-446655440010
                    fullTermPolicyBilling:
                      policyPremium: 85000
                      policyTaxes: 0
                      policyFees: 500
                      policyGrandTotal: 85500
                    segments:
                      - startDate: '2025-01-01'
                        endDate: '2026-01-01'
                        fieldModelV1Data:
                          policy:
                            annualPremium: 85000
                            fullTermPolicyInfo:
                              policyStatus: Active
                              policyStartDate:
                                year: 2025
                                month: 1
                                day: 1
                                timezone: America/New_York
                              policyEndDate:
                                year: 2026
                                month: 1
                                day: 1
                                timezone: America/New_York
                              primaryInsuredId: 550e8400-e29b-41d4-a716-446655440010
                            fullTermPolicyBilling:
                              policyPremium: 85000
                              policyTaxes: 0
                              policyFees: 500
                              policyGrandTotal: 85500
                            exposures:
                              - id: 550e8400-e29b-41d4-a716-446655440010
                                exposureType: MedicalFacility
                                bedCount: 120
        '400':
          description: Invalid version parameter
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidVersion:
                  summary: Version is not a valid integer
                  value:
                    error:
                      code: VALIDATION_ERROR
                      message: 'version: The value is not an integer'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Policy or version not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                policyNotFound:
                  summary: Policy does not exist
                  value:
                    error:
                      code: NOT_FOUND
                      message: Policy 550e8400-e29b-41d4-a716-446655440001 not found
                versionNotFound:
                  summary: Version does not exist for this policy
                  value:
                    error:
                      code: NOT_FOUND
                      message: >-
                        Policy 550e8400-e29b-41d4-a716-446655440001 version 5
                        not found
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    companyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Company identifier
    policyIdPath:
      name: policyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Policy identifier
    policyVersion:
      name: version
      in: path
      required: true
      schema:
        type: integer
        minimum: 1
      description: Policy version number (sequential, starting at 1)
  schemas:
    PolicyTransactionVersionResponse:
      type: object
      description: >
        Response returned by policy transaction endpoints. Contains the policy
        version

        produced by the transaction, including all derived segments.
      required:
        - policyId
        - policyVersion
        - transactionId
        - startDate
        - endDate
        - createdAt
        - segments
      properties:
        policyId:
          type: string
          format: uuid
          description: Policy identifier
        policyVersion:
          type: integer
          description: Sequential version number produced by this transaction
        transactionId:
          type: string
          format: uuid
          description: Identifier of the transaction that produced this version
        startDate:
          type: string
          format: date
          description: Policy term start date (ISO 8601)
        endDate:
          type: string
          format: date
          description: Policy term end date (ISO 8601)
        createdAt:
          type: string
          format: date-time
          description: When the transaction was created (ISO 8601)
        fullTermPolicyInfo:
          type: object
          nullable: true
          description: >
            Full-term policy information. Contains policy status, term dates,
            and primary insured reference.
          additionalProperties: true
        fullTermPolicyBilling:
          type: object
          nullable: true
          description: >
            Full-term billing aggregates. Contains premium, taxes, fees, and
            grand total for the full policy term.
          additionalProperties: true
        segments:
          type: array
          description: >
            Derived segments for this policy version. Each segment represents a
            maximal contiguous

            date range where policy state is identical. Adjacent segments with
            identical data are

            automatically merged.
          items:
            $ref: '#/components/schemas/PolicyTransactionSegmentResponse'
    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
    PolicyTransactionSegmentResponse:
      type: object
      description: >
        A derived policy segment representing a date range where policy state is
        identical.

        Contains the full policy data (policy-level fields and nested exposures)
        for this period.
      required:
        - startDate
        - endDate
        - fieldModelV1Data
      properties:
        startDate:
          type: string
          format: date
          description: Segment start date (ISO 8601)
        endDate:
          type: string
          format: date
          description: Segment end date (ISO 8601)
        fieldModelV1Data:
          type: object
          description: >
            Policy state for this segment. Contains a `policy` key with
            policy-level fields

            and a nested `exposures` array.
          properties:
            policy:
              type: object
              description: Policy-level fields and nested exposures for this segment.
              additionalProperties: true
          additionalProperties: true
  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.

````