> ## Documentation Index
> Fetch the complete documentation index at: https://httpscashapplaunchbitcoinzann69yc4dfud2ascom.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Historical OHLCV Candles — Coinbase Advanced Trade

> GET /api/v3/brokerage/products/{product_id}/candles — fetch historical OHLCV candlestick data for any trading pair with flexible time granularity.

The **Product Candles** endpoint returns historical OHLCV (open, high, low, close, volume) candlestick data for any supported trading pair. You specify a time range using Unix timestamps and choose from eight granularity levels — from one-minute bars all the way to daily candles. This data is ideal for powering charts, backtesting trading strategies, or computing technical indicators. This is a public endpoint — no authentication is required.

## Endpoint

```
GET https://api.coinbase.com/api/v3/brokerage/products/{product_id}/candles
```

## Authentication

**Not required.** This is a public endpoint and can be called without an `Authorization` header.

## Parameters

**product\_id** `string` *required*

The trading pair to retrieve candles for, e.g. `BTC-USD` or `ETH-USDC`. Product IDs follow the `BASE-QUOTE` format and are case-sensitive.

**start** `string` *required*

Start of the requested time range as a Unix timestamp (seconds since epoch). For example, `1714521600` represents `2024-05-01T00:00:00Z`.

**end** `string` *required*

End of the requested time range as a Unix timestamp (seconds since epoch). Must be greater than `start`.

**granularity** `string` *required*

Time interval for each candle. Accepted values:

| Value | Description |
| - | - |
| `ONE_MINUTE` | 1-minute bars |
| `FIVE_MINUTE` | 5-minute bars |
| `FIFTEEN_MINUTE` | 15-minute bars |
| `THIRTY_MINUTE` | 30-minute bars |
| `ONE_HOUR` | 1-hour bars |
| `TWO_HOUR` | 2-hour bars |
| `SIX_HOUR` | 6-hour bars |
| `ONE_DAY` | Daily bars |

**limit** `integer`

Maximum number of candles to return. The hard limit is **350 candles per request**. Defaults to 350 when omitted.

## Response

**candles** `array`

Ordered array of candlestick data. Each element is itself an array of six values in the following fixed order:

`[start_unix, low, high, open, close, volume]`

**Candle array element positions**

**\[0] start\_unix** `integer`

Unix timestamp (seconds) for the start of the candle interval, e.g. `1714604400`.

**\[1] low** `string`

Lowest traded price during the interval.

**\[2] high** `string`

Highest traded price during the interval.

**\[3] open** `string`

Price at the beginning of the interval.

**\[4] close** `string`

Price at the end of the interval.

**\[5] volume** `string`

Total volume of the base currency traded during the interval.

> [!NOTE]
>
> A maximum of **350 candles** can be returned per request. If your desired time range contains more candles at the chosen granularity, paginate by splitting the range into multiple requests and advancing `start` by `350 × granularity_seconds` on each call.

## Examples

The examples below fetch the last 24 hours of hourly candles for BTC-USD. The `end` timestamp is the current time and `start` is 24 hours earlier.

```bash cURL theme={null}
# Fetch 24 one-hour candles ending at 2024-05-02T00:00:00Z
curl -G https://api.coinbase.com/api/v3/brokerage/products/BTC-USD/candles \
  --data-urlencode "start=1714521600" \
  --data-urlencode "end=1714608000" \
  --data-urlencode "granularity=ONE_HOUR" \
  --data-urlencode "limit=24"
```

```python Python theme={null}
import time
import requests

product_id = "BTC-USD"
url = f"https://api.coinbase.com/api/v3/brokerage/products/{product_id}/candles"

end = int(time.time())
start = end - 86400  # 24 hours ago

params = {
    "start": start,
    "end": end,
    "granularity": "ONE_HOUR",
    "limit": 24,
}

response = requests.get(url, params=params)
response.raise_for_status()
candles = response.json()["candles"]

for candle in candles:
    # Each candle is [start_unix, low, high, open, close, volume]
    print(
        f"open={candle[3]}  high={candle[2]}  "
        f"low={candle[1]}  close={candle[4]}  "
        f"volume={candle[5]}"
    )
```

### Response

```json theme={null}
{
  "candles": [
    [1714604400, "67210.00", "68105.50", "67340.00", "67945.22", "812.4431"],
    [1714600800, "67001.10", "67512.88", "67120.55", "67340.00", "654.8812"],
    [1714597200, "66755.00", "67289.44", "66920.10", "67120.55", "998.1203"]
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.