# MetaApi GET /users/current/accounts/{accountId}/historical-market-data/symbols/{symbol}/timeframes/{timeframe}/candles

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/platforms/metaapi/endpoints/get-historical-candles, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

Download historical candles for one symbol and timeframe, loaded backwards from a start time, up to 1000 at a time.

- Request: `GET /users/current/accounts/{accountId}/historical-market-data/symbols/{symbol}/timeframes/{timeframe}/candles`
- Group: Market data
- Status: verified. Source: [metaapi.cloud](https://metaapi.cloud/docs/client/restApi/api/retrieveMarketData/readHistoricalCandles/), checked 2026-10-12.
- Official reference: https://metaapi.cloud/docs/client/restApi/api/retrieveMarketData/readHistoricalCandles/

Note: Read on 12 Oct 2026 on MetaApi's own reference page for this call. The method, path, parameters and required marks are that page's. The page writes each path parameter with a colon, as in :accountId, and this record writes it in braces. The page says the address in its example is valid for the New York region only, and that the addresses for other regions are on MetaApi's API access page. This call is served from a different host from the other MetaApi calls: the page's example uses mt-market-data-client-api-v1.new-york.agiliumtrade.ai. MetaApi does not count requests against this call: its rate limiting page says REST calls draw on CPU credits, granted per application, per server and per account, and that going over is answered 429 with a recommended time to retry. The rate limiting page adds that historical market data limits are counted apart from the rest and that concurrent requests per account are limited too. The page warns that the terminal may need longer than the default timeout of 4 minutes, and that an MT5 terminal can hang when candles are asked for a symbol with missing market data. The reply is a list of MetatraderCandle, so no mock object is shown.

## Parameters

- `accountId` (in path, type string, required): The MetaTrader account's id on MetaApi, shown in the web application once the account has been added, or read through the provisioning API. Marked required.
- `symbol` (in path, type string, required): The symbol to load candles for, such as a currency pair or an index. Marked required.
- `timeframe` (in path, type string, required): The candle size. For MT5: 1m, 2m, 3m, 4m, 5m, 6m, 10m, 12m, 15m, 20m, 30m, 1h, 2h, 3h, 4h, 6h, 8h, 12h, 1d, 1w, 1mn. For MT4: 1m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1mn. Marked required.
- `startTime` (in query, type string, optional): The time to load candles from. Candles are loaded backwards, so this is the latest time wanted. Left empty, the newest candles are returned. The page leaves its required column empty.
- `limit` (in query, type integer, optional): The most candles to return, 1000 or fewer. The page leaves its required column empty.

### Authentication headers

- `auth-token` (type string, required): The MetaApi authorisation token, from the MetaApi web application. Marked required. Placeholder only: never paste a real token into this site.

## Request

Written from the method, path and parameters recorded on this page. No demo host is recorded as a plain address for this API, so the samples read the base address from an environment variable. Not executed against a live or demo account. Credentials are read from environment variables on your own machine and are never entered on this site. The request builder at https://openbrokerapi.com/tools/request-builder writes these same snippets, from the same record.

### Python

```python
# Set METAAPI_BASE_URL, METAAPI_TOKEN, METAAPI_ACCOUNT_ID as environment variables first. Never paste real values into code.
# No demo host is recorded as a plain address for this API, so the base address is read from METAAPI_BASE_URL.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Optional and not shown: query parameters startTime, limit.
import os
import requests

BASE_URL = os.environ["METAAPI_BASE_URL"]
headers = {
    "auth-token": os.environ["METAAPI_TOKEN"],
}
resp = requests.get(BASE_URL + "/users/current/accounts/" + os.environ["METAAPI_ACCOUNT_ID"] + "/historical-market-data/symbols/{symbol}/timeframes/{timeframe}/candles", headers=headers, timeout=10)
resp.raise_for_status()
print(resp.json())
```

### JavaScript

```javascript
// Set METAAPI_BASE_URL, METAAPI_TOKEN, METAAPI_ACCOUNT_ID as environment variables first. Never paste real values into code.
// No demo host is recorded as a plain address for this API, so the base address is read from METAAPI_BASE_URL.
// Replace each {placeholder}, "..." and 0 with a real value before running.
// Optional and not shown: query parameters startTime, limit.
// Run as a module, for example a .mjs file, on a Node version that has fetch built in.
const BASE_URL = process.env.METAAPI_BASE_URL;
const res = await fetch(BASE_URL + "/users/current/accounts/" + process.env.METAAPI_ACCOUNT_ID + "/historical-market-data/symbols/{symbol}/timeframes/{timeframe}/candles", {
  method: "GET",
  headers: {
    "auth-token": process.env.METAAPI_TOKEN,
  },
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
console.log(await res.json());
```

### curl

```bash
# Set METAAPI_BASE_URL, METAAPI_TOKEN, METAAPI_ACCOUNT_ID as environment variables first. Never paste real values into code.
# No demo host is recorded as a plain address for this API, so the base address is read from METAAPI_BASE_URL.
# Replace each {placeholder}, "..." and 0 with a real value before running.
# Optional and not shown: query parameters startTime, limit.
curl -X GET "$METAAPI_BASE_URL/users/current/accounts/$METAAPI_ACCOUNT_ID/historical-market-data/symbols/{symbol}/timeframes/{timeframe}/candles" \
  -H "auth-token: $METAAPI_TOKEN"
```

## Response

No mock response is recorded for this endpoint. That is a statement about this record, not about what the API returns: read the shape of the reply in the [official reference](https://metaapi.cloud/docs/client/restApi/api/retrieveMarketData/readHistoricalCandles/).

## Limits that apply at MetaApi

- CPU credits per account: 5,000 CPU credits per 10 seconds
  - Scope: Per MetaTrader account. REST and RPC calls only
  - Status: verified. Source: [metaapi.cloud](https://metaapi.cloud/docs/client/rateLimiting/), checked 2026-10-12.
  - Note: The window is 10 seconds, which a single unit cannot state, so the figure stays as wording.
- CPU credits an hour, per application: 18,000 credits per hour
  - Scope: Per application, multiplied by the number of accounts deployed to MetaApi. REST and RPC calls only, counted in CPU credits and not in requests
  - Status: verified. Source: [metaapi.cloud](https://metaapi.cloud/docs/client/rateLimiting/), checked 2026-10-12.
  - Note: Also 43,200 credits per 6 hours.
- CPU credits a minute, per application: 6,000 credits per minute
  - Scope: Per application, multiplied by the number of accounts deployed to MetaApi. REST and RPC calls only, counted in CPU credits and not in requests
  - Status: verified. Source: [metaapi.cloud](https://metaapi.cloud/docs/client/rateLimiting/), checked 2026-10-12.
- CPU credits a second, per application: 1,000 credits per second
  - Scope: Per application, multiplied by the number of accounts deployed to MetaApi. REST and RPC calls only, counted in CPU credits and not in requests
  - Status: verified. Source: [metaapi.cloud](https://metaapi.cloud/docs/client/rateLimiting/), checked 2026-10-12.
  - Note: Most read calls cost 50 credits, a trade costs 10 and listing symbols costs 500. Streaming uses no CPU credits. HTTP 429 with a recommended retry time on breach.
- Concurrent historical market data requests: 5 concurrent requests
  - Scope: Per MetaTrader account, historical market data API only
  - Status: verified. Source: [metaapi.cloud](https://metaapi.cloud/docs/client/rateLimiting/), checked 2026-10-12.
- CPU credits a second, per server: 2,000 credits per second
  - Scope: Per shared front end server. REST and RPC calls only, counted in CPU credits and not in requests
  - Status: verified. Source: [metaapi.cloud](https://metaapi.cloud/docs/client/rateLimiting/), checked 2026-10-12.
  - Note: Also 18,000 a minute, 180,000 an hour and 432,000 per 6 hours on one server. The page says a different client-id header selects a different server.

## More on the MetaApi API

- [All MetaApi API endpoints](https://openbrokerapi.com/platforms/metaapi/endpoints): 17 documented, grouped by what they do.
- [MetaApi API page](https://openbrokerapi.com/platforms/metaapi): The full record: access, authentication, limits and the source for each.
- [MetaApi API as an OpenAPI file](https://openbrokerapi.com/specs/metaapi.json): Generated from these endpoint records. Independent and unofficial.

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: MetaApi GET /users/current/accounts/{accountId}/historical-market-data/symbols/{symbol}/timeframes/{timeframe}/candles. Broker API Hub, https://openbrokerapi.com/platforms/metaapi/endpoints/get-historical-candles, newest check 2026-10-12.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
