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

> Creates a new company-specific coverage type. The coverage type is inserted
into the `coverage_types` table with `company_identifier` set to the company ID.

This endpoint only creates the coverage type row — it does **not** enable it.
To control which coverage types are active for a company, use the
Set Enabled Coverage Types endpoint.

The `key` is a caller-provided string (not a UUID), typically following the
convention `{shortName}_{snake_case_name}` (e.g., `vfs_general_liability`).

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




## OpenAPI

````yaml /openapi/generated-external-api.yaml post /api/external/companies/{companyId}/coverage-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}/coverage-types:
    post:
      tags:
        - Coverage Types
      summary: Create Coverage Type
      description: >
        Creates a new company-specific coverage type. The coverage type is
        inserted

        into the `coverage_types` table with `company_identifier` set to the
        company ID.


        This endpoint only creates the coverage type row — it does **not**
        enable it.

        To control which coverage types are active for a company, use the

        Set Enabled Coverage Types endpoint.


        The `key` is a caller-provided string (not a UUID), typically following
        the

        convention `{shortName}_{snake_case_name}` (e.g.,
        `vfs_general_liability`).


        **Required permission:** `company:update`
      operationId: createCoverageType
      parameters:
        - $ref: '#/components/parameters/companyId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCoverageTypeRequest'
            examples:
              basic:
                summary: Create a coverage type
                value:
                  key: vfs_general_liability
                  label: General Liability
      responses:
        '201':
          description: Coverage type created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: >-
                      The ID of the created coverage type (same as the provided
                      key)
              examples:
                success:
                  summary: Coverage type created
                  value:
                    id: vfs_general_liability
        '400':
          description: Bad Request - Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                emptyKey:
                  summary: Empty string key
                  value:
                    error:
                      code: InvalidProperties
                      message: 'key: The value is an empty string'
                      details:
                        - field: key
                          message: The value is an empty string
                emptyLabel:
                  summary: Empty string label
                  value:
                    error:
                      code: InvalidProperties
                      message: 'label: The value is an empty string'
                      details:
                        - field: label
                          message: The value is an empty string
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: Conflict - Coverage type with this key already exists
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                duplicateKey:
                  summary: Duplicate coverage type key
                  value:
                    error:
                      code: DuplicateCoverageTypeKey
                      message: >-
                        Coverage type with key 'vfs_general_liability' already
                        exists
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    companyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Company identifier
  schemas:
    CreateCoverageTypeRequest:
      type: object
      description: Request to create a company-specific coverage type
      required:
        - key
        - label
      properties:
        key:
          type: string
          description: >
            Unique identifier for the coverage type. This is a human-readable
            string

            (not a UUID), typically following the convention
            `{shortName}_{snake_case_name}`.
          example: vfs_general_liability
        label:
          type: string
          description: Display name for the coverage type
          example: General Liability
    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.

````