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

# Get a quote

> Price an M-Pesa collection before creating an order. Specify the KES amount or the USDC amount, and get back the rate and fee in both directions.

Prices a collection without creating anything or sending a payment prompt.

## Endpoint

```text theme={null}
POST https://merchant.minisend.xyz/api/onramp/quote
```

```text theme={null}
Authorization: Bearer ms_live_your_key_here
```

Requires the `onramp` scope. See [getting access](/onramp/overview#getting-access).

## Body

<ParamField body="currency" type="string" required>
  Only `KES` is supported.
</ParamField>

<ParamField body="amount_usdc" type="number">
  The USDC amount you want to receive. The customer is charged this amount converted to KES, plus the platform fee. Provide this or `amount_kes`, not both.
</ParamField>

<ParamField body="amount_kes" type="number">
  The exact KES amount to charge the customer. The fee is taken from it and the remainder converts to USDC. Provide this or `amount_usdc`, not both.
</ParamField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://merchant.minisend.xyz/api/onramp/quote \
    -H "Authorization: Bearer ms_live_your_key_here" \
    -H "Content-Type: application/json" \
    -d '{"currency": "KES", "amount_kes": 1000}'
  ```

  ```javascript Node.js theme={null}
  const res = await fetch('https://merchant.minisend.xyz/api/onramp/quote', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer ms_live_your_key_here',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({ currency: 'KES', amount_kes: 1000 }),
  });

  if (!res.ok) throw new Error((await res.json()).error);
  const quote = await res.json();
  ```

  ```python Python theme={null}
  import requests

  res = requests.post(
      "https://merchant.minisend.xyz/api/onramp/quote",
      headers={
          "Authorization": "Bearer ms_live_your_key_here",
          "Content-Type": "application/json",
      },
      json={"currency": "KES", "amount_kes": 1000},
  )

  res.raise_for_status()
  quote = res.json()
  ```
</CodeGroup>

## Response (200)

```json theme={null}
{
  "currency": "KES",
  "amount_kes": 1000,
  "fee_kes": 10,
  "net_kes": 990,
  "amount_usdc": 7.62,
  "rate": 129.92,
  "expires_at": "2026-07-23T12:05:00.000Z"
}
```

<ResponseField name="amount_kes" type="number" required>
  The exact figure the customer's phone will be prompted to pay.
</ResponseField>

<ResponseField name="fee_kes" type="number" required>
  Minisend fee in KES, included in `amount_kes`.
</ResponseField>

<ResponseField name="net_kes" type="number" required>
  `amount_kes` minus `fee_kes`. What converts to USDC.
</ResponseField>

<ResponseField name="amount_usdc" type="number" required>
  What your address will receive.
</ResponseField>

<ResponseField name="rate" type="number" required>
  KES per 1 USDC.
</ResponseField>

<ResponseField name="expires_at" type="string" required>
  Indicative 5-minute quote validity, ISO 8601. The order executes at the live rate at creation time regardless.
</ResponseField>

## Errors

| Status | Meaning                                                                                                                                                             |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `400`  | Neither or both of `amount_usdc`/`amount_kes` provided; the charged KES amount is outside 20 to 250,000; or the net amount after the fee is below the 100 KES floor |
| `403`  | Key lacks the `onramp` scope or onramp is not enabled on your account                                                                                               |
| `502`  | Rate temporarily unavailable. Retry                                                                                                                                 |

See [error handling](/api-reference/errors) for the response shape.
