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

# Create a quote

> Creates a Quote Intent against the Environment bound to the API key,
pins the Environment's published Book Version, evaluates it
deterministically, and returns the Intent with its immutable Receipt.
Identical inputs under one idempotency key replay the original Quote.




## OpenAPI

````yaml /api-reference/openapi.yaml post /v1/quotes
openapi: 3.1.0
info:
  title: Kordless API
  version: 1.0.0
  description: |
    The Kordless API creates deterministic quotes against published Book
    Versions and returns immutable Quote Receipts. The same pipeline serves
    headless API-key traffic, Business-member sessions, and anonymous
    end-customer surfaces.

    ## Authentication

    Headless routes require a secret API key as a bearer token:

    ```
    Authorization: Bearer sk_test_...
    ```

    Test keys use the `sk_test_` prefix; Live keys use `sk_live_`. The key
    binds a Workspace, Project, and one Environment — a Test key can never
    address Live data. Member routes under `/v1/businesses/{businessId}`
    authenticate the caller's session and Business membership. The
    `/v1/public_quotes` routes are anonymous by design.

    ## Idempotency

    Quote creation accepts an optional `idempotencyKey` in the request body.
    Retrying with the same key and the same payload replays the original
    Quote; the same key with a different payload returns `409
    idempotency_conflict`. When omitted, the server generates an `auto_<uuid>`
    key.

    ## Envelopes and request IDs

    Success responses are `{ "data": …, "requestId": … }`; failures are
    `{ "error": { "code", "message", "requestId", "details?" } }`. Every
    response also carries an `x-request-id` header, echoed on created Quotes
    as `requestCorrelationId`.
servers:
  - url: https://your-kordless-instance.com
    description: Replace with your Kordless instance base URL
security:
  - BearerAuth: []
tags:
  - name: Quotes
    description: Headless quote creation and retrieval with an API key.
  - name: Public quotes
    description: Anonymous end-customer quotes against the Live-published Book.
  - name: Business portal
    description: Member-session routes used by the hosted Business Portal.
  - name: API keys
    description: >-
      Workspace-session routes for the API-key lifecycle (create, rotate,
      revoke).
  - name: Webhooks
    description: >-
      Workspace-session routes for webhook endpoints, deliveries, test events,
      and replay.
  - name: Request logs
    description: Workspace-session log search and Quote Intent traces.
  - name: Status
    description: Anonymous liveness signal.
paths:
  /v1/quotes:
    post:
      tags:
        - Quotes
      summary: Create a quote
      description: |
        Creates a Quote Intent against the Environment bound to the API key,
        pins the Environment's published Book Version, evaluates it
        deterministically, and returns the Intent with its immutable Receipt.
        Identical inputs under one idempotency key replay the original Quote.
      operationId: createQuote
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApiQuoteRequest'
      responses:
        '201':
          description: The created Quote Intent and its Receipt.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateQuoteResponse'
        '401':
          $ref: '#/components/responses/InvalidApiKey'
        '404':
          $ref: '#/components/responses/QuoteScopeNotFound'
        '409':
          $ref: '#/components/responses/IdempotencyConflict'
        '422':
          $ref: '#/components/responses/InvalidQuoteRequest'
