> For the complete documentation index, see [llms.txt](https://oracledocs.magpie.gg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://oracledocs.magpie.gg/build-with-it/api-reference.md).

# API reference

* **Base URL**: `https://magpie.gg/oracle/v1`
* **Auth**: `X-API-Key: mgo_…` header on product endpoints. Verifiability + accuracy endpoints are keyless. CORS is open (header auth, no cookies).
* **Errors**: `401` no key · `403` invalid/revoked key · `404` unknown card/day · `422` bad parameter · `429` rate limited (honours `Retry-After`).
* All values in **EUR**.

## GET /cards — resolve card ids

`?q=charizard 4/102&game=pokemon&limit=20` Name substrings + collector-number tokens. → `{"results":[{"card_id","name","number","game","set","rarity"}]}`

## GET /price — current value

`?card_id=123&printing=Normal&lang=en[&graded=true]`

Raw → `{"available",true, "fair_eur", "low_eur","high_eur", "confidence","n_sales","updated_at", …}`

Graded (`graded=true`) → `{"gem_eur","low_eur","high_eur","confidence", "n_sales","by_grade_value":{"PSA 10":{"value","low","high","n"},…}}`

Cache-first (read-through TTL); a cold value computes live in \~1-2s. `available:false` = we honestly don't know. Only derived values are ever returned (see [Data policy](/build-with-it/data-policy.md)).

## GET /history — daily series

`?card_id=123&printing=Normal&lang=en&days=90` (max 365) → `{"series":[{"t":"2026-07-01","eur":12.4},…]}`

## GET /candles — OHLC

`?card_id=123&tf=1d&days=90[&graded=true]` — `tf ∈ 1h|4h|1d|1w` → `{"candles":[{"t","o","h","l","c","v","n"},…]}` where `v` counts realized sales in the bucket. Empty buckets are absent — no synthetic candles.

## GET /accuracy — public error metrics (keyless)

See [Accuracy](/the-oracle/accuracy.md).

## GET /batch/{day} · GET /proof — verifiability (keyless)

See [Verifiability](/the-oracle/verifiability.md). Past days are served with immutable cache headers.

## Quickstart

```bash
curl -s -H "X-API-Key: $KEY" \
  "https://magpie.gg/oracle/v1/price?card_id=123&graded=true" | jq
```

```ts
const r = await fetch("https://magpie.gg/oracle/v1/candles?card_id=123&tf=4h",
                      { headers: { "X-API-Key": process.env.ORACLE_KEY! } });
const { candles } = await r.json();
```

Versioning: breaking changes only under a new path prefix (`/oracle/v2`); additive fields may appear at any time — parse leniently.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://oracledocs.magpie.gg/build-with-it/api-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
