# Get reference bars

Source: https://langbot.ai/docs/api/reference/get-reference-bars

`GET /v1/reference/bars`

One reference market's bars on the same clock as the venues' markets, oldest first, paged by time, with any gaps in the recording.

**Auth.** An API token: `Authorization: Bearer lb_…` ([create one](https://langbot.ai/app/tokens)). Signed-in web sessions work too.

**Limits.** One history query per call (500 a day on Free; unlimited on Builder and Standard).

## Parameters

### Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `symbol` | string | yes | `BTC-USD`, `ETH-USD`, `UST-10Y`, … or `source:symbol`. |
| `source` | string | no | The source to read when several record the symbol. |
| `period` | string | no | Seconds, or `1s`, `1m` or `1d`; default the finest stored. |
| `since` | integer | no | ms epoch; bars whose period ends at or after it. |
| `until` | integer | no | ms epoch; bars whose period ends at or before it. |
| `limit` | integer | no | Bars per page. 1 to 5000. Default `1000`. |

## Request

**curl**

```bash
curl "https://api.langbot.ai/v1/reference/bars?symbol=UST-10Y&since=1793682000000&limit=2" \
  -H "Authorization: Bearer $LANGBOT_API_TOKEN"
```

**Python**

```python
from langbot import LangbotClient

async with LangbotClient() as lb:  # reads LANGBOT_API_TOKEN
    page = await lb.reference_bars("UST-10Y", since=1793682000000, limit=2)
    for b in page.bars:
        print(b.as_of, b.close)
```

**TypeScript**

```ts
import { LangbotClient } from "@langbotai/sdk";

const lb = new LangbotClient(); // reads LANGBOT_API_TOKEN
const page = await lb.referenceBars("UST-10Y", { since: 1793682000000, limit: 2 });
```

## Response

`200 OK`

```json
{
  "symbol": "UST-10Y",
  "source": "treasury",
  "source_name": "U.S. Treasury daily par yield curve",
  "rights": "public_domain",
  "period_s": 86400,
  "periods_available": [86400],
  "since": 1793682000000,
  "until": null,
  "count": 2,
  "bars": [
    { "ts": 1793768400000, "open": null, "high": null, "low": null, "close": 4.95, "volume": null, "trades": null, "bid_close": null, "ask_close": null, "as_of": "2026-11-03" },
    { "ts": 1793854800000, "open": null, "high": null, "low": null, "close": 4.90, "volume": null, "trades": null, "bid_close": null, "ask_close": null, "as_of": "2026-11-04" }
  ],
  "gaps": [],
  "next_since": 1793854800001
}
```

`ts` is the end of each bar, so the close is known at `ts`. Crypto bars: USD prices, `volume` in coins, `trades` fills, `bid_close`/`ask_close` the last top of book; prices are `null` for a period with quotes and no trade. Daily series: `as_of` is the date the value is for and `ts` when it was known; yields and rates are percent. `gaps` lists holes in the recording that overlap the page (`disconnect`, `sequence` with `missed_trades`, `stale`). Pass `next_since` back as `since` for the next page.

## Errors

| Status | `code` | When |
|---|---|---|
| 404 | `not_found` | No reference series with that symbol, or none at `period`. |
| 401 | `auth_required` | No token was sent. |
| 401 | `token_invalid` | The token was not recognised (mistyped, revoked or expired). |
| 422 | `validation_error` | A parameter failed validation; `detail[].loc` names it. |
| 429 | `quota_exceeded` | Today's history queries are spent; `quota.resets_at` says when they reset. |
| 429 | `rate_limited` | Over your request budget; wait `Retry-After` seconds. |

Every error body is `{"detail": …, "code": "…"}`; branch on `code`. All codes: [Errors](https://langbot.ai/docs/api#errors).
