> For the complete documentation index, see [llms.txt](https://docs.txn.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.txn.io/exchange/previewing-quote.md).

# Previewing quote

<mark style="color:green;">`POST`</mark> `/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](https://docs.txn.io/exchange/creating-quote.md). 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**

<table><thead><tr><th>Name</th><th width="100">Type</th><th width="105">Required</th><th>Description</th></tr></thead><tbody><tr><td>data.type</td><td>string</td><td>Yes</td><td>Always <code>quotes</code>.</td></tr><tr><td>data.attributes.accountChargedId</td><td>string</td><td>Yes</td><td>Account to convert from. See <a href="https://docs.txn.io/accounts/listing-accounts.md">Listing accounts</a>.</td></tr><tr><td>data.attributes.accountReceivedId</td><td>string</td><td>Yes</td><td>Account to convert to.</td></tr><tr><td>data.attributes.amount</td><td>number</td><td>Yes</td><td>Amount to convert.</td></tr><tr><td>data.attributes.amountCurrency</td><td>string</td><td>Yes</td><td>Currency of <code>amount</code>: either the charged account's or the received account's currency. When it is the received currency, <code>amountReceived</code> equals <code>amount</code> and the fee is added to <code>amountCharged</code>; otherwise the fee is deducted from <code>amountReceived</code>.</td></tr></tbody></table>

**cURL**

```bash
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](https://docs.txn.io/exchange/creating-quote.md), with these differences:

<table><thead><tr><th>Name</th><th width="97">Type</th><th>Description</th></tr></thead><tbody><tr><td>data.id</td><td>string</td><td>Always empty. A preview is not stored and cannot be confirmed.</td></tr><tr><td>data.attributes.status</td><td>string</td><td>Always <code>pending</code>.</td></tr><tr><td>data.attributes.expiresAt</td><td>string</td><td>Indicative only. The preview itself does not expire; create a quote to lock a rate.</td></tr><tr><td>data.attributes.amountCharged</td><td>string</td><td>Amount that would be debited from the charged account, fee included.</td></tr><tr><td>data.attributes.amountReceived</td><td>string</td><td>Amount that would be credited to the received account.</td></tr><tr><td>data.attributes.rate</td><td>string</td><td>Rate applied, spread included, expressed in <code>rateCurrency</code>.</td></tr><tr><td>data.attributes.exchangeFee</td><td>string</td><td>Txn fee, in <code>exchangeFeeCurrency</code>.</td></tr><tr><td>data.relationships.exchangeOrder</td><td>object</td><td>The order placed with the liquidity provider for this quote. <code>data.type</code> is <code>orders</code>; the entity is returned in <code>included[]</code>. <code>data.id</code> is empty: a preview is not stored.</td></tr><tr><td>data.relationships.transactions</td><td>array</td><td>The account transactions booked by the exchange: the debit on <code>accountChargedId</code> and the credit on <code>accountReceivedId</code>. <code>data[].type</code> is <code>transactions</code>; the entities are returned in <code>included[]</code>. Always empty: a preview is not executed.</td></tr><tr><td>data.relationships.accountCharged</td><td>object</td><td>The account debited. <code>data.type</code> is <code>accounts</code> and <code>data.id</code> equals <code>data.attributes.accountChargedId</code>; the entity is returned in <code>included[]</code>.</td></tr><tr><td>data.relationships.accountReceived</td><td>object</td><td>The account credited. <code>data.type</code> is <code>accounts</code> and <code>data.id</code> equals <code>data.attributes.accountReceivedId</code>; the entity is returned in <code>included[]</code>.</td></tr><tr><td>data.relationships.author</td><td>object</td><td>Not expanded (<code>meta.included</code> is <code>false</code>).</td></tr><tr><td>included[].type(orders)</td><td>object</td><td>The order placed with the liquidity provider. Its <code>id</code> is empty in a preview.</td></tr><tr><td>included[].type(orders).attributes.baseCode</td><td>string</td><td>Base currency of the traded pair, e.g. <code>USDT</code> for <code>USDT</code>/<code>EUR</code>. One of <code>data.attributes.amountChargedCurrency</code> and <code>data.attributes.amountReceivedCurrency</code>.</td></tr><tr><td>included[].type(orders).attributes.quoteCode</td><td>string</td><td>Quote currency of the traded pair: the other of the two.</td></tr><tr><td>included[].type(orders).attributes.quantity</td><td>string</td><td>Order size, always in <code>baseCode</code>: whichever of <code>amountCharged</code> and <code>amountReceived</code> is in the base currency.</td></tr><tr><td>included[].type(accounts)</td><td>object</td><td>The two accounts involved (<code>data.relationships.accountCharged</code> and <code>data.relationships.accountReceived</code>). Same fields as <a href="https://docs.txn.io/accounts/reading-account.md">Reading account</a>; the ones most relevant here are listed below.</td></tr><tr><td>included[].type(accounts).attributes.currencyCode</td><td>string</td><td><code>data.attributes.amountChargedCurrency</code> for the charged account, <code>data.attributes.amountReceivedCurrency</code> for the received account.</td></tr><tr><td>included[].type(accounts).attributes.label</td><td>string</td><td>Account label.</td></tr><tr><td>included[].type(accounts).attributes.master</td><td>boolean</td><td><code>true</code> for the master account, <code>false</code> for a subaccount.</td></tr><tr><td>included[].type(accounts).attributes.balance</td><td>string</td><td>Account balance at the time of the request.</td></tr><tr><td>included[].type(accounts).attributes.currencyType</td><td>string</td><td><code>fiat</code> or <code>crypto</code>.</td></tr><tr><td>included[].type(accounts).relationships</td><td>object</td><td><code>company</code>, <code>networks</code> and <code>txnBankCredentials</code>: not expanded (<code>meta.included</code> is <code>false</code>).</td></tr></tbody></table>

**Response**

{% tabs %}
{% tab title="HTTP 200" %}

```json
{
  "data": {
    "id": "",
    "type": "exchangeQuotes",
    "attributes": {
      "expiresAt": "2026-10-30T15:29:11.023Z",
      "amountCharged": "100.0",
      "amountReceived": "109.933461",
      "rate": "0.90509295",
      "exchangeFee": "0.50",
      "exchangeFeeCurrency": "EUR",
      "rateCurrency": "EUR",
      "accountChargedId": "13a85b45-8543-41c7-b963-394d4ea128ae",
      "accountReceivedId": "e289de2b-37bd-4eff-b832-f754c31a2d95",
      "status": "pending",
      "amountChargedCurrency": "EUR",
      "amountReceivedCurrency": "USDT"
    },
    "relationships": {
      "exchangeOrder": {
        "data": {
          "type": "orders",
          "id": ""
        }
      },
      "transactions": {
        "data": []
      },
      "author": {
        "meta": {
          "included": false
        }
      },
      "accountCharged": {
        "data": {
          "type": "accounts",
          "id": "13a85b45-8543-41c7-b963-394d4ea128ae"
        }
      },
      "accountReceived": {
        "data": {
          "type": "accounts",
          "id": "e289de2b-37bd-4eff-b832-f754c31a2d95"
        }
      }
    }
  },
  "included": [
    {
      "id": "",
      "type": "orders",
      "attributes": {
        "baseCode": "USDT",
        "quoteCode": "EUR",
        "quantity": "109.933461"
      }
    },
    {
      "id": "13a85b45-8543-41c7-b963-394d4ea128ae",
      "type": "accounts",
      "attributes": {
        "master": true,
        "currencyCode": "EUR",
        "label": "master",
        "bankReference": "BDR6421088115176062",
        "balance": "39272.08",
        "totalBalance": null,
        "bankWithdrawalAvailable": true,
        "bankDepositAvailable": true,
        "transferAvailable": true,
        "currencyType": "fiat"
      },
      "relationships": {
        "company": {
          "meta": {
            "included": false
          }
        },
        "networks": {
          "meta": {
            "included": false
          }
        },
        "txnBankCredentials": {
          "meta": {
            "included": false
          }
        }
      }
    },
    {
      "id": "e289de2b-37bd-4eff-b832-f754c31a2d95",
      "type": "accounts",
      "attributes": {
        "master": true,
        "currencyCode": "USDT",
        "label": "master",
        "bankReference": "BDR4180381621673581",
        "balance": "306918.220680",
        "totalBalance": null,
        "bankWithdrawalAvailable": false,
        "bankDepositAvailable": false,
        "transferAvailable": true,
        "currencyType": "crypto"
      },
      "relationships": {
        "company": {
          "meta": {
            "included": false
          }
        },
        "networks": {
          "meta": {
            "included": false
          }
        },
        "txnBankCredentials": {
          "meta": {
            "included": false
          }
        }
      }
    }
  ],
  "meta": {},
  "jsonapi": {
    "version": "1.0"
  }
}
```

{% endtab %}

{% tab title="HTTP 422" %}

```json
{
  "errors": [
    {
      "status": 422,
      "title": "Amount is below minimum",
      "code": "amount_below_minimum",
      "detail": "Amount 0.5 EUR is below the minimum of 9.05 EUR"
    }
  ]
}
```

{% endtab %}

{% tab title="HTTP 422" %}

```json
{
  "errors": [
    {
      "status": 422,
      "title": "Amount is above maximum",
      "code": "amount_above_maximum",
      "detail": "Amount 1,000,000 EUR is above the maximum of 135,744.34 EUR"
    }
  ]
}
```

{% endtab %}

{% tab title="HTTP 422" %}

```json
{
  "errors": [
    {
      "status": 422,
      "title": "Incorrect currency",
      "code": "incorrect_currency",
      "detail": "Amount currency must be one of the currency pair currencies"
    }
  ]
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.txn.io/exchange/previewing-quote.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
