# Price stats

> Low, high, median, first, last and the percentage change of the composite index over a window.

- **Endpoint**: `GET /v1/cards/{id}/prices/stats`
- **Cost**: 2 credits
- **Minimum plan**: free
- **Cache-Control**: `public, max-age=300`

Source: https://pokemontcgapi.com/docs/api/prices/stats

Always computed on `PTCG_INDEX`, in EUR — the one series that exists for every priced card and is comparable across them. `sample_n` is the number of index points in the window; zero means the card had no index in that period, and every other field is null.

Two credits, not five: a stats call reads the index rows of one card, which is a fraction of what a history call touches.

## Path parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `id` **required** | string | — | Card id or alternate id. |

## Query parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `window` | string | 30d | `7d`, `30d`, `90d` or `365d`. A window longer than the plan’s history is `UPGRADE_REQUIRED`, with `details.plan_window_days`. |
| `locale` | string | — | Restrict the index to one printing language. |

## Headers

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `X-Api-Key` **required** | string | — | Your API key. `Authorization: Bearer <key>` is accepted as an alias. |
| `If-None-Match` | string | — | Send back the `ETag` you stored. The API returns a strong ETag on every catalogue response, and a 304 is a header exchange: no body, no database row read. |

## Example request

**curl**

```bash
curl -s -G "https://api.pokemontcgapi.com/v1/cards/base1-4/prices/stats" \
  --data-urlencode "window=30d" \
  -H "X-Api-Key: $PTCG_API_KEY"
```

**TypeScript**

`request.ts`

```ts
const url = new URL("https://api.pokemontcgapi.com/v1/cards/base1-4/prices/stats");
url.searchParams.set("window", "30d");

const res = await fetch(url, {
  headers: { "X-Api-Key": process.env.PTCG_API_KEY ?? "" },
});

if (!res.ok) {
  const { error } = await res.json();
  throw new Error(`${error.code}: ${error.message} (${error.request_id})`);
}

const { data, meta } = await res.json();
```

**Python**

`request.py`

```python
import os, httpx

res = httpx.get(
    "https://api.pokemontcgapi.com/v1/cards/base1-4/prices/stats",
    params={"window": "30d"},
    headers={"X-Api-Key": os.environ["PTCG_API_KEY"]},
)
res.raise_for_status()
payload = res.json()
```

## Example response

`200 OK` · `Cache-Control: public, max-age=300`

`response.json`

```json
{
  "data": {
    "window": "30d",
    "from": "2026-08-03",
    "to": "2026-09-02",
    "low": 431.41,
    "high": 431.41,
    "median": 431.41,
    "first": 431.41,
    "last": 431.41,
    "change_pct": 0,
    "sample_n": 1,
    "currency": "EUR"
  },
  "meta": {
    "card_id": "base1-4",
    "source": "PTCG_INDEX"
  }
}
```

## Errors

Every error body carries `error.code`, `error.message` and `error.request_id`. Switch on the code, never on the message.

| Status | Code | When |
| --- | --- | --- |
| 401 | `MISSING_API_KEY` | No `X-Api-Key` header and no bearer token on a route that requires one. |
| 401 | `INVALID_API_KEY` | The key does not match any account. |
| 400 | `INVALID_PARAMETER` | A query parameter has the wrong type or an unsupported value — a non-integer `limit`, an unknown `lang`, an unknown `region`, a sort key that is not sortable. |
| 403 | `UPGRADE_REQUIRED` | A parameter asks for more than the plan allows: a `window` longer than the plan’s history, for example. `details.plan_window_days` says how much the plan gives. |

The full taxonomy, with what to do about each code, is on the [errors](https://pokemontcgapi.com/docs/errors) page.
