# Ramp Quotes

Ramp quotes provide real-time exchange rates for converting between local African currencies and USD stablecoins. Each quote is valid for a limited time and must be used or refreshed before expiration.

## Getting a Quote

### Arguments

| Argument            | Type                  | Description                                                                                                   |
| ------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------- |
| `customer`          | `ID!`                 | Global ID of the paying customer ([Create a Customer](/cashramp/cashramp-api/customers.md#create-a-customer)) |
| `amount`            | `Decimal!`            | Amount to convert                                                                                             |
| `currency`          | `P2PPaymentCurrency!` | `local_currency` or `usd`                                                                                     |
| `paymentType`       | `PaymentType`         | `deposit` or `withdrawal`                                                                                     |
| `paymentMethodType` | `String!`             | Payment rail identifier (e.g., `bank_transfer_ng`)                                                            |
| `country`           | `String`              | ISO 3166-2 country code (e.g `GH`, `NG`)                                                                      |

{% hint style="info" %}
Only provide the **optional** `country` argument if you want a customer initially created in a particular country (e.g `NG`) to pay using a different country's currency or payment method (e.g `GHS` via `mtn_momo_gh`).
{% endhint %}

```graphql
query {
  rampQuote(
    amount: 100
    currency: usd
    customer: "VHlwZXM6OkNhc2hyYW1wOjpBUEk6Ok1lcmNoYW50Q3VzdG9tZXItMzgwYzEwZTctNzgwNC00MmU3LWI2NTItYWNiMGQ5OTA4NDYy"
    paymentType: deposit
    paymentMethodType: "bank_transfer_ng"
    country: "NG"
  ) {
    id
    exchangeRate
    paymentType
  }
}
```

{% hint style="warning" %}
Getting a quote might fail if there's insufficient liquidity for the requested amount or payment method.
{% endhint %}

### Response

| Field          | Description                                      |
| -------------- | ------------------------------------------------ |
| `id`           | Ramp quote global ID for use in subsequent calls |
| `exchangeRate` | Current rate for the currency pair               |
| `paymentType`  | `deposit` or `withdrawal`                        |

## Quote Lifecycle

1. **Creation**: Quote is generated with current market rate
2. **Valid Period**: 30-180 seconds depending on market volatility
3. **Expiration**: Quote becomes invalid and must be refreshed
4. **Usage**: Quote is consumed by initiating a deposit or withdrawal

## Refreshing Quotes

When a quote expires or is close to expiring, refresh it to get updated rates.

### Arguments

| Argument    | Type      | Description                                     |
| ----------- | --------- | ----------------------------------------------- |
| `rampQuote` | `ID!`     | ID of the quote to refresh                      |
| `amount`    | `Decimal` | Optional new amount (keeps original if omitted) |

{% hint style="warning" %}
Refreshing a quote may fail if there's insufficient liquidity for the requested amount or the specified payment method.
{% endhint %}

```graphql
query {
  refreshRampQuote(
    rampQuote: "VHlwZXM6OkNhc2hyYW1wOjpBUEk6OlJhbXBRdW90ZS04ZGFkZjEzYS1mYzNjLTQzN2EtYmZkZC04NDAyN2Y2MmIxZjY="
    amount: 100
  ) {
    id
    exchangeRate
    paymentType
  }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cashramp.co/cashramp/direct-ramp/ramp-quotes.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
