# X Rates — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> X Rates provides 7 callable API endpoints through the Parse marketplace.

**Category:** Finance & Markets | **Website:** [x-rates.com/](https://x-rates.com/) | **Docs:** [parse.bot/marketplace/4f709f5d-e9bb-431c-bec5-75207a122c25/x-rates-com-api](https://parse.bot/marketplace/4f709f5d-e9bb-431c-bec5-75207a122c25/x-rates-com-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-x-rates-com-api-4f709f5d/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### convert_currency

Performs a currency conversion from one currency to another for a given amount. Returns the converted value and a text representation. Conversion uses the latest available rate.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `amount` | number | No | Amount to convert. |
| `from` | string | Yes | Source currency code (e.g. USD, EUR, GBP). |
| `to` | string | Yes | Target currency code (e.g. EUR, JPY, GBP). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-x-rates-com-api-4f709f5d/convert_currency \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":"<number>","from":"<string>","to":"<string>"}'
```

### get_24h_percent_changes

Extracts the 'Percent Change in the Last 24 Hours' widget data for major currency pairs from the homepage. Returns ~8 major pairs with their percentage change and direction (up/down).

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-x-rates-com-api-4f709f5d/get_24h_percent_changes \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_current_rates_table

Fetches the current exchange rates table for a given base currency against all other supported currencies. Returns rate and inverse rate for each currency pair. The table includes ~50 currencies. Rates update multiple times daily.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `amount` | number | No | Amount to calculate rates for. |
| `from` | string | No | Base currency code (e.g. USD, EUR, GBP). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-x-rates-com-api-4f709f5d/get_current_rates_table \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":"<number>","from":"<string>"}'
```

### get_graph_data

Returns exchange rate trend data points for a currency pair for the current year, suitable for generating graphs. Each data point contains a month abbreviation label and the rate value.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `amount` | number | No | Amount to calculate rates for. |
| `from` | string | Yes | Source currency code (e.g. USD). |
| `to` | string | Yes | Target currency code (e.g. EUR). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-x-rates-com-api-4f709f5d/get_graph_data \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":"<number>","from":"<string>","to":"<string>"}'
```

### get_historical_rates_table

Fetches historical exchange rates for a base currency against all supported currencies on a specific date. The date must be in ISO YYYY-MM-DD format. Returns the same structure as the current rates table but for the specified historical date.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `amount` | number | No | Amount to calculate rates for. |
| `date` | string | Yes | Historical date in ISO format YYYY-MM-DD. |
| `from` | string | No | Base currency code. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-x-rates-com-api-4f709f5d/get_historical_rates_table \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":"<number>","date":"<string>","from":"<string>"}'
```

### get_monthly_average

Retrieves monthly average exchange rates for a specific currency pair for a given year. Returns up to 12 monthly data points with the average rate and number of days in each month. Defaults to the current year if year is not specified.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `amount` | number | No | Amount to calculate rates for. |
| `from` | string | Yes | Source currency code (e.g. USD). |
| `to` | string | Yes | Target currency code (e.g. EUR). |
| `year` | string | No | Year in YYYY format. Defaults to the current year. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-x-rates-com-api-4f709f5d/get_monthly_average \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":"<number>","from":"<string>","to":"<string>","year":"<string>"}'
```

### get_supported_currencies

Retrieves the full list of supported currencies and their codes from x-rates.com. Returns approximately 54 currencies with their display names and ISO 4217 codes.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-x-rates-com-api-4f709f5d/get_supported_currencies \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```