components:
  schemas:
    CreateApiQuoteRequest:
      type: object
      required:
        - businessId
        - bookId
        - offeringId
      additionalProperties: false
      properties:
        businessId:
          type: string
          format: uuid
        bookId:
          type: string
          format: uuid
        offeringId:
          type: string
          maxLength: 80
        factors:
          type: object
          default: {}
          additionalProperties:
            type:
              - string
              - 'null'
            maxLength: 200
          description: Factor selections by factor id. `null` means "answered as unknown".
        idempotencyKey:
          type: string
          minLength: 8
          maxLength: 120
          description: Optional. Generated as `auto_<uuid>` when omitted.
    CreateQuoteResponse:
      type: object
      required:
        - data
        - requestId
      properties:
        data:
          type: object
          required:
            - quoteIntent
            - quoteReceipt
          properties:
            quoteIntent:
              $ref: '#/components/schemas/QuoteIntent'
            quoteReceipt:
              $ref: '#/components/schemas/QuoteReceipt'
        requestId:
          type: string
    QuoteIntent:
      type: object
      description: The persisted quote request.
      properties:
        id:
          type: string
          format: uuid
        workspaceId:
          type: string
          format: uuid
        projectId:
          type: string
          format: uuid
        environmentId:
          type: string
          format: uuid
        bookId:
          type: string
          format: uuid
        bookVersionId:
          type: string
          format: uuid
          nullable: true
          description: Pinned at creation from the Environment's publication pointer.
        status:
          type: string
          enum:
            - created
            - requires_input
            - processing
            - succeeded
            - failed
            - expired
        source:
          type: string
          enum:
            - hosted
            - api
        idempotencyKey:
          type: string
        requestCorrelationId:
          type: string
          description: Matches the `x-request-id` of the creating request.
        inputs:
          type: object
          properties:
            offeringId:
              type: string
            factors:
              type: object
              additionalProperties:
                type:
                  - string
                  - 'null'
        expiresAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
    QuoteReceipt:
      type: object
      description: |
        Immutable outcome evidence. Exactly one evidence channel is populated:
        `computation` on success, `missingInputs` when input is required, or
        `failure` on an unpriced outcome.
      properties:
        id:
          type: string
          format: uuid
        quoteIntentId:
          type: string
          format: uuid
        outcome:
          type: string
          enum:
            - succeeded
            - requires_input
            - failed
        source:
          type: string
          enum:
            - hosted
            - api
        bookVersionId:
          type: string
          format: uuid
          nullable: true
          description: Always set on succeeded receipts.
        computation:
          $ref: '#/components/schemas/QuoteComputation'
        missingInputs:
          type: array
          items:
            type: string
          description: >-
            Dotted paths such as `factors.vehicle_size` or `offeringId`. Empty
            unless the outcome is `requires_input`.
        failure:
          type: object
          nullable: true
          properties:
            code:
              type: string
              description: >-
                For example `no_published_version`, `unknown_offering`,
                `unknown_factor`, `unknown_factor_option`.
            message:
              type: string
        idempotencyKey:
          type: string
        requestCorrelationId:
          type: string
        latencyMs:
          type: integer
          minimum: 0
        createdAt:
          type: string
          format: date-time
    ErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - requestId
          properties:
            code:
              type: string
            message:
              type: string
            requestId:
              type: string
            details:
              type: object
              description: >-
                Optional structured context, for example `fields` on validation
                failures.
    QuoteComputation:
      type: object
      nullable: true
      description: >-
        Present only on `succeeded` receipts. All amounts are integer minor
        units.
      properties:
        currency:
          type: string
          description: ISO 4217 currency code.
        lineItems:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/ReceiptLineItem'
        totalMinor:
          type: integer
          minimum: 0
          description: Always reconciles to the sum of line items.
        paymentTerms:
          type: object
          properties:
            depositBasisPoints:
              type: integer
              minimum: 0
              maximum: 10000
            depositMinor:
              type: integer
              minimum: 0
            balanceDueMinor:
              type: integer
              minimum: 0
          description: Deposit plus balance always reconciles to `totalMinor`.
        conditions:
          type: array
          items:
            type: string
        derivation:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/DerivationEntry'
    ReceiptLineItem:
      type: object
      properties:
        kind:
          type: string
          enum:
            - base
            - surcharge
            - discount
            - guardrail
        label:
          type: string
        amountMinor:
          type: integer
        ruleId:
          type: string
          nullable: true
    DerivationEntry:
      type: object
      description: One step of the deterministic evaluation, in order.
      properties:
        sequence:
          type: integer
          minimum: 0
        phase:
          type: string
          enum:
            - base
            - baseOverride
            - scopedModifier
            - conditionalModifier
            - discount
            - guardrail
            - paymentTerms
        ruleId:
          type: string
          nullable: true
        ruleType:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - applied
            - skipped
        reason:
          type: string
        deltaMinor:
          type: integer
        runningTotalMinor:
          type: integer
          minimum: 0
  responses:
    InvalidApiKey:
      description: Missing, malformed, or unknown API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            error:
              code: invalid_api_key
              message: A valid API key is required.
              requestId: req_9f8e7d6c
    QuoteScopeNotFound:
      description: >-
        The Business, Book, or Environment scope does not exist for this
        credential.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            error:
              code: quote_scope_not_found
              message: The Quote scope does not exist.
              requestId: req_9f8e7d6c
    IdempotencyConflict:
      description: The idempotency key was already used with a different payload.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            error:
              code: idempotency_conflict
              message: The idempotency key was already used with a different payload.
              requestId: req_9f8e7d6c
    InvalidQuoteRequest:
      description: >-
        The request body failed schema validation; `details.fields` lists the
        offending fields.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          example:
            error:
              code: invalid_quote_request
              message: A Business, offering, and factor selections are required.
              requestId: req_9f8e7d6c
              details:
                fields:
                  offeringId:
                    - Required
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Secret API key (`sk_test_…` or `sk_live_…`). The key binds a Workspace,
        Project, and Environment.

````