# API Endpoints

## Get latest rates

<mark style="color:blue;">`GET`</mark> `https://api.cakes.com/v1/:format/latest/:base_currency?token=premiumtoken`

#### Path Parameters

| Name           | Type   | Description                                                                                          |
| -------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| base\_currency | string | <p>Currency you want to base on \[EUR/USD/CAD/AED/...] <br>All supported currencies are possible</p> |
| format         | string | Response format: \[json/xml]                                                                         |

#### Query Parameters

| Name  | Type   | Description                                      |
| ----- | ------ | ------------------------------------------------ |
| token | string | You premium token to get even more accurate data |

{% tabs %}
{% tab title="200 Rates successfully retrieved." %}

```javascript
{
    "timestamp_utc":"2018-07-16 13:52:05",
    "base_currency":"EUR",
    "rates":{
        "AED":{
            "currency":"AED",
            "rate":4.303
        },
        "AMD":{
            "currency":"AMD",
            "rate":5.59
        },
        "ANG":{
            "currency":"ANG",
            "rate":2.154
        },
        ...
}
```

{% endtab %}

{% tab title="403 The token you did provide was not found in the database" %}

```javascript
{
    "errorcode":98,
    "message":"Given premium token is not valid"
}
```

{% endtab %}

{% tab title="404 The base\_currency you entered is not valid" %}

```javascript
{
    "errorcode":2,
    "message":"base currency is not valid"
}
```

{% endtab %}
{% endtabs %}

#### Examples

1\) Get latest rates for base **Euro** as **JSON**

```
https://api.currex.info/v1/json/latest/EUR
```

2\) Get latest rates for base United Arab Emirates Dirham as XML

```
https://api.currex.info/v1/xml/latest/AED
```

## ★ Get in-depth information about the currencies

<mark style="color:blue;">`GET`</mark> `https://api.currex.info/v1/:format/info/:single_currency?token=premiumtoken`

\[Premium API Endpoint] Please get a premium token to be able to access this information.

#### Path Parameters

| Name             | Type   | Description                                                                     |
| ---------------- | ------ | ------------------------------------------------------------------------------- |
| single\_currency | string | Currency code for a single currency if you only want to get info about that one |
| format           | string | Response format: \[json/xml]                                                    |

#### Query Parameters

| Name  | Type   | Description                                            |
| ----- | ------ | ------------------------------------------------------ |
| token | string | Your premium token to access this premium api endpoint |

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

```
```

{% endtab %}
{% endtabs %}

#### Examples

1\) Get info about all currencies supported by Currex as JSON

```
https://api.currex.info/v1/json/info?token=■■■■■■■■■■
```

*Replace ■■■■■■■■ with your own token*

2\) Get info only about Euro as XML

```
https://api.currex.info/v1/xml/info/EUR?token=■■■■■■■■■■
```

*Replace ■■■■■■■■ with your own token*


---

# 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://documentation.currex.info/documentation/master.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.
