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

# Create Your First Quote

> Learn how to create quotes in Busha. Lock in exchange rates and fees before executing transactions.

This guide will walk you through the essential first step of almost any transaction on Busha: creating a Quote. By generating a Quote, you lock in the terms of a proposed asset transfer, ensuring price certainty and transparency before committing to the transaction.

> [!TIP]
>
> **What You'll Achieve:**
>
> 1. Understand the basic structure for requesting a Quote.
>
> 2. Successfully generate a Quote for a currency conversion.
>
> 3. Learn how to use source\_amount vs target\_amount in your requests.
>
> 4. Explore how to include optional `pay_in` and `pay_out` details in your Quote requests.
>
> 5. Interpret a successful Quote response.

## Prerequisites

Before you begin, ensure you have:

* A Busha Business Account and Secret API Key (from the [Quick Start Tutorial](https://docs.busha.io/guides/getting-started/quick-start.md)).

* An understanding of API Environments (Sandbox vs. Production) and their base URLs (from the [Make Your First Request Guide](https://docs.busha.io/guides/getting-started/make-first-request.md)).

* A conceptual understanding of Quotes (from the [Quotes explainer](https://docs.busha.io/overview/quotes.md)).

> [!NOTE]
>
> For deposit requests involving a customer, the `X-BU-PROFILE-ID` field should
> be included in the request header, and its value should be set to the customer
> ID for whom the request is performed on their behalf.

## How to Create Your First Quote

**1. Understand Quote Creation Parameters**

The core of creating a Quote involves specifying the currencies and the amount of the transfer. Remember, you must provide either the `source_amount` or `target_amount`, but not both.

The essential parameters for creating a quote are:

<table>
  <thead>
    <tr>
      <th>Parameter</th>
      <th>Data Type</th>
      <th>Required/Optional</th>
      <th>Description</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>`source_currency`</td>
      <td>string</td>
      <td>Required</td>
      <td>The currency you're sending.</td>
    </tr>

    <tr>
      <td>`target_currency`</td>
      <td>string</td>
      <td>Required</td>
      <td>The currency you're receiving.</td>
    </tr>

    <tr>
      <td>`source_amount`</td>
      <td>string</td>
      <td>Optional</td>
      <td>The amount of `source_currency` you want to send.</td>
    </tr>

    <tr>
      <td>`target_amount`</td>
      <td>string</td>
      <td>Optional</td>
      <td>The amount of `target_currency` you want to receive.</td>
    </tr>

    <tr>
      <td>`pay_in`</td>
      <td>object</td>
      <td>Optional</td>
      <td>Details about the incoming transfer method.</td>
    </tr>

    <tr>
      <td>`pay_out`</td>
      <td>object</td>
      <td>Optional</td>
      <td>Details about the outgoing transfer method.</td>
    </tr>
  </tbody>
</table>

**2. Create a Basic Quote (Conversion Example)**

Let's create a simple Quote for currency conversion (e.g., converting from NGN to BTC).

**To create a basic quote:**

1. Open your terminal or command prompt.

2. Use the `POST` request below to the `/v1/quotes` endpoint.

3. Replace `YOUR_BASE_URL` with your chosen environment's URL and `{YOUR SECRET_KEY}` with your actual key.

4. Choose either source\_amount or `target_amount`. In this example, we'll specify `source_amount`

```bash theme={null}
    $ curl -i -X POST https://YOUR_BASE_URL/v1/quotes \
      -H 'Authorization: Bearer {YOUR_SECRET_KEY}' \
      -H 'Content-Type: application/json' \
      -d '{
             "source_currency": "NGN",
             "target_currency": "BTC",
             "source_amount": "200000"
          }'
```

**Expected Response:**

A successful response will return a Quote object, providing the id for this quote, the calculated `target_amount`, the current `rate` and `fees`. Quotes are valid for 3 minutes from creation. After that, they expire and transfers can no longer be created from them.

```json theme={null}
{
  "status": "success",
  "message": "Created quote successfully",
  "data": {
    "id": "QUO_AEv8vGiT4jvB",
    "profile_id": "",
    "source_currency": "NGN",
    "target_currency": "BTC",
    "source_amount": "200000",
    "target_amount": "0.00118096",
    "rate": {
      "product": "BTCNGN",
      "rate": "169353287.78",
      "side": "buy",
      "type": "FIXED",
      "source_currency": "NGN",
      "target_currency": "BTC"
    },
    "fees": [],
    "reference": "QUO_AEv8vGiT4jvB",
    "status": "pending",
    "expires_at": "2025-06-10T08:10:26.721165473Z",
    "created_at": "2025-06-10T08:07:26.721165473Z",
    "updated_at": "2025-06-10T08:07:56.721165473Z"
  }
}
```

> [!NOTE]
>
> 1. Note the `id` of the Quote. You'll use this id to execute the transaction (e.g., conversion, deposit, or payout) in a subsequent step.
>
> 2. Create the transfer before the quote expires. The quoted rate is honoured for the remainder of the same 3-minute quote validity window; creating a transfer does not restart it. For transfers involving deposits, ensure the deposit is received within the same quote validity window. Deposits received outside that window are settled at the market rate. Check the quote's `expires_at` before creating the transfer; request a new quote if it has expired.

**3. Understanding Currency-Specific Differences**

While the quote creation process is the same across currencies, **payment methods differ by country**:

### Currency Specific Differences

<table>
  <thead>
    <tr>
      <th>Aspect</th>
      <th>Nigeria (NGN)</th>
      <th>Kenya (KES)</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>**Currency**</td>
      <td>NGN (Naira)</td>
      <td>KES (Kenyan Shilling)</td>
    </tr>

    <tr>
      <td>**Deposit Method**</td>
      <td>Bank transfer to business account</td>
      <td>M-Pesa or mobile money</td>
    </tr>

    <tr>
      <td>**Payout Method**</td>
      <td>Bank transfer</td>
      <td>M-Pesa or bank transfer</td>
    </tr>
  </tbody>
</table>

### Example: Creating a KES Quote

The API call structure is identical, just with different currency and amount:

```bash theme={null}
    $ curl -i -X POST https://YOUR_BASE_URL/v1/quotes \
      -H 'Authorization: Bearer {YOUR_SECRET_KEY}' \
      -H 'Content-Type: application/json' \
      -d '{
             "source_currency": "KES",
             "target_currency": "BTC",
             "source_amount": "50000",
             "pay_in": {
               "type": "mobile_money",
               "phone": "+254712345678"
             }
          }'
```

> [accordion] View KES Quote Response
>
> ```json theme={null}
> {
>   "status": "success",
>   "message": "Created quote successfully",
>   "data": {
>     "id": "QUO_KES123Example",
>     "source_currency": "KES",
>     "target_currency": "BTC",
>     "source_amount": "50000",
>     "target_amount": "0.00029123",
>     "rate": {
>       "product": "BTCKES",
>       "rate": "171680500.00",
>       "side": "buy",
>       "type": "FIXED",
>       "source_currency": "KES",
>       "target_currency": "BTC"
>     },
>     "fees": [],
>     "expires_at": "2025-06-10T08:10:26.721165473Z",
>     "created_at": "2025-06-10T08:07:26.721165473Z",
>     "updated_at": "2025-06-10T08:07:56.721165473Z"
>   }
> }
> ```

> [!NOTE]
>
> For currency-specific payment method details, see:
>
> * [Process Fiat Deposits](https://docs.busha.io/guides/deposits/process-fiat-deposits.md) for bank vs mobile money
> * [Create Recipients](https://docs.busha.io/guides/recipients/create-and-manage.md) for payment method setup

**4. Create a Quote with `pay_in` Details (for Deposits)**

For certain transaction types like deposits (PayIns) or direct crypto purchases, you might need to specify details about the incoming payment method using the `pay_in` object in your quote request. This helps Busha generate accurate deposit instructions.

**To create a quote for a deposit (e.g., crypto):**

1. Use a `POST` request to `/v1/quotes` as before.

2. Include the `pay_in` object with relevant details. For a crypto deposit, this might include the `network`.

```bash theme={null}
    $ curl -i -X POST \
      https://YOUR_BASE_URL/v1/quotes \
      -H 'Authorization: Bearer {YOUR_SECRET_KEY}' \
      -H 'Content-Type: application/json' \
      -d '{
        "source_currency": "BTC",
        "target_currency": "NGN",
        "target_amount": "50000",
        "pay_in": {
          "type": "address",
          "network": "BTC"
        }
    }'
```

**Expected Response**

The Quote response itself will be similar to the basic one, with the `pay_in` object included in the response.

```json theme={null}
{
  "status": "success",
  "message": "Created quote successfully",
  "data": {
    "id": "QUO_mwdzbJiiAUa7",
    "profile_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
    "source_currency": "BTC",
    "target_currency": "NGN",
    "source_amount": "0.00029895",
    "target_amount": "50000",
    "rate": {
      "product": "BTCNGN",
      "rate": "167252998.89",
      "side": "sell",
      "type": "FIXED",
      "source_currency": "BTC",
      "target_currency": "NGN"
    },
    "fees": [],
    "pay_in": {
      "network": "BTC",
      "type": "address"
    },
    "reference": "QUO_mwdzbJiiAUa7",
    "status": "pending",
    "expires_at": "2025-06-10T08:19:54.461945463Z",
    "created_at": "2025-06-10T08:16:54.461945463Z",
    "updated_at": "2025-06-10T08:16:54.461945463Z"
  }
}
```

**5. Create a Quote with `pay_out` Details (for Payouts/Withdrawals)**

When initiating a payout (withdrawal) from your Busha account, you'll need to specify details about the outgoing payment method using the `pay_out` object. This guides Busha on where and how to send the funds. This also typically requires a `recipient_id`.

**To create a quote for a payout**

> [!NOTE]
>
> For payouts to bank accounts, ensure you have a `recipient_id` for the bank
> account you wish to pay out to. (Refer to: [How to Create and Manage
> Recipients Guide](https://docs.busha.io/guides/recipients/create-and-manage.md))

1. Use a POST request to `/v1/quotes`.

2. Include the `pay_out` object with details for the target recipient and channel.

```bash theme={null}
    $ curl -i -X POST https://YOUR_BASE_URL/v1/quotes \
      -H 'Authorization: Bearer {YOUR_SECRET_KEY}' \
      -H 'Content-Type: application/json' \
      -d '{
            "source_currency": "BTC",
            "target_currency": "BTC",
            "target_amount": "0.0001",
            "pay_out": {
              "type": "address",
              "network": "BTC",
              "address": "tb1qj4263506wyu8khrz2dwce0agk8lhyjgy269rxr"
            }
       }'
```

**Expected Response:**

The Quote response itself will be similar to the basic one, with the `pay_out` object included in the response.

```json theme={null}
{
  "status": "success",
  "message": "Created quote successfully",
  "data": {
    "id": "QUO_0OF0pBoXllc0",
    "profile_id": "BUS_jlKUYwF9z1ynQZ98bWbaP",
    "source_currency": "BTC",
    "target_currency": "BTC",
    "source_amount": "0.0001",
    "target_amount": "0.0001",
    "rate": {
      "product": "",
      "rate": "1",
      "side": "sell",
      "type": "FIXED",
      "source_currency": "BTC",
      "target_currency": "BTC"
    },
    "fees": [
      {
        "amount": {
          "amount": "0.000005",
          "currency": "BTC"
        },
        "name": "network fee",
        "type": "FIXED"
      }
    ],
    "pay_out": {
      "address": "tb1qj4263506wyu8khrz2dwce0agk8lhyjgy269rxr",
      "network": "BTC",
      "type": "address"
    },
    "reference": "QUO_0OF0pBoXllc0",
    "status": "pending",
    "created_at": "2025-06-10T08:35:34.224940272Z",
    "updated_at": "2025-06-10T08:35:34.224940272Z"
  }
}
```

## Troubleshooting Common Quote Creation Issues

* **Quote expired or deposit received late**: Quotes are valid for 3 minutes from creation. After that, they expire and transfers can no longer be created from them. Create the transfer before the quote expires. The quoted rate is honoured for the remainder of the same 3-minute quote validity window; creating a transfer does not restart it. For transfers involving deposits, ensure the deposit is received within the same quote validity window. Deposits received outside that window are settled at the market rate.

* **"One of target and source amount must be set"**: You included both `source_amount` and `target_amount` in your request. Remove one.

* **`401 Unauthorized`**: Double-check that your secret API key is correct.

## What's Next?

Once you have successfully created a Quote, the next step is to execute the actual transaction based on that Quote.

* [How to Get a Quote](https://docs.busha.io/guides/quotes/get-quote.md)

* [How to Process Fiat Deposits (PayIns) Guide](https://docs.busha.io/guides/deposits/process-fiat-deposits.md)

* [How to Process Crypto Deposits (PayIns) Guide](https://docs.busha.io/guides/deposits/process-crypto-deposits.md)

* [How to Make Payouts Guide](https://docs.busha.io/guides/payouts/process-payouts.md)

* [How to Perform Currency Conversions Guide](https://docs.busha.io/guides/balance/convert-balance-to-balance.md)

* [API Reference: Quote Object](https://docs.busha.io/api-reference/quotes/create-a-new-quote.md): For a complete list of all parameters, sub-fields for `pay_in` and `pay_out`, and their data types.


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