# Forex OHLCV Candles

> Returns OHLCV candlestick data for a currency pair.

`GET https://api.bavest.co/v2/forex/candles/{pair}`

Group: Forex. Route id: `v2_forex_candles_pair`. Included in: Growth.

## Authentication

Send your API key in the `x-api-key` header on every request. No key yet? Sign up at https://dashboard.bavest.co/sign-up (free trial). The examples read the key from the `BAVEST_API_KEY` environment variable.

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `pair` | path | string | yes | Currency pair (e.g., `EURUSD`, `GBPJPY`) Example `EURUSD`. |
| `resolution` | query | string | no | Candle resolution. One of `D`, `W`, `M`. Default `D`. |
| `from` | query | string (date) | yes | Start date (YYYY-MM-DD). Required for candle data. Example `2026-09-01`. |
| `to` | query | string (date) | yes | End date (YYYY-MM-DD). Required for candle data. Example `2026-09-30`. |

## Response

200 Successful response (`application/json`).

| Field | Type | Always present | Description |
|---|---|---|---|
| `data` | array of ForexCandle | no |  |
| `data[].price` | number (double) | yes | Current price. Example: `1.1603`. |
| `data[].change` | number (double) \| null | no | Price change. Example: `-0.00054`. |
| `data[].changesPercentage` | number (double) \| null | no | Price change as a percentage. Example: `-0.04651804`. |
| `data[].dayHigh` | number (double) | no | Intraday high price. Example: `1.16456`. |
| `data[].dayLow` | number (double) | no | Intraday low price. Example: `1.15904`. |
| `data[].open` | number (double) | no | Opening price. Example: `1.16084`. |
| `data[].previousClose` | number (double) \| null | no | Previous session closing price. Example: `1.16084`. |
| `data[].timestamp` | string | yes | ISO 8601 timestamp. |
| `meta` | ResponseMeta | no | Response envelope metadata. Always present on a 200: `time` is set by `core/response.py` on every successful response. Errors carry the same block, built by the same code, so a client parses one meta shape whether the call succeeded or failed. |
| `meta.time` | integer | no | Server-side processing time in milliseconds. Example: `17`. |
| `meta.parameters` | object | no | Echo of the request parameters the endpoint resolved. |

## Example request

```bash
curl 'https://api.bavest.co/v2/forex/candles/EURUSD?resolution=D&from=2026-09-01&to=2026-09-30' \
  -H "x-api-key: $BAVEST_API_KEY"
```

## Example response

```json
{
  "data": [
    {
      "price": 1.16164,
      "change": -0.00061,
      "changesPercentage": -0.05248441,
      "timestamp": "2026-09-01T00:00:57",
      "dayLow": 1.16132,
      "dayHigh": 1.16225,
      "open": 1.16212,
      "previousClose": 1.16225
    },
    {
      "price": 1.16238,
      "change": 0.00013,
      "changesPercentage": 0.0111852,
      "timestamp": "2026-09-01T00:30:04",
      "dayLow": 1.16132,
      "dayHigh": 1.16279,
      "open": 1.16212,
      "previousClose": 1.16225
    }
  ],
  "meta": {
    "parameters": {
      "pair": "EURUSD",
      "from": "2026-09-01",
      "resolution": "D",
      "to": "2026-09-30"
    },
    "time": 3467
  }
}
```

## Errors

| Status | Meaning |
|---|---|
| 400 | Invalid request parameters. Returned when required query parameters are missing, have invalid types, or violate constraints (e.g., providing both symbol and isin when they are mutually exclusive). |
| 401 | Missing or invalid API key. |
| 404 | Resource not found. |
| 429 | Rate limit exceeded. Retry after the `Retry-After` header interval. |
| 500 | An unexpected error occurred on the server. If the issue persists, contact support with the X-Request-Id header value. |
| 502 | Upstream data provider returned an error or is temporarily unavailable. Retry after a short delay. |
| 504 | The request timed out waiting for a response from the upstream data provider. This may occur for complex queries or during peak load. |
| default | An unexpected error occurred on the server. If the issue persists, contact support with the X-Request-Id header value. |

- `403` from the gateway: the API key is invalid or switched off.
- `429` with message `Limit Exceeded`: the monthly quota of the key is used up. With `Too Many Requests`: the key is throttled, or this route is not in the key's plan. Wait for `Retry-After` when it is sent.

## Links

- HTML page: https://dashboard.bavest.co/docs/v2_forex_candles_pair
- OpenAPI: https://dashboard.bavest.co/openapi.json (YAML: https://dashboard.bavest.co/openapi.yaml)
- Authentication: https://dashboard.bavest.co/docs/authentication.md
- MCP server for AI agents: https://dashboard.bavest.co/docs/mcp.md
- All routes: https://dashboard.bavest.co/llms.txt
