Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Previewing quote

POST /api/public/v1/exchange/quotes/build

Returns the amounts, rate and fee of a quote without creating it. Use it to show a conversion preview before calling Create quote. Nothing is stored or reserved: the response has an empty id and cannot be confirmed.

The preview is priced at the live rate with your account's spread and fee, so a quote created a moment later can differ slightly. The preview does not check your balance; an insufficient balance is reported by Create quote.

Headers

Name
Value

Content-Type

application/vnd.api+json

Authorization

Bearer <api_key>

Request Body

Name
Type
Required
Description

data.type

string

Yes

Always quotes.

data.attributes.accountChargedId

string

Yes

Account to convert from. See Listing accounts.

data.attributes.accountReceivedId

string

Yes

Account to convert to.

data.attributes.amount

number

Yes

Amount to convert.

data.attributes.amountCurrency

string

Yes

Currency of amount: either the charged account's or the received account's currency. When it is the received currency, amountReceived equals amount and the fee is added to amountCharged; otherwise the fee is deducted from amountReceived.

cURL

curl -X "POST" "https://api.sandbox.txn.io/api/public/v1/exchange/quotes/build" \
     -H 'Content-Type: application/vnd.api+json' \
     -H 'Authorization: Bearer <api_key>' \
     -d $'{
  "data": {
    "type": "quotes",
    "attributes": {
      "accountChargedId": "13a85b45-8543-41c7-b963-394d4ea128ae",
      "accountReceivedId": "e289de2b-37bd-4eff-b832-f754c31a2d95",
      "amount": "100",
      "amountCurrency": "EUR"
    }
  }
}'

Response Body

The attributes are the same as in Create quote, with these differences:

Name
Type
Description

data.id

string

Always empty. A preview is not stored and cannot be confirmed.

data.attributes.status

string

Always pending.

data.attributes.expiresAt

string

Indicative only. The preview itself does not expire; create a quote to lock a rate.

data.attributes.amountCharged

string

Amount that would be debited from the charged account, fee included.

data.attributes.amountReceived

string

Amount that would be credited to the received account.

data.attributes.rate

string

Rate applied, spread included, expressed in rateCurrency.

data.attributes.exchangeFee

string

Txn fee, in exchangeFeeCurrency.

data.relationships.exchangeOrder

object

The order placed with the liquidity provider for this quote. data.type is orders; the entity is returned in included[]. data.id is empty: a preview is not stored.

data.relationships.transactions

array

The account transactions booked by the exchange: the debit on accountChargedId and the credit on accountReceivedId. data[].type is transactions; the entities are returned in included[]. Always empty: a preview is not executed.

data.relationships.accountCharged

object

The account debited. data.type is accounts and data.id equals data.attributes.accountChargedId; the entity is returned in included[].

data.relationships.accountReceived

object

The account credited. data.type is accounts and data.id equals data.attributes.accountReceivedId; the entity is returned in included[].

data.relationships.author

object

Not expanded (meta.included is false).

included[].type(orders)

object

The order placed with the liquidity provider. Its id is empty in a preview.

included[].type(orders).attributes.baseCode

string

Base currency of the traded pair, e.g. USDT for USDT/EUR. One of data.attributes.amountChargedCurrency and data.attributes.amountReceivedCurrency.

included[].type(orders).attributes.quoteCode

string

Quote currency of the traded pair: the other of the two.

included[].type(orders).attributes.quantity

string

Order size, always in baseCode: whichever of amountCharged and amountReceived is in the base currency.

included[].type(accounts)

object

The two accounts involved (data.relationships.accountCharged and data.relationships.accountReceived). Same fields as Reading account; the ones most relevant here are listed below.

included[].type(accounts).attributes.currencyCode

string

data.attributes.amountChargedCurrency for the charged account, data.attributes.amountReceivedCurrency for the received account.

included[].type(accounts).attributes.label

string

Account label.

included[].type(accounts).attributes.master

boolean

true for the master account, false for a subaccount.

included[].type(accounts).attributes.balance

string

Account balance at the time of the request.

included[].type(accounts).attributes.currencyType

string

fiat or crypto.

included[].type(accounts).relationships

object

company, networks and txnBankCredentials: not expanded (meta.included is false).

Response

Last updated