> ## 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.

# Submit RFQ

> Submit a Request for Quote on behalf of a customer.

# Submit RFQ

Submit an RFQ (Request for Quote) on behalf of a customer. The `product_id` in the URL identifies the business (similar to the payment-intent pattern). Only email is required - customer details can be collected later.

<Note>
  This endpoint enables B2B quote-based commerce flows where customers request quotes for bulk orders or custom pricing before purchasing. The product\_id identifies which merchant will receive the RFQ.
</Note>

## Path Parameters

<ParamField path="product_id" type="integer" required>
  Any product ID from the merchant's catalog. Used to identify which business receives the RFQ.
</ParamField>

## Request Body

<ParamField body="customer_email" type="string" required>
  Customer's email address. This is the only required field - used for quote notifications and account creation.
</ParamField>

<ParamField body="cart_item_identifier" type="string">
  Cart identifier linking RFQ to customer's cart. Useful for tracking cart-to-RFQ conversion.
</ParamField>

<ParamField body="items" type="array" required>
  List of products to request quotes for.

  <Expandable title="Item fields">
    <ParamField body="product_id" type="integer" required>
      ID of the product in your Khaime catalog.
    </ParamField>

    <ParamField body="quantity" type="integer" required>
      Quantity requested. Must be at least 1.
    </ParamField>

    <ParamField body="price" type="integer">
      Price at time of cart addition (in cents). Useful for tracking price changes.
    </ParamField>

    <ParamField body="variation" type="object">
      Product variation details if applicable.

      <Expandable title="Variation fields">
        <ParamField body="product_variation_id" type="string">
          Product variation ID.
        </ParamField>

        <ParamField body="variation_id" type="string">
          Variation ID.
        </ParamField>

        <ParamField body="sub_variation_id" type="string">
          Sub-variation ID.
        </ParamField>
      </Expandable>
    </ParamField>

    <ParamField body="notes" type="string">
      Notes specific to this line item (e.g., "Need in blue color").
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="customer_name" type="string">
  Full name of the customer. Optional - can be collected later.
</ParamField>

<ParamField body="customer_phone" type="string">
  Customer's phone number. Optional - can be collected later.
</ParamField>

<ParamField body="company_name" type="string">
  Customer's company name. Optional - can be collected later.
</ParamField>

<ParamField body="shipping_address" type="object">
  Shipping address for the order. Optional - can be collected when sending quote.

  <Expandable title="Address fields">
    <ParamField body="address" type="string">
      Street address.
    </ParamField>

    <ParamField body="city" type="string">
      City.
    </ParamField>

    <ParamField body="state" type="string">
      State or province.
    </ParamField>

    <ParamField body="country" type="string">
      Country.
    </ParamField>

    <ParamField body="postal_code" type="string">
      Postal or ZIP code.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="notes" type="string">
  General notes for the entire RFQ (e.g., "Need delivery within 2 weeks").
</ParamField>

<ParamField body="requested_delivery_date" type="string">
  Requested delivery date in ISO 8601 format (e.g., `2024-02-15`).
</ParamField>

## Response

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

<ResponseField name="message" type="string">
  Human-readable message.
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="Data fields">
    <ResponseField name="rfq_id" type="integer">
      The ID of the created RFQ (order).
    </ResponseField>

    <ResponseField name="order_number" type="string">
      Human-readable RFQ reference (e.g., `RFQ-2024-0001`).
    </ResponseField>

    <ResponseField name="status" type="string">
      Initial status is `pending`.
    </ResponseField>

    <ResponseField name="items" type="array">
      The line items in the RFQ.
    </ResponseField>

    <ResponseField name="customer" type="object">
      Customer information including `id`, `name`, and `email`.
    </ResponseField>
  </Expandable>
</ResponseField>

## Error Codes

| Status | Error             | Fix                                            |
| ------ | ----------------- | ---------------------------------------------- |
| `400`  | Validation error  | Check required fields and data types           |
| `401`  | Invalid API key   | Verify your `X-API-Key` header                 |
| `404`  | Product not found | Check that `product_id` exists in your catalog |

<RequestExample>
  ```bash Minimal RFQ (email only) theme={null}
  curl -X POST https://api.khaime.com/api/v1/partner/rfq/123 \
    -H "X-API-Key: pk_sandbox_your_key" \
    -H "Content-Type: application/json" \
    -d '{
      "customer_email": "john@acme.com",
      "items": [
        { "product_id": 123, "quantity": 100 }
      ]
    }'
  ```

  ```bash Full RFQ with all details theme={null}
  curl -X POST https://api.khaime.com/api/v1/partner/rfq/123 \
    -H "X-API-Key: pk_sandbox_your_key" \
    -H "Content-Type: application/json" \
    -d '{
      "customer_email": "john@acme.com",
      "customer_name": "John Smith",
      "customer_phone": "+1-555-123-4567",
      "company_name": "Acme Corporation",
      "cart_item_identifier": "cart_abc123",
      "items": [
        {
          "product_id": 123,
          "quantity": 100,
          "notes": "Need in blue color"
        },
        {
          "product_id": 456,
          "quantity": 50
        }
      ],
      "shipping_address": {
        "address": "123 Business Park",
        "city": "New York",
        "state": "NY",
        "country": "USA",
        "postal_code": "10001"
      },
      "notes": "Need delivery within 2 weeks",
      "requested_delivery_date": "2024-02-15"
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Success theme={null}
  {
    "status": "success",
    "message": "RFQ submitted successfully",
    "data": {
      "rfq_id": 789,
      "order_number": "RFQ-2024-0001",
      "status": "pending",
      "items": [
        {
          "product_id": 123,
          "quantity": 100,
          "notes": "Need in blue color"
        },
        {
          "product_id": 456,
          "quantity": 50
        }
      ],
      "customer": {
        "id": 456,
        "name": "John Smith",
        "email": "john@acme.com"
      }
    }
  }
  ```
</ResponseExample>
