> ## Documentation Index
> Fetch the complete documentation index at: https://docs.go.aiinsurance.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Clear Quote Rating

> **Quote door.** Clears a saved quote's rating: everything its rating
workflow owns, which is what the workflow clears before every run
([Rating](/api-reference/rating/overview#persisting-rating-results)),
pricing included when the workflow writes `fullTermPricingInfo`. It also
removes the quote's rating evidence, `__ratingEvidence`, then saves the
quote, so its calculated fields recompute: `fullTermBillingInfo`
recalculates, and billing conditions that need pricing hold it at
`null`. The quote's invoice settings and plan are left alone, so a plan
generated from the old billing may no longer add up to the new billing:
generate, attach or clear it again before you bind with it. Rating the
quote again and saving the results brings a rating back.

The workflow cleared is the one the quote's rating evidence names (a
rate returns the evidence in its `data`, and saving the results stores
it). For a quote without evidence, it is the workflow recorded for the
quote by its last successful
[Rate Saved Quote by Id](/api-reference/field-model-rating/rate-saved-quote-by-id),
or selected for it in the app's Underwriter Workbench. An endorsement,
cancellation or reinstatement quote starts with the policy's pricing and
no evidence. Pricing a client sent is not a rating: clear it with
[Update Entity](/api-reference/entities/update-entity), sending
`fullTermPricingInfo: null`.

**Refusals.** With policy invoicing disabled, this returns
`403 finv2-policy-invoicing-disabled`. A bound or cancelled quote returns
`409`, as does a quote that names no rating workflow
(`quote-has-no-rating`). `422 quote-rating-not-clearable` refuses a
workflow that is no longer configured, that changed since the quote was
rated, or that writes outside its `clearedRoots`, the outputs it clears,
and a clear that would leave invalid pricing behind. Each message names
its fix with your request's ids. The save validates the quote as
[Update Entity](/api-reference/entities/update-entity) does, so a rule
of your company's that refuses the cleared quote returns that update's
`400`. Nothing is saved on a refusal.

**Required permission:** `quote.edit`




## OpenAPI

````yaml /openapi/generated-external-api.yaml delete /api/v1/companies/{companyId}/quotes/{quoteId}/rating
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://go.aiinsurance.io
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/v1/companies/{companyId}/quotes/{quoteId}/rating:
    delete:
      tags:
        - Policy Invoicing
      summary: Clear Quote Rating
      description: >
        **Quote door.** Clears a saved quote's rating: everything its rating

        workflow owns, which is what the workflow clears before every run

        ([Rating](/api-reference/rating/overview#persisting-rating-results)),

        pricing included when the workflow writes `fullTermPricingInfo`. It also

        removes the quote's rating evidence, `__ratingEvidence`, then saves the

        quote, so its calculated fields recompute: `fullTermBillingInfo`

        recalculates, and billing conditions that need pricing hold it at

        `null`. The quote's invoice settings and plan are left alone, so a plan

        generated from the old billing may no longer add up to the new billing:

        generate, attach or clear it again before you bind with it. Rating the

        quote again and saving the results brings a rating back.


        The workflow cleared is the one the quote's rating evidence names (a

        rate returns the evidence in its `data`, and saving the results stores

        it). For a quote without evidence, it is the workflow recorded for the

        quote by its last successful

        [Rate Saved Quote by
        Id](/api-reference/field-model-rating/rate-saved-quote-by-id),

        or selected for it in the app's Underwriter Workbench. An endorsement,

        cancellation or reinstatement quote starts with the policy's pricing and

        no evidence. Pricing a client sent is not a rating: clear it with

        [Update Entity](/api-reference/entities/update-entity), sending

        `fullTermPricingInfo: null`.


        **Refusals.** With policy invoicing disabled, this returns

        `403 finv2-policy-invoicing-disabled`. A bound or cancelled quote
        returns

        `409`, as does a quote that names no rating workflow

        (`quote-has-no-rating`). `422 quote-rating-not-clearable` refuses a

        workflow that is no longer configured, that changed since the quote was

        rated, or that writes outside its `clearedRoots`, the outputs it clears,

        and a clear that would leave invalid pricing behind. Each message names

        its fix with your request's ids. The save validates the quote as

        [Update Entity](/api-reference/entities/update-entity) does, so a rule

        of your company's that refuses the cleared quote returns that update's

        `400`. Nothing is saved on a refusal.


        **Required permission:** `quote.edit`
      operationId: deleteQuoteRating
      parameters:
        - $ref: '#/components/parameters/companyId'
        - $ref: '#/components/parameters/quoteIdPath'
      responses:
        '200':
          description: >-
            The rating is cleared and the quote saved. The response is the
            quote's id, as Update Entity returns it; read the quote with [Get
            Entity](/api-reference/entities/get-entity) to see its cleared and
            recalculated values.
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                properties:
                  id:
                    type: string
                    format: uuid
                    description: The ID of the quote whose rating was cleared
              examples:
                cleared:
                  summary: Rating cleared
                  value:
                    id: 550e8400-e29b-41d4-a716-446655440002
        '400':
          description: >-
            The quote id is not a uuid, or the save refused the cleared quote as
            Update Entity would. Nothing is saved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalidQuoteId:
                  summary: The quote id is not a uuid
                  value:
                    error:
                      code: VALIDATION_ERROR
                      message: 'quoteId: Invalid GUID'
                      userMessages:
                        - Invalid GUID
                      details:
                        - field: quoteId
                          message: Invalid GUID
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/ForbiddenQuoteInvoicing'
        '404':
          description: No quote with the given id exists for this company.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                quoteNotFound:
                  summary: Quote not found
                  value:
                    error:
                      code: NotFoundError
                      message: Quote not found
                      userMessages:
                        - Quote not found
        '409':
          description: >-
            The quote's rating cannot be cleared. A `bound` quote returns
            `QuoteBoundImmutable` with `referencingPolicy`, the policy it is
            bound to: change that policy's pricing with an endorsement. A
            `cancelled` quote returns `QuoteNotEditable`. A quote whose rating
            evidence and recorded workflow name no rating workflow returns
            `quote-has-no-rating`; pricing a client sent is cleared with Update
            Entity instead. The message names the fix with your request's ids.
            Nothing is saved.
          content:
            application/json:
              schema:
                type: object
                required:
                  - error
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                    properties:
                      code:
                        type: string
                        enum:
                          - QuoteBoundImmutable
                          - QuoteNotEditable
                          - quote-has-no-rating
                        description: Machine-readable error code
                      message:
                        type: string
                        description: Human-readable error message, naming why and the fix
                      userMessages:
                        type: array
                        items:
                          type: string
                      referencingPolicy:
                        type: string
                        format: uuid
                        nullable: true
                        description: >-
                          `QuoteBoundImmutable` only: the policy the quote is
                          bound to.
              examples:
                noRating:
                  summary: The quote names no rating workflow
                  value:
                    error:
                      code: quote-has-no-rating
                      message: >-
                        Quote 550e8400-e29b-41d4-a716-446655440002 has no rating
                        to clear: it carries no rating evidence and no rating
                        workflow was recorded when it was rated. Pricing a
                        client sent is cleared with an ordinary update: PATCH
                        /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/entities/quote/550e8400-e29b-41d4-a716-446655440002
                        with fullTermPricingInfo: null.
                      userMessages:
                        - >-
                          Quote 550e8400-e29b-41d4-a716-446655440002 has no
                          rating to clear: it carries no rating evidence and no
                          rating workflow was recorded when it was rated.
                          Pricing a client sent is cleared with an ordinary
                          update: PATCH
                          /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/entities/quote/550e8400-e29b-41d4-a716-446655440002
                          with fullTermPricingInfo: null.
                quoteBound:
                  summary: The quote is bound
                  value:
                    error:
                      code: QuoteBoundImmutable
                      message: >-
                        Quote 550e8400-e29b-41d4-a716-446655440002 is bound to
                        policy 550e8400-e29b-41d4-a716-446655440020, so its
                        rating can no longer be cleared: a bound quote is the
                        permanent record of what was bound. To change the
                        policy's pricing, endorse it with POST
                        /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/policies/550e8400-e29b-41d4-a716-446655440020/transaction/endorse.
                      userMessages:
                        - >-
                          Quote 550e8400-e29b-41d4-a716-446655440002 is bound to
                          policy 550e8400-e29b-41d4-a716-446655440020, so its
                          rating can no longer be cleared: a bound quote is the
                          permanent record of what was bound. To change the
                          policy's pricing, endorse it with POST
                          /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/policies/550e8400-e29b-41d4-a716-446655440020/transaction/endorse.
                      referencingPolicy: 550e8400-e29b-41d4-a716-446655440020
                quoteCancelled:
                  summary: The quote is cancelled
                  value:
                    error:
                      code: QuoteNotEditable
                      message: >-
                        Quote 550e8400-e29b-41d4-a716-446655440002 is cancelled,
                        so its rating can no longer be cleared. A cancelled
                        quote is closed: to model a variation, create a new
                        quote with POST
                        /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/entities/quote.
                      userMessages:
                        - >-
                          Quote 550e8400-e29b-41d4-a716-446655440002 is
                          cancelled, so its rating can no longer be cleared. A
                          cancelled quote is closed: to model a variation,
                          create a new quote with POST
                          /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/entities/quote.
        '422':
          description: >-
            `quote-rating-not-clearable`: the rating cannot be cleared safely.
            The workflow is no longer in your configuration; it changed since
            the quote was rated, so its `clearedRoots` may not be the ones that
            rating wrote; it writes outputs outside its `clearedRoots`, which a
            clear would leave behind; or the pricing left after clearing is not
            valid. The message names the fix: rate the quote again with a
            configured workflow and save the results, have the workflow's
            `clearedRoots` cover every output it writes, or correct
            `fullTermPricingInfo`. Nothing is saved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                workflowNotConfigured:
                  summary: The workflow that rated the quote is no longer configured
                  value:
                    error:
                      code: quote-rating-not-clearable
                      message: >-
                        Quote 550e8400-e29b-41d4-a716-446655440002 was rated
                        with the rating workflow “GL Rating”, which is no longer
                        in the company configuration, so its rating cannot be
                        cleared. Rate it with a configured workflow (POST
                        /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/quotes/550e8400-e29b-41d4-a716-446655440002/rate,
                        then PATCH
                        /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/entities/quote/550e8400-e29b-41d4-a716-446655440002),
                        then clear it.
                      userMessages:
                        - >-
                          Quote 550e8400-e29b-41d4-a716-446655440002 was rated
                          with the rating workflow “GL Rating”, which is no
                          longer in the company configuration, so its rating
                          cannot be cleared. Rate it with a configured workflow
                          (POST
                          /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/quotes/550e8400-e29b-41d4-a716-446655440002/rate,
                          then PATCH
                          /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/entities/quote/550e8400-e29b-41d4-a716-446655440002),
                          then clear it.
                workflowChanged:
                  summary: The workflow changed since the quote was rated
                  value:
                    error:
                      code: quote-rating-not-clearable
                      message: >-
                        The rating workflow “GL Rating” has changed since quote
                        550e8400-e29b-41d4-a716-446655440002 was rated, so
                        clearing it could leave outputs the earlier version
                        wrote. Rate it again (POST
                        /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/quotes/550e8400-e29b-41d4-a716-446655440002/rate,
                        then PATCH
                        /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/entities/quote/550e8400-e29b-41d4-a716-446655440002),
                        then clear it.
                      userMessages:
                        - >-
                          The rating workflow “GL Rating” has changed since
                          quote 550e8400-e29b-41d4-a716-446655440002 was rated,
                          so clearing it could leave outputs the earlier version
                          wrote. Rate it again (POST
                          /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/quotes/550e8400-e29b-41d4-a716-446655440002/rate,
                          then PATCH
                          /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/entities/quote/550e8400-e29b-41d4-a716-446655440002),
                          then clear it.
                writesOutsideClearedRoots:
                  summary: The workflow writes outside its clearedRoots
                  value:
                    error:
                      code: quote-rating-not-clearable
                      message: >-
                        The rating workflow “GL Rating” writes
                        quote.fullTermPricingInfo outside its clearedRoots, so
                        clearing its roots would leave those outputs behind, and
                        its rating cannot be cleared. Its clearedRoots must
                        cover every output it writes; the workflow is in the
                        configuration export (POST
                        /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/configuration/export).
                      userMessages:
                        - >-
                          The rating workflow “GL Rating” writes
                          quote.fullTermPricingInfo outside its clearedRoots, so
                          clearing its roots would leave those outputs behind,
                          and its rating cannot be cleared. Its clearedRoots
                          must cover every output it writes; the workflow is in
                          the configuration export (POST
                          /api/v1/companies/550e8400-e29b-41d4-a716-446655440001/configuration/export).
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  parameters:
    companyId:
      name: companyId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Company identifier
    quoteIdPath:
      name: quoteId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Quote identifier
  schemas:
    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'
            userMessages:
              type: array
              description: >-
                Clean, verbatim-displayable messages — one entry per failure,
                free of error-code tags, field paths, and internal noise.
                Suitable for showing to end users as-is.
              items:
                type: string
              example:
                - Exposures of type 'company' require an address
            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
                  code:
                    type: string
                    description: Stable problem code for this individual validation failure
                    example: BLANK_LIST_ELEMENT
                  reason:
                    type: string
                    description: Stable reason the value violates its canonical contract
                    example: blank-list-element
                  expected:
                    type: string
                    description: The expected canonical value contract
                    example: nonblank trimmed string
                  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: AuthenticationError
                  message: API key authentication required
                  userMessages:
                    - API key authentication required
            invalidApiKey:
              summary: >-
                Invalid API key (e.g. unknown key, or a Bearer token used
                instead of an API key)
              value:
                error:
                  code: AuthenticationError
                  message: Invalid API key
                  userMessages:
                    - Invalid API key
    ForbiddenQuoteInvoicing:
      description: >
        Forbidden. The API key lacks the endpoint's permission, or the company
        does

        not invoice (`finv2-policy-invoicing-disabled`): its policy invoicing is
        not

        turned on, or it is on while its Quote billing calculation is still

        `NO_BILLING()`. Support turns invoicing on; replacing `NO_BILLING()` is
        a

        configuration change ([Quote billing
        calculations](/api-reference/configuration/overview#quote-billing-calculations)).

        Nothing is saved.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            invoicingDisabled:
              summary: Policy invoicing is disabled
              value:
                error:
                  code: finv2-policy-invoicing-disabled
                  message: >-
                    Policy invoicing is not turned on for your company yet, so
                    policy invoices cannot be created or changed. Contact
                    support to enable it.
                  userMessages:
                    - >-
                      Policy invoicing is not turned on for your company yet, so
                      policy invoices cannot be created or changed. Contact
                      support to enable it.
            insufficientPermissions:
              summary: Insufficient permissions
              value:
                error:
                  code: AuthorizationError
                  message: User is not authorized to perform the requested action
                  userMessages:
                    - User is not authorized to perform the requested action
            companyMismatch:
              summary: A valid API key naming another company in the URL
              value:
                error:
                  code: AuthorizationError
                  message: API key is not scoped to the requested company
                  userMessages:
                    - API key is not scoped to the requested company
    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: UncaughtActionError
                  message: Uncaught error occurred in <actionName>
                  userMessages:
                    - An unexpected error occurred. Please try again later.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API key authentication. Send your raw API key as the `Authorization`
        header value with NO scheme prefix — `Authorization: YOUR-API-KEY`. Do
        NOT prefix it with `Bearer ` or `ApiKey `, and do not use an `X-API-Key`
        header; those are not accepted.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.