Skip to main content
Your users buy, sell and swap crypto through reusable quotes: you create a quote for a pair, which holds a rate for a short window, and then execute it for a specific end user and amount. For request and response details, follow the endpoint link in each step.

Two kinds of trades

Both share the same setup.

Common setup

1

Authenticate

Get an access token with the OAuth2 Client Credentials flow using your client_id and client_secret, and send it as a Bearer token on every subsequent call. Trading needs the read and write scopes.→ Get Access Token
2

Create the end user

Register each of your users with an external_ref: your own identifier for them. It must be unique within your account and can only contain letters, digits, _ and -.Every later call refers to the user by this external_ref — it is the end_user_id in paths and bodies.→ Create End User
3

Verify the user's identity

Submit the user’s KYC data. What happens next depends on your company — see Identity verification (KYC). An end user whose KYC is pending or rejected cannot trade: the execution answers 20030.
4

Pick a pair

List the pairs enabled for your account and pass the pair’s name (e.g. BTC_USD) when you create a quote. To show indicative prices before quoting, use the market rates.→ Get Account Pairs · Get Last Market Rates
Market rates are indicative and change with the amount. The only price you can execute at is the one held by a quote.

Buy and sell

1

Create a reusable quote

Send the pair and an external_ref. The quote holds both a buy_rate and a sell_rate (fees included) and is valid for 30 seconds (expires_at). It is not tied to an end user or an amount, so you can execute it for several users while it is valid.→ Create Reusable Quote
2

Execute it for an end user

Send the end_user_id, the op_type (BUY or SELL), an external_ref for this trade, and exactly one of:
  • base_amount — the amount of crypto (e.g. buy 0.01 BTC), or
  • quote_amount — the amount of fiat (e.g. buy BTC for 100 USD).
Request
The response is the executed trade: rate, charged_fee, base_amount, quote_amount and the txn_id of the transaction it created.→ Execute Reusable Quote
Use a unique external_ref per trade. If a request times out, retrying with the same external_ref returns the trade that was already executed instead of creating a second one.

Swap

1

Create a swap reusable quote

Send a swap pair (e.g. USDT_ETH) and an external_ref. The quote holds a swap_rate and is valid for 30 seconds.→ Create Swap Reusable Quote
2

Execute it for an end user

Send the end_user_id, an external_ref and the base_amount to swap. There is no op_type: the swap debits the base asset and credits the quote asset.→ Execute Swap Reusable Quote

Following up

Common errors

Limit errors (frequency, amount, minimums and maximums) and the full list are in Error handling.

Testing in sandbox

Use the sandbox base URL (https://sandbox-b2b.ripio.com) with your sandbox credentials: the flow and the endpoints are the same as in production. To give an end user balance to sell or swap, fund them first — see Deposits & withdrawals or, for fiat, Banking as a Service.