> 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/creating-quote.md).

# Creating quote

<mark style="color:green;">`POST`</mark> `/api/public/v1/exchange/quotes`

Creates a quote: a guaranteed rate to convert an amount between two of your accounts. `accountChargedId` is the account to debit and `accountReceivedId` the account to credit; `amount` with `amountCurrency` can be expressed in either account's currency. The response states `amountCharged`, `amountReceived`, the `rate` and the `exchangeFee`. The quote is valid for 30 seconds (`expiresAt`): confirm it with [Confirming quote](https://docs.txn.io/exchange/confirming-quote.md) to execute the exchange. The charged account must already hold `amountCharged`. To see the numbers without creating a quote, use [Previewing quote](https://docs.txn.io/exchange/previewing-quote.md).

**Headers**

| Name          | Value                      |
| ------------- | -------------------------- |
| Content-Type  | `application/vnd.api+json` |
| Authorization | `Bearer <api_token>`       |

**Body**

<table><thead><tr><th>Name</th><th width="116">Type</th><th>Description</th></tr></thead><tbody><tr><td>data</td><td>object</td><td>Object with exchange request data.</td></tr><tr><td>data.type</td><td>string</td><td>Exchange request type. Always <code>quotes</code>.</td></tr><tr><td>data.attributes</td><td>object</td><td>A set of exchange request attributes.</td></tr><tr><td>data.attributes.accountChargedId</td><td>string</td><td>Account ID from which funds are being converted. 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>Account ID to which funds are being converted. See <a href="https://docs.txn.io/accounts/listing-accounts.md">Listing Accounts</a>.</td></tr><tr><td>data.attributes.amount</td><td>number</td><td>Exchange amount.</td></tr><tr><td>data.attributes.amountCurrency</td><td>string</td><td>Exchange amount currency. Can be the currency associated with the <code>accountCharged</code> or <code>accountReceived</code>.</td></tr></tbody></table>

**Request JSON**

```json
{
  "data": {
    "type": "quotes",
    "attributes": {
      "accountChargedId": "string",
      "accountReceivedId": "string",
      "amount": "number",
      "amountCurrency": "string"
    }
  }
}
```

**cURL**

```bash
curl -X "POST" "https://api.sandbox.txn.io/api/public/v1/exchange/quotes" \
     -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**

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

```json
{
  "data": {
    "id": "f13501a9-cb6f-4789-acfc-fde88a6fe00c",
    "type": "exchangeQuotes",
    "attributes": {
      "expiresAt": "2026-11-01T13:27:36.958Z",
      "amountCharged": "100.0",
      "amountReceived": "110.606489",
      "rate": "0.89958555",
      "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": "6c255add-5123-4b2f-8bf8-f883217e680c"
        }
      },
      "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": "6c255add-5123-4b2f-8bf8-f883217e680c",
      "type": "orders",
      "attributes": {
        "baseCode": "USDT",
        "quoteCode": "EUR",
        "quantity": "110.606489"
      }
    },
    {
      "id": "13a85b45-8543-41c7-b963-394d4ea128ae",
      "type": "accounts",
      "attributes": {
        "master": true,
        "currencyCode": "EUR",
        "label": "master",
        "bankReference": "BDR6421088115176062",
        "balance": "39261.07",
        "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"
    }
  ]
}
```

{% endtab %}

{% tab title="HTTP 422" %}

```json
{
  "errors": [
    {
      "status": 422,
      "title": "amount is above maximum",
      "code": "amount_above_maximum"
    }
  ]
}
```

{% endtab %}

{% tab title="HTTP 422" %}

```json
{
  "errors": [
    {
      "status": 422,
      "title": "account has insufficient balance",
      "code": "account_has_insufficient_balance"
    }
  ]
}
```

{% endtab %}
{% endtabs %}

**Response Body**

<table><thead><tr><th>Name</th><th width="115">Type</th><th>Description</th></tr></thead><tbody><tr><td>data.id</td><td>string</td><td>Quote ID.</td></tr><tr><td>data.type</td><td>string</td><td>Entity type returned. Always <code>exchangeQuotes</code>.</td></tr><tr><td>data.attributes</td><td>object</td><td>A set of quote attributes.</td></tr><tr><td>data.attributes.amountCharged</td><td>string</td><td>Amount to be debited from your <code>accountChargedId</code>.</td></tr><tr><td>data.attributes.amountChargedCurrency</td><td>string</td><td>Account charged currency code.</td></tr><tr><td>data.attributes.amountReceivedCurrency</td><td>string</td><td>Account received currency code.</td></tr><tr><td>data.attributes.amountReceived</td><td>string</td><td>Amount to be credited to your <code>accountReceivedId</code>.</td></tr><tr><td>data.attributes.rate</td><td>string</td><td>Exchange rate.</td></tr><tr><td>data.attributes.status</td><td>string</td><td>One of: <code>pending</code>, <code>completed</code>, <code>expired</code>, or <code>failed</code>. Note: A transaction with status <code>failed</code> can be updated to <code>completed</code> via a support request.</td></tr><tr><td>data.attributes.rateCurrency</td><td>string</td><td>Exchange rate currency code.</td></tr><tr><td>data.attributes.exchangeFee</td><td>string</td><td>Txn fee amount.</td></tr><tr><td>data.attributes.exchangeFeeCurrency</td><td>string</td><td>Fee currency code.</td></tr><tr><td>data.attributes.expiresAt</td><td>string</td><td>Quote expiry timestamp.</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>.</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>. Empty until the quote is confirmed and executed, and for quotes created by an invoice settlement, whose credit is booked on the invoice instead.</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.</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(transactions)</td><td>object</td><td>One entry per balance movement, in the shape returned by <a href="https://docs.txn.io/transactions/listing-transactions.md">Listing transactions</a>: the debit on the charged account and the credit on the received account. Present only once the quote has executed.</td></tr><tr><td>included[].type(transactions).attributes.amount</td><td>string</td><td><code>amountCharged</code> negated on the charged account; <code>amountReceived</code> on the received account.</td></tr><tr><td>included[].type(transactions).attributes.currency</td><td>string</td><td>Currency of that account.</td></tr><tr><td>included[].type(transactions).attributes.accountId</td><td>string</td><td><code>accountChargedId</code> or <code>accountReceivedId</code>.</td></tr><tr><td>included[].type(transactions).attributes.transactionType</td><td>string</td><td>Always <code>ExchangeTransaction</code>.</td></tr><tr><td>included[].type(transactions).attributes.simplifiedState</td><td>string</td><td>Always <code>completed</code>: both transactions are booked when the order executes.</td></tr><tr><td>included[].type(transactions).attributes.balance</td><td>string</td><td>Always <code>null</code> here. The running balance is only computed by the transaction listings.</td></tr><tr><td>included[].type(transactions).attributes.reference</td><td>string</td><td>Always <code>null</code> for exchange transactions.</td></tr><tr><td>included[].type(transactions).attributes.createdAt</td><td>string</td><td>When the order executed.</td></tr><tr><td>included[].type(transactions).relationships</td><td>object</td><td><code>account</code>, <code>transactionDetails</code> and <code>author</code>: not expanded (<code>meta.included</code> is <code>false</code>).</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>


---

# 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/creating-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.
