Skip to main content
POST /offramp/quote endpoint returns a quote for converting a supported stablecoin to local currency, including the applied rate, how much the user sends and receives, settlement timing, and when the quote expires.

Example Request

curl -L \
  --request POST \
  --url 'https://api.onswitch.xyz/offramp/quote' \
  --header 'x-service-key: YOUR_SERVICE_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "amount": 100,
    "country": "NG",
    "asset": "base:usdc",
    "currency": "NGN",
    "channel": "BANK",
    "exact_output": false,
    "developer_fee": 0.5
  }'
const res = await fetch('https://api.onswitch.xyz/offramp/quote', {
  method: 'POST',
  headers: {
    'x-service-key': process.env.YOUR_SERVICE_KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    amount: 100,
    country: 'NG',
    asset: 'base:usdc',
    currency: 'NGN',
    channel: 'BANK',
    exact_output: false,
    developer_fee: 0.5,
    developer_recipient: '0x1234567890123456789012345678901234567890',
  }),
});

const body = await res.json();
const { data } = body;
console.log(
  `${data.source.amount} ${data.source.currency}${data.destination.amount} ${data.destination.currency} (rate ${data.rate}, expires ${data.expiry})`
);
import os, json, urllib.request

payload = {
    "amount": 100,
    "country": "NG",
    "asset": "base:usdc",
    "currency": "NGN",
    "channel": "BANK",
    "exact_output": False,
    "developer_fee": 0.5,
    "developer_recipient": "0x1234567890123456789012345678901234567890",
}

req = urllib.request.Request(
    "https://api.onswitch.xyz/offramp/quote",
    data=json.dumps(payload).encode(),
    method="POST",
    headers={
        "x-service-key": os.environ["YOUR_SERVICE_KEY"],
        "Content-Type": "application/json",
    },
)

with urllib.request.urlopen(req, timeout=30) as r:
    body = json.load(r)
    d = body["data"]
    print(
        f"{d['source']['amount']} {d['source']['currency']} → "
        f"{d['destination']['amount']} {d['destination']['currency']} "
        f"(rate {d['rate']}, expires {d['expiry']})"
    )
exact_output (optional, default false) controls how amount is interpreted.

With false, amount is the stablecoin you send (asset); i.e. the quote computes how much local currency (currency) the user receives.

With true, amount is the local currency to deliver; i.e. the quote computes how much stablecoin must be sent.
developer_fee (optional) is a percentage between 0 and 100 taken as your fee from the payment amount.

Omit the fee or set it to 0 if you are not charging your own fee.

Example Response

{
  "success": true,
  "message": "Offramp quote fetched successfully",
  "timestamp": "2026-03-31T03:05:43.257Z",
  "data": {
    "expiry": "2026-03-31T04:10:43+01:00",
    "settlement": "5-10 minutes",
    "channel": "BANK",
    "rate": 1409.758,
    "source": {
      "amount": 100,
      "currency": "USDC",
      "network": "BASE"
    },
    "destination": {
      "amount": 140975.8,
      "currency": "NGN",
      "network": "FIAT"
    }
  }
}
Quotes expire at data.expiry. Market conditions can change; create the transaction promptly after fetching a quote, or request a fresh quote if it has expired.

Need Help?

Email Support

Send us a message.

Book a call

Hop on a call with us.