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

# Revise Quote

> Create a new version of an existing quote.

# Revise Quote

Creates a new quote iteration based on an existing quote. The original quote is marked as `superseded`. Use this for counter-offers or when the customer requests changes after receiving the initial quote.

## Path Parameters

<ParamField path="id" type="integer" required>
  The original quote ID to revise.
</ParamField>

## Request Body

All fields are optional. Fields not provided will be copied from the original quote.

<ParamField body="line_items" type="array">
  Updated line items.
</ParamField>

<ParamField body="discount_amount" type="integer">
  Total discount amount in cents.
</ParamField>

<ParamField body="discount_reason" type="string">
  Reason for the discount.
</ParamField>

<ParamField body="shipping_amount" type="integer">
  Shipping cost in cents.
</ParamField>

<ParamField body="tax_amount" type="integer">
  Tax amount in cents.
</ParamField>

<ParamField body="payment_terms" type="string">
  Payment terms.
</ParamField>

<ParamField body="shipping_terms" type="string">
  Shipping terms.
</ParamField>

<ParamField body="valid_until" type="string">
  Quote expiration date in ISO 8601 format.
</ParamField>

<ParamField body="supplier_notes" type="string">
  Notes from the merchant.
</ParamField>

## Response

<ResponseField name="status" type="string">
  `success` on successful revision.
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="Quote fields">
    <ResponseField name="id" type="integer">
      New quote ID.
    </ResponseField>

    <ResponseField name="quote_number" type="string">
      Same quote number as original (e.g., `Q-2024-0001`).
    </ResponseField>

    <ResponseField name="iteration" type="integer">
      Incremented version number (e.g., 2, 3, ...).
    </ResponseField>

    <ResponseField name="status" type="string">
      Status is `draft` - remember to send it.
    </ResponseField>
  </Expandable>
</ResponseField>

## What Happens

1. Original quote status changes to `superseded`
2. New quote is created in `draft` status with:
   * Same `quote_number`
   * Incremented `iteration` number
   * Your changes applied
3. The new quote must be sent separately via [Send Quote](/api-reference/b2b/send-quote)

<Note>
  The revised quote starts in `draft` status. Don't forget to send it to the customer!
</Note>

## Error Codes

| Status | Error           | Fix                            |
| ------ | --------------- | ------------------------------ |
| `401`  | Invalid API key | Verify your `X-API-Key` header |
| `404`  | Quote not found | Check that the quote ID exists |

<RequestExample>
  ```bash Revise with new pricing theme={null}
  curl -X POST https://api.khaime.com/api/v1/partner/quote/101/revise \
    -H "X-API-Key: pk_sandbox_your_key" \
    -H "Content-Type: application/json" \
    -d '{
      "line_items": [
        { "product_id": 123, "product_title": "Widget Pro", "quantity": 100, "unit_price": 2200 }
      ],
      "discount_amount": 30000,
      "discount_reason": "Revised pricing per customer feedback",
      "supplier_notes": "We have adjusted pricing as discussed."
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "status": "success",
    "message": "Quote revision created successfully",
    "data": {
      "id": 102,
      "quote_number": "Q-2024-0001",
      "iteration": 2,
      "status": "draft",
      "total_amount": 455000,
      "currency": "USD",
      "original_quote_id": 101,
      "created_at": "2024-01-18T09:00:00Z"
    }
  }
  ```
</ResponseExample>
