> ## 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 Rating Revision Preset

> Creates a new coverage limit preset in the rating engine revision's config JSON.
This endpoint is for **rating-engine companies** — presets are stored in
`rating_engine_revisions.config.coverageLimitPresets`, not in the
`coverage_limit_presets` table.

For non-rating-engine companies, use `POST /configuration/presets` instead.

The `coverageTypeKey` must reference an existing coverage type (global or
company-specific). If the coverage type does not exist, a 404 is returned.

If `isDefault` is `true`, any existing default preset for the same coverage
type within the revision's config is automatically set to non-default.

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




## OpenAPI

````yaml /openapi/generated-external-api.yaml post /api/external/companies/{companyId}/configuration/rating/presets
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/rating/presets:
    post:
      tags:
        - Configuration Rating Presets
      summary: Create Rating Revision Preset
      description: >
        Creates a new coverage limit preset in the rating engine revision's
        config JSON.

        This endpoint is for **rating-engine companies** — presets are stored in

        `rating_engine_revisions.config.coverageLimitPresets`, not in the

        `coverage_limit_presets` table.


        For non-rating-engine companies, use `POST /configuration/presets`
        instead.


        The `coverageTypeKey` must reference an existing coverage type (global
        or

        company-specific). If the coverage type does not exist, a 404 is
        returned.


        If `isDefault` is `true`, any existing default preset for the same
        coverage

        type within the revision's config is automatically set to non-default.


        **Required permission:** `company:update`
      operationId: createRatingRevisionPreset
      parameters:
        - $ref: '#/components/parameters/companyId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRatingRevisionPresetRequest'
            examples:
              minimalInput:
                summary: Minimal request (required fields only)
                value:
                  ratingEngineRevisionId: e06153b8-53c8-4305-bc23-0b67450ec450
                  revisionStrategy: UpdateExistingRevision
                  coverageTypeKey: general_liability
                  setName: $1M/$2M GL
                  limits:
                    limits:
                      - id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                        name: Per Occurrence
                        amount: 1000000
                      - id: b2c3d4e5-f6a7-8901-bcde-f12345678901
                        name: Aggregate
                        amount: 2000000
              completeInput:
                summary: Request with common optional fields
                value:
                  ratingEngineRevisionId: e06153b8-53c8-4305-bc23-0b67450ec450
                  revisionStrategy: UpdateExistingRevision
                  coverageTypeKey: general_liability
                  setName: $1M/$2M GL with Options
                  limits:
                    limits:
                      - id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                        name: Per Occurrence
                        amount: 1000000
                      - id: b2c3d4e5-f6a7-8901-bcde-f12345678901
                        name: Aggregate
                        amount: 2000000
                    allowLimitEdits: true
                  isDefault: true
                  defenseInsideLimit: outside
                  deductible: 5000
                  limitSettings:
                    defaultAmounts:
                      partAggregate:
                        path: policy.ratingData.data.aggLimit.value
                  deductibleSettings:
                    defaultAmount:
                      path: policy.ratingData.data.retention.value
      responses:
        '201':
          description: Coverage limit preset created successfully
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                properties:
                  id:
                    type: string
                    format: uuid
                    description: The server-generated ID of the created preset
              examples:
                success:
                  summary: Preset created
                  value:
                    id: 550e8400-e29b-41d4-a716-446655440100
        '400':
          description: Bad Request - Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                emptyKey:
                  summary: Empty coverage type key
                  value:
                    error:
                      code: InvalidProperties
                      message: 'coverageTypeKey: The value is an empty string'
                      details:
                        - field: coverageTypeKey
                          message: The value is an empty string
                emptySetName:
                  summary: Empty set name
                  value:
                    error:
                      code: InvalidProperties
                      message: 'setName: The value is an empty string'
                      details:
                        - field: setName
                          message: The value is an empty string
                invalidDefense:
                  summary: Invalid defenseInsideLimit value
                  value:
                    error:
                      code: InvalidProperties
                      message: >-
                        defenseInsideLimit: Value is not among the list of
                        allowed values
                      details:
                        - field: defenseInsideLimit
                          message: Value is not among the list of allowed values
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                coverageTypeNotFound:
                  summary: Coverage type does not exist
                  value:
                    error:
                      code: CoverageTypeNotFound
                      message: 'Coverage type not found: ''nonexistent_type'''
                revisionNotFound:
                  summary: Rating engine revision does not exist
                  value:
                    error:
                      code: NotFoundError
                      message: >-
                        Rating engine revision not found:
                        e06153b8-53c8-4305-bc23-0b67450ec450
        '500':
          $ref: '#/components/responses/InternalServerError'
        '501':
          description: Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                notImplemented:
                  summary: CreateNewRevision not yet supported
                  value:
                    error:
                      code: NotImplemented
                      message: CreateNewRevision is not yet implemented
components:
  parameters:
    companyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Company identifier
  schemas:
    CreateRatingRevisionPresetRequest:
      type: object
      description: >-
        Request body for creating a coverage limit preset in a rating engine
        revision's config JSON
      required:
        - ratingEngineRevisionId
        - revisionStrategy
        - coverageTypeKey
        - setName
        - limits
      properties:
        ratingEngineRevisionId:
          type: string
          format: uuid
          description: >-
            The rating engine revision to add this preset to (must already
            exist)
        revisionStrategy:
          type: string
          enum:
            - UpdateExistingRevision
            - CreateNewRevision
          description: >-
            How to handle the rating engine revision. `UpdateExistingRevision`
            modifies the specified revision in place. `CreateNewRevision` is not
            yet implemented and will return a 501 error.
        coverageTypeKey:
          type: string
          minLength: 1
          description: >-
            The coverage type key this preset belongs to (must exist in
            coverage_types)
        setName:
          type: string
          minLength: 1
          description: Display name for this preset
        limits:
          type: object
          required:
            - limits
          properties:
            limits:
              type: array
              items:
                type: object
                required:
                  - id
                  - name
                properties:
                  id:
                    type: string
                    minLength: 1
                    description: Unique identifier for this limit within the preset
                  name:
                    type: string
                    minLength: 1
                    description: Display name of the limit
                  amount:
                    oneOf:
                      - type: number
                      - type: string
                    description: >-
                      Limit amount — a number (e.g. 1000000) or a string (e.g.
                      "100%", "-"). Omit when not applicable.
            allowLimitEdits:
              type: boolean
              description: Whether users can edit limit amounts on quotes
        isDefault:
          type: boolean
          description: >-
            Whether this is the default preset for its coverage type. Defaults
            to false. Setting to true automatically unsets any existing default
            for the same coverage type.
        defenseInsideLimit:
          type: string
          enum:
            - inside
            - outside
          description: Whether defense costs are inside or outside the limit
        deductible:
          type: number
          description: Deductible amount in dollars
        waitingPeriodSettings:
          type: object
          description: Waiting period configuration (opaque JSON)
        deductibleSettings:
          type: object
          description: Deductible default amount configuration (opaque JSON)
        limitSettings:
          type: object
          description: Limit default amounts configuration (opaque JSON)
        retroactiveDateSettings:
          type: object
          description: Retroactive date default amount configuration (opaque JSON)
        priorPendingLitigationDateSettings:
          type: object
          description: >-
            Prior/pending litigation date default amount configuration (opaque
            JSON)
    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.

````