Skip to main content
POST
Swap Currency
Swap funds from one currency to another at the current exchange rate. Use a rateToken from the /wallet/rates endpoint to lock in a specific rate. fromAmount is a whole number of the smallest unit of fromCurrency (cents for USD, kobo for NGN), and the amounts on the returned transaction are in smallest units too.

Example Request

Example Response

The fromCurrency and toCurrency must be different. If you don’t provide a rateToken, the swap will execute at the current market rate which may differ from the last quoted rate.

Authorizations

X-API-Key
string
header
required

Your Rolla API key

Body

application/json
fromCurrency
string
required

Currency being sold. Currency code, 3 or 4 letters, upper-cased by the server (for example NGN, USD, USDC).

Required string length: 3 - 4
Example:

"USD"

toCurrency
string
required

Currency being bought. Must differ from fromCurrency. Currency code, 3 or 4 letters, upper-cased by the server (for example NGN, USD, USDC).

Required string length: 3 - 4
Example:

"NGN"

fromAmount
integer
required

Amount to sell, in the smallest unit of fromCurrency. Whole number of the smallest currency unit (kobo for NGN, cents for USD). Fractional values and amounts below 1 are rejected with a 400.

Required range: x >= 1
Example:

1000

description
string

Your own description for the transaction. Omitted, Rolla writes one naming the rate and the two amounts.

Required string length: 1 - 500
Example:

"Convert USD to NGN"

rateToken
string

rateToken from GET /wallet/rates, to execute at that quoted rate. Omitted, the swap executes at the current market rate.

Example:

"eyJhbGci..."

Response

Swap completed successfully

status
integer
required
Example:

200

message
string
required
Example:

"Swap completed successfully"

success
boolean
required
Example:

true

data
object
required