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

# Set Assignees

> Sets the assignees for a specific entity. This is a full replacement — the provided list of user IDs completely replaces any existing assignees. Pass an empty array to remove all assignees.

Previously removed assignees are soft-deleted (preserved for audit history) and can be re-assigned.

**Required permission:** Permission depends on entity type:
- `policies` → `policy:update`
- `submissions` → `submission:update`
- `insureds` → `insured:update`
- `events` → `claim:update`




## OpenAPI

````yaml /openapi/generated-external-api.yaml put /api/external/companies/{companyId}/{entityType}/{entityId}/assignees
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}/{entityType}/{entityId}/assignees:
    put:
      tags:
        - Assignees
      summary: Set Assignees
      description: >
        Sets the assignees for a specific entity. This is a full replacement —
        the provided list of user IDs completely replaces any existing
        assignees. Pass an empty array to remove all assignees.


        Previously removed assignees are soft-deleted (preserved for audit
        history) and can be re-assigned.


        **Required permission:** Permission depends on entity type:

        - `policies` → `policy:update`

        - `submissions` → `submission:update`

        - `insureds` → `insured:update`

        - `events` → `claim:update`
      operationId: setAssignees
      parameters:
        - $ref: '#/components/parameters/companyId'
        - $ref: '#/components/parameters/assigneeEntityType'
        - $ref: '#/components/parameters/entityId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetAssigneesRequest'
            examples:
              assignUsers:
                summary: Assign two users
                value:
                  assigneeIds:
                    - google-oauth2|123456789
                    - google-oauth2|987654321
              removeAll:
                summary: Remove all assignees
                value:
                  assigneeIds: []
      responses:
        '200':
          description: Assignees updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  assigneeIds:
                    type: array
                    items:
                      type: string
                    description: The user IDs that were set as assignees
              examples:
                success:
                  summary: Assignees set
                  value:
                    assigneeIds:
                      - google-oauth2|123456789
                      - google-oauth2|987654321
                cleared:
                  summary: All assignees removed
                  value:
                    assigneeIds: []
        '400':
          description: Bad Request - Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidEntityType:
                  summary: Invalid entity type
                  value:
                    error:
                      code: INVALID_ENTITY_TYPE
                      message: >-
                        entityType must be one of: policies, submissions,
                        insureds, events
                missingField:
                  summary: Missing assigneeIds field
                  value:
                    error:
                      code: KeyMissing
                      message: 'assigneeIds: Required keys were missing'
                      details:
                        - field: assigneeIds
                          message: Required keys were missing
                userNotFound:
                  summary: One or more users not found
                  value:
                    error:
                      code: ActionError
                      message: 'Users not found: nonexistent-user-id'
        '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
    assigneeEntityType:
      name: entityType
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/AssigneeEntityType'
      description: The type of entity (policies, submissions, insureds, or events)
    entityId:
      name: entityId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: The ID of the entity
  schemas:
    SetAssigneesRequest:
      type: object
      required:
        - assigneeIds
      properties:
        assigneeIds:
          type: array
          items:
            type: string
          description: >-
            Array of user IDs to assign. Replaces all current assignees. Pass an
            empty array to remove all assignees.
    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
    AssigneeEntityType:
      type: string
      description: The type of entity to manage assignees for
      enum:
        - policies
        - submissions
        - insureds
        - events
  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.

````