# Convert Currency

## /convert-currency

This endpoint performs currency conversion from one currency to another based on the provided parameters. It accepts a GET request with query parameters including the `value`, `fromCurrency`, and `toCurrency`. If any of these parameters are missing, it returns a custom HTML page indicating missing parameters. If the conversion is successful, it returns the converted value. If the `format` parameter is set to 'true', the converted value will be formatted with the currency symbol. If the conversion fails or an error occurs, it returns a corresponding error message with a status code of 400 or 500.

### Query Parameters

| Parameter    | Type   | Description                                                                                  |
| ------------ | ------ | -------------------------------------------------------------------------------------------- |
| value        | number | The value to be converted.                                                                   |
| fromCurrency | string | The currency code of the value to be converted from.                                         |
| toCurrency   | string | The currency code of the value to be converted to.                                           |
| format       | string | (Optional) If set to 'true', the converted value will be formatted with the currency symbol. |

### Response

```json
{
  "convertedValue": "string | number"
}
```

### Example

```
GET /convert-currency?value=100&fromCurrency=USD&toCurrency=EUR&format=true
```

### Supported Currency Codes and Symbols

* **USD**: United States Dollar ($)
* **EUR**: Euro (€)
* **GBP**: British Pound Sterling (£)
* **JPY**: Japanese Yen (¥)
* **CNY**: Chinese Yuan (¥)
* **AUD**: Australian Dollar (A$)
* **CAD**: Canadian Dollar (C$)
* **CHF**: Swiss Franc (CHF)
* **SEK**: Swedish Krona (kr)
* **NZD**: New Zealand Dollar (NZ$)
* **KRW**: South Korean Won (₩)
* **SGD**: Singapore Dollar (S$)
* **NOK**: Norwegian Krone (kr)
* **MXN**: Mexican Peso (Mex$)
* **INR**: Indian Rupee (₹)
* **RUB**: Russian Ruble (₽)
* **ZAR**: South African Rand (R)
* **HKD**: Hong Kong Dollar (HK$)
* **TRY**: Turkish Lira (₺)
* **BRL**: Brazilian Real (R$)
* **TWD**: New Taiwan Dollar (NT$)
* **DKK**: Danish Krone (kr)
* **PLN**: Polish Złoty (zł)
* **THB**: Thai Baht (฿)
* **CZK**: Czech Crown (Kč)

### Notes

* If the conversion is successful, the converted value will be returned as a JSON response. Optionally formatted with the currency symbol if requested.
* If the provided currency codes are invalid or not supported, a 400 error response with an error message will be returned.
* If any error occurs during currency conversion, a 500 error response with an error message will be returned.
* If the symbol is not available for the wanted currency you will receive a message like:\
  `This currency doesn't have a symbol`


---

# 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.ziomark.xyz/get-endpoints/convert-currency.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.
