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

# POST /v1/ohlc

> Fetch OHLC candles directly from the Builder API.

```bash theme={null}
curl https://builder.prod.bedrock.ostium.io/v1/ohlc \
  -H 'Content-Type: application/json' \
  -d '{
    "pair": "BTC-USD",
    "fromTimestampSeconds": 1711929600,
    "toTimestampSeconds": 1714521600,
    "resolution": "1D"
  }'
```

SDK equivalent:

```ts theme={null}
const candles = await client.getCandles({
  pairId: 0,
  from: Date.now() - 30 * 24 * 60 * 60 * 1000,
  resolution: '1D',
  sets: 3,
});
```

`sets` is SDK-side pagination. The direct Builder API response includes `lastRequestTimestamp`; the SDK handles repeated requests and returns one flattened candle array.

## Request schema

```ts theme={null}
interface Request {
  pair: string;
  fromTimestampSeconds: number;
  toTimestampSeconds: number;
  resolution: '1' | '5' | '15' | '60' | '240' | '1D';
}
```

## Response schema

```ts theme={null}
interface Response {
  data: Array<{
    from: string;
    to: string;
    time: number;
    open: number;
    high: number;
    low: number;
    close: number;
  }>;
  lastRequestTimestamp: number | null;
}
```
