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

# Quote

If you want to get the conversion rate of an amount in BRL (Brazilian Real) to the destination currency or token, you can use the quote endpoint before creating the transaction.

This conversion is designed to:

* Retrieve the current conversion rate for the selected currency/token;
* Return the final amount already converted into cryptocurrency;

Using the `/transaction/price_conversion` endpoint, you can get the quote for the requested amount in BRL/REAL converted to the current value in the chosen cryptocurrency.

### Payload example

```json
{
  "amount": "50.10",
  "currency_from_symbol": "BRL",
  "convert": "USDT"
}
```

## Performs the currency/token conversion.

<mark style="color:green;">`POST`</mark> `https://api.4p.finance/v1/transaction/price_conversion`

Returns a JSON with the total requested amount converted into the chosen currency/token.

#### Headers

| Name                                        | Type   | Description   |
| ------------------------------------------- | ------ | ------------- |
| x-api-key<mark style="color:red;">\*</mark> | String | Your API key. |

#### Request Body

| Name                                                     | Type   | Description                                                                  |
| -------------------------------------------------------- | ------ | ---------------------------------------------------------------------------- |
| amount<mark style="color:red;">\*</mark>                 | String | Amount to be converted. Example: 35.99.                                      |
| convert<mark style="color:red;">\*</mark>                | String | Symbol of the currency/token the amount will be converted to. Example: USDT. |
| currency\_from\_symbol<mark style="color:red;">\*</mark> | String | Symbol of the source currency/token. Example: BRL.                           |

{% tabs %}
{% tab title="200: OK JSON with the converted amount data." %}

```javascript
{
    "http_code": 200,
    "success": true,
    "info": {
        "result": "price_conversion_success",
        "message": "Price conversion successfully.",
        "data": {
            "id": 2783,
            "symbol": "BRL",
            "name": "Brazilian Real",
            "amount": "250.00",
            "last_updated": "2023-02-16T20:49:27.000Z",
            "quote": {
                "BTC": {
                    "price": 47.33,
                    "last_updated": "2026-01-01T20:49:00.000Z"
                }
            },
            "origin": "api",
            "dbprice": "bce"
        }
    }
}
```

{% endtab %}
{% endtabs %}
