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 Token2
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 User3
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 RatesMarket 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 Quote2
Execute it for an end user
Send the The response is the executed trade:
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), orquote_amount— the amount of fiat (e.g. buy BTC for 100 USD).
Request
rate, charged_fee, base_amount, quote_amount and the txn_id of the transaction it created.→ Execute Reusable QuoteSwap
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 Quote2
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 QuoteFollowing up
- Transaction status: every execution creates a transaction. Retrieve it with the
txn_idfrom the response, or list them filtered byend_user,op_typeor date. → Retrieve Transaction · List Transactions - Balances: → Get Balances for End User
- Limits: per-transaction minimums and maximums for your account, and the daily, monthly and yearly limits consumed by each user. → Get Transaction Limits · Get Limits for End User
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.