Skip to main content
POST
JavaScript

Authorizations

Authorization
string
header
required

An Account API key, account-scoped JWT, App API key, or user OAuth token. Prepend the key or token with Bearer, for example Bearer ***************************.

Headers

Idempotency-Key
string

A unique key that makes this request safe to retry. See Idempotent requests.

Maximum string length: 255
Example:

"d9105228-4a08-46b1-8b91-42fed586d383"

Body

application/json
account_id
string
required

Business or user account ID (biz_* / user_*).

from_token
string
required

Source token contract address or ticker symbol, such as "USDT".

to_token
string
required

Destination token contract address or ticker symbol, such as "XAUT".

amount
string | null

Source token amount. Required for crypto swaps. For fiat pairs: the amount of from_token to convert at the mid-market rate; omit (along with to_amount) to repay the full negative to_token balance instead.

from_chain

Source chain name or chain ID. Defaults to the source token's chain when omitted.

slippage_bps
integer | null

Maximum slippage tolerance in basis points.

to_amount
string | null

Fiat pairs only: sizes a partial repayment of the negative to_token balance, denominated in to_token. Must not exceed the debt. Mutually exclusive with amount.

to_chain

Destination chain name or chain ID. Defaults to the destination token's chain when omitted.

Response

swap created

account_id
string
required

Account ID that owns the wallet used for the swap.

object
enum<string>
required
Available options:
swap
status
enum<string>
required

Swap status. Crypto swaps start queued; fiat conversions return complete, or working while a stablecoin repayment settles.

Available options:
queued,
working,
complete,
failed
amount_in
number | null

Fiat pairs only: amount of the source currency converted. Null while a stablecoin repayment is processing.

amount_out
number | null

Fiat pairs only: amount credited in the destination currency. Null while a stablecoin repayment is processing.

amount_out_expected
string

Expected destination token amount.

amount_out_min
string

Minimum destination amount after slippage.

from_token
object | null

Fiat pairs only: the source currency.

id
string

Swap ID. Poll GET /swaps/:id for status.

rate
string

Quoted exchange rate used to create the swap.

to_chain
string

Destination chain for the swap.

to_token
object | null

Fiat pairs only: the destination currency.