> ## 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 Basic Policies

> Returns a paginated list of basic policies for the company.

**Filtering:**
- `id` — one or more policy UUIDs.
- `policyNumberFilterText` — case-insensitive substring match against
  `policyNumber` only. It does not search any other field. Prefer
  `filters` for anything beyond a policy-number substring search.
- `filters` — zero or more structured per-field filters
  (`FieldModelV1ListFilter[]`) applied against any FMV1 field or
  system column (`createdAt`, `updatedAt`, `createdBy`, `updatedBy`).
  Combined with AND semantics.

**Sorting:** `sortBy` accepts `createdAt`, `updatedAt`, or `number`
(default `createdAt`). `sortDirection` accepts `asc` or `desc`
(default `desc`).

**Pagination:** page size is server-controlled. Pass `page` as a
1-based page number to iterate.

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




## OpenAPI

````yaml /openapi/generated-external-api.yaml get /api/v1/external/companies/{companyId}/policies
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:
    get:
      tags:
        - Basic Policies
      summary: List Basic Policies
      description: |
        Returns a paginated list of basic policies for the company.

        **Filtering:**
        - `id` — one or more policy UUIDs.
        - `policyNumberFilterText` — case-insensitive substring match against
          `policyNumber` only. It does not search any other field. Prefer
          `filters` for anything beyond a policy-number substring search.
        - `filters` — zero or more structured per-field filters
          (`FieldModelV1ListFilter[]`) applied against any FMV1 field or
          system column (`createdAt`, `updatedAt`, `createdBy`, `updatedBy`).
          Combined with AND semantics.

        **Sorting:** `sortBy` accepts `createdAt`, `updatedAt`, or `number`
        (default `createdAt`). `sortDirection` accepts `asc` or `desc`
        (default `desc`).

        **Pagination:** page size is server-controlled. Pass `page` as a
        1-based page number to iterate.

        **Required permission:** `company.policy:read`
      operationId: listBasicPolicies
      parameters:
        - $ref: '#/components/parameters/companyId'
        - $ref: '#/components/parameters/page'
        - name: sortBy
          in: query
          schema:
            type: string
            enum:
              - createdAt
              - updatedAt
              - number
          description: Field to sort by (defaults to `createdAt`)
        - name: sortDirection
          in: query
          schema:
            type: string
            enum:
              - asc
              - desc
          description: Sort direction (defaults to `desc`)
        - name: id
          in: query
          schema:
            oneOf:
              - type: string
                format: uuid
              - type: array
                items:
                  type: string
                  format: uuid
          description: Filter by one or more policy IDs
        - name: policyNumberFilterText
          in: query
          schema:
            type: string
          description: >-
            Case-insensitive substring match against `policyNumber` only. No
            other fields are searched. Prefer `filters` for matches against
            other fields.
        - name: filters
          in: query
          style: deepObject
          explode: true
          schema:
            type: array
            items:
              $ref: '#/components/schemas/FieldModelV1ListFilter'
          description: >-
            Structured per-field filters against FMV1 field data or system
            columns. See the `FieldModelV1ListFilter` schema for available
            filter shapes, field types, and operators. Multiple filters are
            combined with AND semantics.
      responses:
        '200':
          description: Paginated list of basic policies
          content:
            application/json:
              schema:
                type: object
                required:
                  - items
                  - totalCount
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/BasicPolicyResponse'
                  totalCount:
                    type: integer
                    description: Total number of matching policies
              examples:
                success:
                  summary: List of basic policies
                  value:
                    items:
                      - id: 550e8400-e29b-41d4-a716-446655440001
                        companyId: 550e8400-e29b-41d4-a716-446655440000
                        fieldModelV1Data:
                          policyNumber: POL-2026-0001
                          policyType: generalLiability
                          policyTimeZone: America/New_York
                          policyStartDate:
                            year: 2026
                            month: 1
                            day: 1
                            timezone: America/New_York
                          policyEndDate:
                            year: 2027
                            month: 1
                            day: 1
                            timezone: America/New_York
                          primaryInsured: 550e8400-e29b-41d4-a716-446655440010
                          exposures:
                            - id: 550e8400-e29b-41d4-a716-446655440010
                              exposureName: Acme Corporation
                              exposureType: business
                        createdAt: '2026-01-15T10:30:00.000Z'
                        updatedAt: null
                        createdBy: google-oauth2|123456789
                        updatedBy: null
                    totalCount: 1
        '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
    page:
      name: page
      in: query
      schema:
        type: integer
        minimum: 1
        default: 1
      description: Page number (1-based, default 1, page size 50)
  schemas:
    FieldModelV1ListFilter:
      description: >-
        Structured per-field filter against FMV1 field data or system columns.
        Each filter names a `fieldReferenceId`, a `fieldType` tag, an
        `operator`, and a `value` (plus `valueTo` for `between` and
        `systemColumn` for `systemUser` / `systemDate`). The set of operators
        and the `value` shape depend on `fieldType`. Pass one or more filters in
        the `filters` query parameter — multiple filters are combined with AND
        semantics.
      oneOf:
        - type: object
          description: Filter against a Text field.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
              description: Reference ID of the field to filter on.
            fieldType:
              type: string
              enum:
                - text
            operator:
              type: string
              enum:
                - matches
                - contains
                - doesNotContain
            value:
              type: string
        - type: object
          description: >-
            Filter against an Option Set field — `value` is the set of allowed
            option keys.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - optionSet
            operator:
              type: string
              enum:
                - in
            value:
              type: array
              items:
                type: string
        - type: object
          description: Scalar comparison on a Number field.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - number
            operator:
              type: string
              enum:
                - equals
                - greaterThan
                - lessThan
            value:
              type: number
        - type: object
          description: >-
            Between comparison on a Number field (inclusive `value` through
            `valueTo`).
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
            - valueTo
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - number
            operator:
              type: string
              enum:
                - between
            value:
              type: number
            valueTo:
              type: number
        - type: object
          description: Filter against a Boolean field.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - boolean
            operator:
              type: string
              enum:
                - equals
            value:
              type: boolean
        - type: object
          description: Scalar date comparison on a Date field.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - date
            operator:
              type: string
              enum:
                - 'on'
                - before
                - after
            value:
              type: object
              required:
                - year
                - month
                - day
              properties:
                year:
                  type: integer
                month:
                  type: integer
                day:
                  type: integer
        - type: object
          description: Between date comparison on a Date field.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
            - valueTo
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - date
            operator:
              type: string
              enum:
                - between
            value:
              type: object
              required:
                - year
                - month
                - day
              properties:
                year:
                  type: integer
                month:
                  type: integer
                day:
                  type: integer
            valueTo:
              type: object
              required:
                - year
                - month
                - day
              properties:
                year:
                  type: integer
                month:
                  type: integer
                day:
                  type: integer
        - type: object
          description: Scalar comparison on a Currency field.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - currency
            operator:
              type: string
              enum:
                - equals
                - greaterThan
                - lessThan
            value:
              type: number
        - type: object
          description: Between comparison on a Currency field.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
            - valueTo
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - currency
            operator:
              type: string
              enum:
                - between
            value:
              type: number
            valueTo:
              type: number
        - type: object
          description: >-
            Substring match against an Address field (searches across
            street/city/state/zip).
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - address
            operator:
              type: string
              enum:
                - contains
            value:
              type: string
        - type: object
          description: >-
            Filter against a Join field — `value` is the set of allowed
            linked-entity IDs.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - join
            operator:
              type: string
              enum:
                - in
            value:
              type: array
              items:
                type: string
        - type: object
          description: >-
            Filter against the `createdBy` or `updatedBy` system column. `value`
            is the set of allowed user IDs; use `systemColumn` to pick which
            column.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
            - systemColumn
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - systemUser
            operator:
              type: string
              enum:
                - in
            value:
              type: array
              items:
                type: string
            systemColumn:
              type: string
              enum:
                - createdBy
                - updatedBy
        - type: object
          description: >-
            Scalar date comparison against the `createdAt` or `updatedAt` system
            column.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
            - systemColumn
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - systemDate
            operator:
              type: string
              enum:
                - 'on'
                - before
                - after
            value:
              type: object
              required:
                - year
                - month
                - day
              properties:
                year:
                  type: integer
                month:
                  type: integer
                day:
                  type: integer
            systemColumn:
              type: string
              enum:
                - createdAt
                - updatedAt
        - type: object
          description: Between date comparison against a system date column.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
            - valueTo
            - systemColumn
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - systemDate
            operator:
              type: string
              enum:
                - between
            value:
              type: object
              required:
                - year
                - month
                - day
              properties:
                year:
                  type: integer
                month:
                  type: integer
                day:
                  type: integer
            valueTo:
              type: object
              required:
                - year
                - month
                - day
              properties:
                year:
                  type: integer
                month:
                  type: integer
                day:
                  type: integer
            systemColumn:
              type: string
              enum:
                - createdAt
                - updatedAt
        - type: object
          description: Match an item within a Text List field.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - textList
            operator:
              type: string
              enum:
                - listIncludes
            value:
              type: string
        - type: object
          description: Match an item within a Number List field.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - numberList
            operator:
              type: string
              enum:
                - listIncludes
            value:
              type: number
        - type: object
          description: Match items within an Option Set List field.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - optionSetList
            operator:
              type: string
              enum:
                - listIn
                - listAll
                - listExcludes
            value:
              type: array
              items:
                type: string
        - type: object
          description: Match an item within an Address List field.
          required:
            - fieldReferenceId
            - fieldType
            - operator
            - value
          properties:
            fieldReferenceId:
              type: string
            fieldType:
              type: string
              enum:
                - addressList
            operator:
              type: string
              enum:
                - listIncludes
            value:
              type: string
    BasicPolicyResponse:
      type: object
      description: >-
        A basic policy — flat `fieldModelV1Data` object with company-configured
        fields plus a nested `exposures` array. Returned by `GET /policies`
        (list items) and `GET /policies/{policyId}` (single).
      required:
        - id
        - companyId
        - fieldModelV1Data
        - createdAt
        - updatedAt
        - createdBy
        - updatedBy
      properties:
        id:
          type: string
          format: uuid
          description: Policy identifier.
        companyId:
          type: string
          format: uuid
          description: Company identifier.
        fieldModelV1Data:
          type: object
          description: >-
            Flat policy object. Keys are field `referenceId`s from the company's
            FMV1 configuration. The `exposures` key is a nested array of
            exposure objects, each of which has an `id` referencing an existing
            exposure record plus any company-configured exposure fields.
            Date-typed fields appear in canonical `{ day, month, year, timezone
            }` form.
          additionalProperties: true
        createdAt:
          type: string
          format: date-time
          description: ISO-8601 timestamp of policy creation.
        updatedAt:
          type: string
          format: date-time
          nullable: true
          description: ISO-8601 timestamp of last update, or `null` if never updated.
        createdBy:
          type: string
          nullable: true
          description: User or API key that created the policy.
        updatedBy:
          type: string
          nullable: true
          description: >-
            User or API key of the most recent update, or `null` if never
            updated.
    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.

````