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

> Updates an existing exposure.

All fields are optional - only send fields being changed.
Does NOT allow updating entityType or applicationData (rating data).

**Required permission:** `insured:update`




## OpenAPI

````yaml /openapi/generated-external-api.yaml patch /api/external/companies/{companyId}/exposures/{exposureId}
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}/exposures/{exposureId}:
    patch:
      tags:
        - Exposures
      summary: Update Exposure
      description: |
        Updates an existing exposure.

        All fields are optional - only send fields being changed.
        Does NOT allow updating entityType or applicationData (rating data).

        **Required permission:** `insured:update`
      operationId: updateExposure
      parameters:
        - $ref: '#/components/parameters/companyId'
        - name: exposureId
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Exposure identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateInsuredRequest'
            examples:
              updateName:
                summary: Update exposure name
                value:
                  name: John Smith Jr.
              updateContact:
                summary: Update contact information
                value:
                  email: john.smith@newdomain.com
                  phoneNumber: +1-555-987-6543
              clearBroker:
                summary: Clear default broker
                value:
                  defaultBrokerId: null
      responses:
        '200':
          description: Exposure updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InsuredDetail'
              examples:
                success:
                  summary: Updated exposure
                  value:
                    id: 550e8400-e29b-41d4-a716-446655440200
                    companyId: 550e8400-e29b-41d4-a716-446655440000
                    name: John Smith Jr.
                    entityType: individual
                    phoneNumber: +1-555-987-6543
                    email: john.smith@newdomain.com
                    billingEmail: null
                    defaultBrokerId: null
                    createdAt: '2025-01-15T10:30:00.000Z'
                    createdBy: google-oauth2|123456789
                    updatedAt: '2025-01-20T14:00:00.000Z'
                    updatedBy: google-oauth2|987654321
        '400':
          description: Bad Request - Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidEmail:
                  summary: Invalid email format
                  value:
                    error:
                      code: InvalidEmail
                      message: 'email: Invalid email format'
                      details:
                        - field: email
                          message: Invalid email format
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Exposure not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                exposureNotFound:
                  summary: Exposure not found
                  value:
                    error:
                      code: NOT_FOUND
                      message: Insured 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:
    UpdateInsuredRequest:
      type: object
      description: Request body for updating an insured
      properties:
        name:
          type: string
          description: Update insured name
        phoneNumber:
          type: string
          description: Update phone number
        email:
          type: string
          format: email
          nullable: true
          description: Update email (send null to clear)
        billingEmail:
          type: string
          format: email
          nullable: true
          description: Update billing email (send null to clear)
        defaultBrokerId:
          type: string
          format: uuid
          nullable: true
          description: >-
            ID of an existing broker to set as default (send null to clear). Use
            GET /brokers to find valid IDs.
        data:
          type: object
          additionalProperties:
            nullable: true
            oneOf:
              - type: string
              - type: number
              - type: array
                items:
                  type: string
                description: >-
                  For MultiSelectField / AsyncMultiSelectField — the option
                  `value`s to select. Comma-separated strings are also accepted
                  for backward compatibility.
              - type: array
                items:
                  type: object
                  additionalProperties:
                    oneOf:
                      - type: string
                      - type: number
                description: >-
                  For GroupField — each item is one row of subfield key/value
                  pairs. Subfield keys must match the GroupField's `subFields`
                  from GET /insureds/configuration.
          description: >-
            Custom data fields to merge with existing data. Keys must match
            fields from GET /insureds/configuration for the insured's
            entityType. Send null for a key to clear it.
    InsuredDetail:
      type: object
      description: Full insured details returned from update operations
      properties:
        id:
          type: string
          format: uuid
          description: Insured identifier
        companyId:
          type: string
          format: uuid
          description: Company identifier
        name:
          type: string
          description: Insured name
        entityType:
          type: string
          description: Entity type (individual, organization, etc.)
        phoneNumber:
          type: string
          nullable: true
          description: Insured phone number
        email:
          type: string
          format: email
          nullable: true
          description: Insured email address
        billingEmail:
          type: string
          format: email
          nullable: true
          description: Billing email address
        defaultBrokerId:
          type: string
          format: uuid
          nullable: true
          description: Default broker ID for this insured
        createdAt:
          type: string
          format: date-time
          description: When the insured was created
        createdBy:
          type: string
          nullable: true
          description: User who created the insured
        updatedAt:
          type: string
          format: date-time
          description: When the insured was last updated
        updatedBy:
          type: string
          nullable: true
          description: User who last updated the insured
    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.

````