Offramp Quote

The Offramp Quote API provides clients with a quote based on the asset the user would like to sell, the network of the asset is on, the crypto amount of the asset, the cashout fiat currency, the payment method, and country of the user.
LimitationsThe quote provided by this API is an estimate only. It does not guarantee that the user will be able to complete their purchase using the returned quote. Depending on fluctuations in exchange rates, the actual fees charged may be different.
The Sell Quote API can now return a ready-to-use one-click-sell offramp URL. Include source_address, redirect_url, and partner_user_id parameters in your request to receive a complete offramp_url in the response. See the example with offramp URL below.
Full API endpoint listFor a complete list of all API endpoints supported by Onramp/Offramp, visit our API Reference section.

Method

POST

URL

https://api.developer.coinbase.com/onramp/v1/sell/quote

Request Parameters

The Offramp Quote API is an RPC endpoint that accepts parameters as JSON in the request body.
NameTypeReqDescription
sell_currencyYID of the crypto asset the user wants to offramp. Retrieved from the Offramp Options API.
sell_networkNName of the network that the sell currency is on. Retrieved from the Offramp Options API. If omitted, the default network for the crypto currency is used.
sell_amountStringYCrypto amount the user wants to offramp, exclusive of network fees
cashout_currencyStringYFiat currency of the cashout amount, e.g., USD.
payment_methodYID of payment method used to cashout the sell. Retrieved from the options API.
countryYISO 3166-1 two-digit country code string representing the user’s country of residence, e.g., US.
subdivisionNISO 3166-2 two-digit country subdivision code representing the user’s subdivision of residence within their country, e.g. NY. Required if the country="US" because certain states (e.g., NY) have state specific asset restrictions.
source_addressNSource address for the asset to sell. Optional field for quote, required for generating a ready-to-use one-click-sell URL.
redirect_urlNURL to redirect after transaction completion. Optional field for quote, required for generating a ready-to-use one-click-sell URL.
partner_user_idNPartner’s user identifier. Optional field for quote, required for generating a ready-to-use one-click-sell URL.

Response Fields

The Offramp Quote API returns a JSON response including the following fields.
NameDescription
cashout_totalObject with amount and currency of the fiat amount of crypto asset to be received, fees deducted. The currency will match the cashout_currency in the request if it is supported, otherwise it falls back to USD.
cashout_subtotalObject with amount and currency of the total fiat cost of the crypto asset, fees not deducted. The currency will match the cashout_currency.
sell_amountObject with amount and currency of the crypto that to be sold. The currency will match the sell_currency in the request. The number of decimals will be based on the crypto asset.
coinbase_feeObject with amount and currency of the fee changed by the Coinbase exchange to complete the transaction. The currency will match the cashout_currency.
quote_idReference to the quote that should be passed into the initialization parameters when launching the Coinbase Onramp widget via the SDK or URL generator.
offramp_urlReady-to-use offramp URL. Only returned when source_address, redirect_url, and partner_user_id are ALL provided in the request.
Creating a One-Click-Buy URL with the QuoteTo create an Onramp link with all inputs pre-filled that takes users straight to the final order preview screen, please go to our One-click-buy URL section for information.

Example Request/Response

cdpcurl -X POST 'https://api.developer.coinbase.com/onramp/v1/sell/quote' \
  -k /tmp/cdp_api_key.json \
  -d '{"sell_currency": "BTC", "sell_amount": "0.01", "cashout_currency": "USD", "payment_method": "FIAT_WALLET", "country": "US", "subdivision": "NY"}'

Example Request/Response with Offramp URL

cdpcurl -X POST 'https://api.developer.coinbase.com/onramp/v1/sell/quote' \
  -k /tmp/cdp_api_key.json \
  -d '{"sell_currency": "BTC", "sell_amount": "0.01", "cashout_currency": "USD", "payment_method": "FIAT_WALLET", "country": "US", "subdivision": "NY", "source_address": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F", "redirect_url": "https://www.example.com/redirect", "partner_user_id": "user123"}'