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

# Update Quote

> Updates a Field Model V1 quote. This is a **full replacement** of the
quote's custom field data and exposures.

The `quote` object is merged with existing lifecycle fields (the system
preserves `quoteType`, `quoteStatus`, `quoteNumber`, `quoteBindErrors`,
`quoteSubmissionId`). The `exposures` array fully replaces the existing
exposures.

**Lifecycle fields** are rejected with a 400 error if included in the
request body.

**Required permission:** `company.quote:update`




## OpenAPI

````yaml /openapi/generated-external-api.yaml put /api/v1/external/companies/{companyId}/quotes/{quoteId}
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}/quotes/{quoteId}:
    put:
      tags:
        - Field Model Quotes
      summary: Update Quote
      description: |
        Updates a Field Model V1 quote. This is a **full replacement** of the
        quote's custom field data and exposures.

        The `quote` object is merged with existing lifecycle fields (the system
        preserves `quoteType`, `quoteStatus`, `quoteNumber`, `quoteBindErrors`,
        `quoteSubmissionId`). The `exposures` array fully replaces the existing
        exposures.

        **Lifecycle fields** are rejected with a 400 error if included in the
        request body.

        **Required permission:** `company.quote:update`
      operationId: updateQuoteV1
      parameters:
        - $ref: '#/components/parameters/companyId'
        - name: quoteId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Quote identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - quote
                - exposures
              properties:
                quote:
                  type: object
                  additionalProperties: true
                  description: Quote-level custom field data (lifecycle fields rejected)
                exposures:
                  type: array
                  items:
                    type: object
                    additionalProperties: true
                  description: Array of exposure objects (full replacement)
            examples:
              updateFields:
                summary: Update quote data
                value:
                  quote:
                    policyStartDate: '2025-01-01'
                    policyEndDate: '2026-01-01'
                    policyType: new_business
                    policyTimeZone: America/New_York
                    premium: 18000
                  exposures:
                    - exposureName: Acme Corp
                      employeeCount: 175
      responses:
        '200':
          description: Quote updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuoteV1Response'
              examples:
                success:
                  summary: Updated quote
                  value:
                    id: 550e8400-e29b-41d4-a716-446655440001
                    companyId: 550e8400-e29b-41d4-a716-446655440000
                    submissionId: 550e8400-e29b-41d4-a716-446655440010
                    policyId: null
                    data:
                      policyStartDate: '2025-01-01'
                      policyEndDate: '2026-01-01'
                      policyType: new_business
                      policyTimeZone: America/New_York
                      premium: 18000
                      quoteType: New Business
                      quoteStatus: in_progress
                      quoteNumber: Q-2025-001
                    exposures:
                      - exposureName: Acme Corp
                        employeeCount: 175
                    createdAt: '2025-01-15T10:30:00.000Z'
                    updatedAt: '2025-01-20T14:00:00.000Z'
                    createdBy: google-oauth2|123456789
        '400':
          description: Bad Request — validation error or lifecycle fields included
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                lifecycleField:
                  summary: Lifecycle field rejected
                  value:
                    error:
                      code: VALIDATION_ERROR
                      message: 'Lifecycle fields cannot be set on update: quoteStatus'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Quote not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                quoteNotFound:
                  summary: Quote not found
                  value:
                    error:
                      code: NOT_FOUND
                      message: Quote 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:
    QuoteV1Response:
      type: object
      description: A Field Model V1 quote with custom field data and exposures.
      required:
        - id
        - companyId
        - submissionId
        - data
        - exposures
        - createdAt
      properties:
        id:
          type: string
          format: uuid
          description: Quote identifier
        companyId:
          type: string
          format: uuid
          description: Company identifier
        submissionId:
          type: string
          format: uuid
          description: Associated submission ID
        policyId:
          type: string
          format: uuid
          nullable: true
          description: Associated policy ID (null until quote is bound)
        data:
          type: object
          additionalProperties: true
          description: >
            Quote-level custom field data. Keys are field `referenceId`s

            defined in the company's field configuration. Includes lifecycle

            fields (`quoteType`, `quoteStatus`, `quoteNumber`,
            `quoteBindErrors`,

            `quoteSubmissionId`) which are read-only and system-managed.
        exposures:
          type: array
          items:
            type: object
            additionalProperties: true
          description: |
            Array of exposure objects, each containing custom field data
            with field `referenceId`s as keys.
        createdAt:
          type: string
          format: date-time
          description: When the quote was created
        updatedAt:
          type: string
          format: date-time
          nullable: true
          description: When the quote was last updated
        createdBy:
          type: string
          nullable: true
          description: User ID who created the quote
    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.

````