# Get market context

Source: https://langbot.ai/docs/api/markets/get-market-context

`GET /v1/context/{ticker}`

One market in one call, with its rules, latest book, base rate for its speaker and phrase, its event and recent mentions.

**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

### Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `ticker` | string | yes | The venue ticker or `pm_<id>`. |

### Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `window_days` | integer | no | Look-back window for the base rate, in days. 1 to 3650. |

## Request

**curl**

```bash
curl "https://api.langbot.ai/v1/context/KXFEDMENTION-26OCT-TRANSITORY" \
  -H "Authorization: Bearer $LANGBOT_API_TOKEN"
```

**Python**

```python
from langbot import LangbotClient

async with LangbotClient() as lb:  # reads LANGBOT_API_TOKEN
    ctx = await lb.context("KXFEDMENTION-26OCT-TRANSITORY")
    print(ctx.market, ctx.base_rates)
```

**TypeScript**

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

const lb = new LangbotClient(); // reads LANGBOT_API_TOKEN
const ctx = await lb.context("KXFEDMENTION-26OCT-TRANSITORY");
console.log(ctx.market, ctx.base_rates);
```

## Response

`200 OK`

```json
{
  "ts": 1793380000000,
  "ticker": "KXFEDMENTION-26OCT-TRANSITORY",
  "market": {
    "ticker": "KXFEDMENTION-26OCT-TRANSITORY",
    "venue": "kalshi",
    "event_id": "ev_fomc_oct_2026_presser",
    "title": "Will Powell say \"transitory\" at the October press conference?",
    "phrases": ["transitory"],
    "status": "open",
    "close_ts": 1793390400000
  },
  "outcome": null,
  "rules_text": "If Jerome Powell says \"transitory\" during the press conference…",
  "settlement_source": "the official video of the press conference",
  "speaker": "powell",
  "phrase": "transitory",
  "base_rates": { "speaker": "powell", "phrase": "transitory", "window_days": 365, "markets": 9, "yes": 2, "no": 7, "void": 0, "yes_rate": 0.222 },
  "book": { "ticker": "KXFEDMENTION-26OCT-TRANSITORY", "ts": 1793380000000, "yes_bid": 0.12, "yes_ask": 0.15 },
  "event": { "id": "ev_fomc_oct_2026_presser", "title": "FOMC press conference", "starts_at": 1793385000000, "status": "upcoming" },
  "rights": "public_domain",
  "mentions": []
}
```

## Errors

| Status | `code` | When |
|---|---|---|
| 404 | `not_found` | No market with that ticker. |
| 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).
