# Get base rates

Source: https://langbot.ai/docs/api/history/get-base-rates

`GET /v1/history/base-rates`

How often markets on a speaker, a phrase or the pair settled YES, and at what prices they opened and closed.

**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 |
|---|---|---|---|
| `speaker` | string | no | A canonical speaker key. Omit it for a phrase-wide rate. |
| `phrase` | string | no | A normalized phrase key. Omit it for a speaker-wide rate. |
| `series` | string | no | A venue series ticker. |
| `window_days` | integer | no | Look-back window in days. 1 to 3650. |

## Request

**curl**

```bash
curl "https://api.langbot.ai/v1/history/base-rates?speaker=powell&phrase=transitory" \
  -H "Authorization: Bearer $LANGBOT_API_TOKEN"
```

**Python**

```python
from langbot import LangbotClient

async with LangbotClient() as lb:  # reads LANGBOT_API_TOKEN
    rates = await lb.base_rates(speaker="powell", phrase="transitory")
    print(rates.markets, rates.yes_rate)
```

**TypeScript**

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

const lb = new LangbotClient(); // reads LANGBOT_API_TOKEN
const rates = await lb.baseRates({ speaker: "powell", phrase: "transitory" });
console.log(rates.markets, rates.yes_rate);
```

## Response

`200 OK`

```json
{
  "speaker": "powell",
  "phrase": "transitory",
  "series": null,
  "window_days": 365,
  "since": 1761900000000,
  "markets": 9,
  "yes": 2,
  "no": 7,
  "void": 0,
  "yes_rate": 0.222,
  "by_month": [ { "month": "2026-09", "markets": 1, "yes": 0, "no": 1, "void": 0, "yes_rate": 0.0 } ],
  "avg_open_price": 21.4,
  "avg_close_price": 19.8,
  "mispricing": 0.008
}
```

`yes_rate = yes / (yes + no)`; voids are left out. Prices are in cents. `mispricing` is the mean of (1 if YES else 0) minus the opening price as a fraction. These describe what settled, not the next market.

## Errors

| Status | `code` | When |
|---|---|---|
| 404 | `not_found` | Nothing settled on that speaker and phrase. |
| 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).
