# Currency Exchange Endpoint

## Currency Exchange

<mark style="color:blue;">`GET`</mark> `https://api-stg.lime-pay.com/v3/exchange_rates?country={country}&amount={amount}`

The **`exchange_rates`** endpoint allow you to get the exchange of any currency compared against **USD**.

#### Query Parameters

| Name    | Type   | Description                                                               |
| ------- | ------ | ------------------------------------------------------------------------- |
| country | string | Country ISO code in whose local currency the amount will be converted to. |
| amount  | number | Amount to convert in USD. If none is specified, **`1`** will be assumed.  |

#### Headers

| Name          | Type   | Description                   |
| ------------- | ------ | ----------------------------- |
| Authorization | string | "Bearer " + Read-Only API Key |

### Example request

{% tabs %}
{% tab title="cURL" %}

```bash
curl --location --request GET 'https://api-stg.lime-pay.com/v3/exchange_rates?country=VN&amount=1' \
--header 'Authorization: Bearer your_read_only_key_here'


```

{% endtab %}

{% tab title="JAVA" %}

```java
import java.io.*;
import okhttp3.*;

public class main {
  public static void main(String []args) throws IOException{
    OkHttpClient client = new OkHttpClient().newBuilder()
      .build();
    Request request = new Request.Builder()
      .url("https://api-stg.lime-pay.com/v3/exchange_rates?country=VN&amount=10")
      .method("GET", null)
      .addHeader("Authorization", "Bearer your_read_only_key_here")
      .build();
    Response response = client.newCall(request).execute();
    System.out.println(response.body().string());
  }
}


```

{% endtab %}

{% tab title="C#" %}

```csharp
using System;
using RestSharp;

namespace HelloWorldApplication {
    class HelloWorld {
        static void Main(string[] args) {
            var client = new RestClient("https://api-stg.lime-pay.com/v3/exchange_rates?country=VN&amount=10");
            client.Timeout = -1;
            var request = new RestRequest(Method.GET);
            request.AddHeader("Authorization", "Bearer your_read_only_key_here");
            IRestResponse response = client.Execute(request);
            Console.WriteLine(response.Content);
        }
    }
}


```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api-stg.lime-pay.com/v3/exchange_rates?country=TH&amount=10",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Bearer your_read_only_key_here"
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;



```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="200 Currency exchange correctly returned." %}

```java
{
    "fx_rate": 26118.7500,
    "currency": "VND",
    "converted_amount": 26118.7500
}
```

{% endtab %}

{% tab title="401 Invalid credentials error" %}

```java
{
    "code": 100,
    "description": "Invalid credentials",
    "type": "INVALID_CREDENTIALS"
}
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
Please find all the country codes in the [Countries Specifications](/knowledge-base/countries-specifications.md#details) section.
{% endhint %}

### Response fields

| Field name         | Format | Description                                                                                              |
| ------------------ | ------ | -------------------------------------------------------------------------------------------------------- |
| `fx_rate`          | Number | Currency exchange                                                                                        |
| `currency`         | String | [Currency](/knowledge-base/countries-specifications.md#countries-and-currencies) used for the conversion |
| `converted_amount` | Number | Amount resulting from multiplying the `amount` you sent with the `fx_rate`                               |


---

# 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.lime-pay.com/api-documentation/deposits-api/endpoints/currency-exchange-endpoint.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.
