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

# Create Configuration Field

> Creates a new configuration field and associates it with the specified entity type.

**Allowed entity names:** `events`, `insureds`, `policies`

**Allowed field class names:** `InputField`, `SelectField`, `DateField`, `RadioSelect`, `ExportResolvedField`

The field key cannot be `companyId` (reserved).

**Required permission:** `company:update`




## OpenAPI

````yaml /openapi/generated-external-api.yaml post /api/external/companies/{companyId}/configuration/fields
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}/configuration/fields:
    post:
      tags:
        - Configuration Fields
      summary: Create Configuration Field
      description: >
        Creates a new configuration field and associates it with the specified
        entity type.


        **Allowed entity names:** `events`, `insureds`, `policies`


        **Allowed field class names:** `InputField`, `SelectField`, `DateField`,
        `RadioSelect`, `ExportResolvedField`


        The field key cannot be `companyId` (reserved).


        **Required permission:** `company:update`
      operationId: createConfigurationField
      parameters:
        - $ref: '#/components/parameters/companyId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConfigurationFieldRequest'
            examples:
              minimalInput:
                summary: Minimal request (required fields only)
                value:
                  fieldDefinition:
                    className: InputField
                    key: policyState
                    path: policyState
                  entityName: policies
              completeInput:
                summary: Complete request with all optional fields
                value:
                  fieldDefinition:
                    className: SelectField
                    key: dealerType
                    path: dealerType
                    label: Dealer Type
                    section: General
                    required: true
                    fields:
                      options:
                        - label: Franchise
                          value: franchise
                        - label: Non-Franchise
                          value: nonfranchise
                  entityName: insureds
      responses:
        '201':
          description: Configuration field created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: The ID of the created configuration field
              examples:
                success:
                  summary: Field created
                  value:
                    id: 550e8400-e29b-41d4-a716-446655440100
        '400':
          description: Bad Request - Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidEntityName:
                  summary: Invalid entity name
                  value:
                    error:
                      code: InvalidProperties
                      message: >-
                        entityName: Value is not among the list of allowed
                        values
                      details:
                        - field: entityName
                          message: Value is not among the list of allowed values
        '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
  schemas:
    CreateConfigurationFieldRequest:
      type: object
      description: Request body for creating a configuration field
      required:
        - fieldDefinition
        - entityName
      properties:
        fieldDefinition:
          $ref: '#/components/schemas/ConfigurationFieldDefinition'
        entityName:
          type: string
          enum:
            - events
            - insureds
            - policies
          description: The entity type to associate this field with
    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
    ConfigurationFieldDefinition:
      type: object
      description: Field definition specifying the field's type, key, and configuration
      required:
        - className
        - key
        - path
      properties:
        className:
          type: string
          enum:
            - InputField
            - SelectField
            - DateField
            - RadioSelect
            - ExportResolvedField
          description: The field type class
        key:
          type: string
          description: Unique field key (cannot be "companyId")
        path:
          type: string
          description: Dot-notation path for the field value in entity data
        label:
          type: string
          description: Human-readable label for the field
        section:
          type: string
          description: UI section grouping for the field
        required:
          type: boolean
          description: Whether the field is required
        fields:
          type: object
          description: Additional sub-field configuration (e.g., select options)
        calculation:
          type: object
          description: Calculation configuration for computed fields
  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.

````