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

> Creates a new exposure type for the company and adds it to the
company's enabled exposure types.

Exposure types define the categories of insured entities a company
can manage (e.g., "Franchise Truck Dealer", "Auto", "Company").

The `value` must be unique within the company. Attempting to create
a duplicate value returns a validation error.

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




## OpenAPI

````yaml /openapi/generated-external-api.yaml post /api/external/companies/{companyId}/exposure-types
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}/exposure-types:
    post:
      tags:
        - Exposure Types
      summary: Create Exposure Type
      description: |
        Creates a new exposure type for the company and adds it to the
        company's enabled exposure types.

        Exposure types define the categories of insured entities a company
        can manage (e.g., "Franchise Truck Dealer", "Auto", "Company").

        The `value` must be unique within the company. Attempting to create
        a duplicate value returns a validation error.

        **Required permission:** `company:update`
      operationId: createExposureType
      parameters:
        - $ref: '#/components/parameters/companyId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateExposureTypeRequest'
            examples:
              basic:
                summary: Create an exposure type
                value:
                  value: franchise_truck_dealer
                  label: Franchise Truck Dealer
      responses:
        '201':
          description: Exposure type created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: The ID of the created exposure type
              examples:
                success:
                  summary: Exposure type created
                  value:
                    id: 550e8400-e29b-41d4-a716-446655440003
        '400':
          description: Bad Request - Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                duplicateValue:
                  summary: Duplicate exposure type value
                  value:
                    error:
                      code: DuplicateExposureTypeValue
                      message: >-
                        value: An exposure type with value
                        "franchise_truck_dealer" already exists for this
                        company.
                      details:
                        - field: value
                          message: >-
                            An exposure type with value "franchise_truck_dealer"
                            already exists for this company.
                emptyValue:
                  summary: Empty value
                  value:
                    error:
                      code: InvalidProperties
                      message: 'value: The value is an empty string'
                      details:
                        - field: value
                          message: The value is an empty string
        '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:
    CreateExposureTypeRequest:
      type: object
      description: Request body for creating an exposure type
      required:
        - value
        - label
      properties:
        value:
          type: string
          minLength: 1
          description: >-
            Unique identifier for this exposure type within the company.
            Typically a snake_case string (e.g., "franchise_truck_dealer").
        label:
          type: string
          minLength: 1
          description: Human-readable display name for the exposure type
    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.

````