# Creating quote

## Create quote

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

This endpoint creates quotes.

**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="/pages/JNW72V75tuF0e3CXGcb4">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="/pages/JNW72V75tuF0e3CXGcb4">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"
    }
  }
}
```

**Response**

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

```json
{
  "data": {
    "id": "d00edf6e-aa93-4461-ba0b-ebc9055e9e1b",
    "type": "exchangeQuotes",
    "attributes": {
      "expiresAt": "2025-05-23T09:49:47.431Z",
      "amountCharged": "0.0010418",
      "amountReceived": "100.0",
      "rate": "96947.532",
      "exchangeFee": "1.00",
      "exchangeFeeCurrency": "EUR",
      "rateCurrency": "EUR",
      "accountChargedId": "5850abb7-0a60-4041-800c-1d43b4dcf4d6",
      "accountReceivedId": "acd50522-de49-4aaa-a183-dc046ff27fd5",
      "status": "pending",
      "amountChargedCurrency": "BTC",
      "amountReceivedCurrency": "EUR"
    },
    "relationships": {
      "exchangeOrder": {
        "data": {
          "type": "orders",
          "id": "44f5d889-1532-4846-ad8d-3796de9cf49d"
        }
      },
      "transactions": {
        "data": []
      }
    }
  },
  "included": [
    {
      "id": "44f5d889-1532-4846-ad8d-3796de9cf49d",
      "type": "orders",
      "attributes": {
        "baseCode": "BTC",
        "quoteCode": "EUR",
        "quantity": "0.0010418"
      }
    }
  ],
  "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></tbody></table>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.txn.io/exchange/creating-quote.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
