> This page is for Datasets.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.immix.xyz/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.immix.xyz/_mcp/server.

# HTTP API guide

Historical market data as files: trades, quotes, order books and derivatives data, one file per
family, exchange, day and symbol. The API tells you what exists, and answers a file's address
with a redirect to a signed storage link. No file's bytes pass through the API.

## In one minute

```sh
KEY=immixds_<keyId>_<secret>
API=https://datasets.immix.xyz/v1

# What exists, and through which day it is published.
curl -s -H "Authorization: Bearer $KEY" $API/coverage

# One day's files, with their sizes and SHA-256.
curl -s -H "Authorization: Bearer $KEY" $API/manifests/OKX/2026-11-11

# One file. -L follows the redirect to storage; curl does not send your key there.
curl -L -H "Authorization: Bearer $KEY" -o BTC-USDT.csv.gz \
  $API/files/trades/OKX/2026-11-11/BTC-USDT.csv.gz
```

Then check the file against the manifest's `sha256`:

```sh
sha256sum BTC-USDT.csv.gz
```

## API keys

Every request carries a Datasets API key:

```text
Authorization: Bearer immixds_<keyId>_<secret>
```

* A key belongs to one customer, and a customer may hold several: one per machine or job makes
  each easy to replace.
* The whole key is shown once, when it is issued or rotated. It cannot be shown again: a lost
  key is rotated, which keeps its id and replaces its secret, and the old secret stops working at
  once.
* `<keyId>` is not secret. It names the key in your usage and to support. Never share the rest.
* Send the key on every request to this API. Do not put it in a URL, and do not send it to the
  storage link a download redirects to: that link carries its own signature.

A Datasets key is the product's own. A trading API key (it begins `immix_`) and a login token
are both refused here, and a Datasets key is refused by the trading API.

## What exists: coverage

`GET /coverage` lists each exchange with its families, its first closed day and
`published_through`, the last closed day coverage holds. A day is ready once its exchange's
coverage lists it under `days`. A day it does not list has no manifest yet, or closed after
coverage was written: ask for the day's manifest, which is the authority.

An exchange whose coverage the service cannot serve right now is left out of the list until it
can, while its days are still served. So do not take an exchange missing from the list for one
the dataset no longer holds.

`GET /coverage/{exchange}` is one exchange in full:

* `days`: each closed day, with its `status` (`ok` or `partial`), how many `gaps` its manifest
  lists and which `failed_hours` it had.
* `families`: for each family and symbol, the `first_day` and `last_day` with a file, how many
  `days` have one and their `bytes`, summed. Use `bytes` to size a download before you start it.

Every day is a UTC date and inclusive. A symbol's `days` below the span from `first_day` to
`last_day` means days without a file. A file exists only if it has rows, so such a day was a
quiet day, unless that day's manifest lists a gap or a failed hour that covers the symbol.

Coverage is written when a day closes. It can be a day's close behind the manifests and is never
ahead of them: the manifest is the authority on its day.

## A day: the manifest

`GET /manifests/{exchange}/{day}` is a closed day's commit:

* `files`: each file's `key`, `family`, `symbol`, `rows`, `bytes` and `sha256`.
* `instruments`: the day's instruments file.
* `gaps`: the time ranges the day does not cover, each with a `reason`. A gap's `family` or
  `symbol` may be `*`, meaning all of them.
* `failed_hours`: the hours with no data at all. A day with any is `partial`.

A file the manifest does not list is not published. Read the manifest before you download: it
says which files exist, so you never ask for one that does not, and its `sha256` is what you
verify a download against.

`from` and `to` are instants in epoch nanoseconds, and `bytes` and `rows` are counts: JSON
integers of up to 64 bits. A nanosecond instant is larger than a JavaScript number holds
exactly, so parse these with a 64-bit or big-integer type.

## Files

```text
GET /files/{family}/{exchange}/{day}/{symbol}.{ext}
```

answers `302` with the file's signed link in `Location`.

* `{symbol}` is the symbol with `/` written `-` and `:` written `_`: `BTC/USDT` is `BTC-USDT`,
  and `AAVE/USD:USD-20310704` is `AAVE-USD_USD-20310704`. Everywhere else (coverage, manifests,
  the files' own rows) a symbol is in its canonical form.
* `{ext}` is the extension of the file's key in the manifest: `csv.gz` today.
* The path is the manifest's `key` without the 12 hexadecimal digits before the extension:
  `trades/OKX/2026-11-11/BTC-USDT.e88dc5948aa3.csv.gz` is fetched at
  `/files/trades/OKX/2026-11-11/BTC-USDT.csv.gz`.

The link:

* is on `storage.googleapis.com`. If your network allows only named hosts, allow that one too.
* is valid for at least 10 minutes from the redirect, and at most 15. A download that has
  started runs to its end. To resume one after the link has expired, ask for the file again.
* needs no key. Most HTTP clients drop the `Authorization` header when a redirect changes host;
  make sure yours does. Anyone holding the link can use it until it expires, so do not log or
  share it.
* supports `Range` requests.
* is signed for `GET` alone. A file's address takes `GET` alone too: any other method, `HEAD`
  among them, is refused (`405`, `Allow: GET`) and counts nothing. A file's size and SHA-256 are
  in the day's manifest, which is free to read.

A symbol whose canonical form has characters outside letters, digits, one `/` and an optional
`:` suffix has no address yet. No published symbol is one today.

### Instruments

`GET /files/instruments/{exchange}/{day}.csv` redirects to the day's instruments file: the names
and display scales in force that day, one row per name version, so a rename or a delisting
inside the day is visible. Every data file's `instrument_id` column is the same identifier. The
newest closed day's file is the current view. It is never counted against your plan.

### Reading a file

A data file is gzip CSV: the first gzip member holds only the header and the members after it
hold the rows, so a reader must read every member (most gzip readers do). `timestamp` is the
time our sequencer received the event, in nanoseconds; `exchange_timestamp` is the exchange's
own clock where it gave one. Prices and amounts are exact decimals: read them as decimals, not
as floating point. The portal's dataset reference lists every family's columns.

## A repaired day

A day can be repaired after it was published: its files are replaced and its manifest is
rewritten, with a new `sha256` for each file that changed.

* The API serves the latest version of a day to within one minute.
* While a repair is in progress, the day's manifest and files answer `503 DAY_UNDER_REPAIR`
  with `Retry-After: 60`. Nothing is counted. Wait and ask again: a repair can take an hour or
  two to close.
* If a download's SHA-256 differs from the manifest you hold, the day was repaired in between.
  Read the manifest again: files you already hold that match the new manifest need no second
  download.

## Plans and usage

Your plan is a number of bytes per calendar month (UTC), or no limit.

* **What counts.** A data file's redirect counts the file's `bytes`, whole, at the moment the
  redirect is answered, whatever you then do with the link. An aborted download counts, and so
  does a second request for a file you already fetched: keep what you have, and skip a file on
  disk whose SHA-256 matches the manifest.
* **What never counts.** Coverage, manifests, instruments files and `GET /usage`. A refused
  request never counts either.
* **Where you stand.** Every counted redirect carries `X-Immix-Month-Bytes-Used`, the month's
  bytes with this file among them, and `X-Immix-Month-Bytes-Limit`, your plan (absent when it has
  no limit). `GET /usage` gives the same and the month's bytes and files by key, exchange and
  family, for every key of your account.
* **Past the plan.** A file that would take the month past your plan answers `429
  BUDGET_EXHAUSTED` and is not counted. Its `Retry-After` is the month's end, so do not wait it
  out in a loop: stop, or ask us to raise the plan. A file larger than your whole plan fits no
  month: its refusal says so and carries no `Retry-After`.

Each key may also make a bounded number of requests a minute. Past it the answer is `429
RATE_LIMITED`: wait the `Retry-After` seconds and continue. A client fetching five files at a
time never reaches it.

## When a request is refused

| Status | `code`                | What it means                                                                                                                                                                              | What to do                                                                                                                                                                          |
| ------ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400    | `MALFORMED_REQUEST`   | The day in the path is not a `yyyy-MM-dd` date.                                                                                                                                            | Fix the path.                                                                                                                                                                       |
| 401    | `UNAUTHENTICATED`     | No key was sent, or the key does not exist, was deleted, or carries the wrong secret. The three read alike. The message says so when what you sent was a trading API key or a login token. | Send a Datasets key. If you believe the key is right, it was rotated or deleted: ask for a new one.                                                                                 |
| 403    | `FORBIDDEN_PRINCIPAL` | The key is right and is disabled.                                                                                                                                                          | Ask for it to be enabled, or use another of your keys.                                                                                                                              |
| 403    | `CUSTOMER_NOT_ACTIVE` | The key is right and your customer account is disabled.                                                                                                                                    | Contact us. No key of the account is served until it is enabled.                                                                                                                    |
| 404    | `DAY_NOT_PUBLISHED`   | Nothing is published for the exchange on that day: it has not closed yet, or lies outside the exchange's coverage.                                                                         | Check `published_through` in coverage.                                                                                                                                              |
| 404    | `FILE_NOT_FOUND`      | The day is published and holds no such file: the symbol had no rows of that family that day, or a gap covers it.                                                                           | Read the day's manifest: it lists the files and the gaps.                                                                                                                           |
| 404    | `NOT_FOUND`           | The path names nothing the dataset can hold: no such exchange, or a symbol that is not spelled as a path.                                                                                  | Check the exchange code and the symbol's spelling.                                                                                                                                  |
| 404    | `ROUTE_NOT_FOUND`     | No route serves the path.                                                                                                                                                                  | Check the path against the reference.                                                                                                                                               |
| 429    | `BUDGET_EXHAUSTED`    | The file would take you past your plan's bytes for the month. Not counted.                                                                                                                 | Stop until the month turns, or ask us to raise the plan. A file larger than your whole plan fits no month: its refusal carries no `Retry-After`, and only a larger plan fetches it. |
| 429    | `RATE_LIMITED`        | Too many requests from this key in a minute.                                                                                                                                               | Wait `Retry-After` seconds, then continue.                                                                                                                                          |
| 503    | `DAY_UNDER_REPAIR`    | The day is being repaired. Not counted.                                                                                                                                                    | Wait `Retry-After` seconds and ask again; fetch other days meanwhile.                                                                                                               |
| 503    | `SERVICE_UNAVAILABLE` | The service cannot reach its own store or the dataset right now. Nothing about your request is wrong, and nothing was counted.                                                             | Send the same request again after a short pause.                                                                                                                                    |

A `401` also carries `WWW-Authenticate: Bearer`.

## Errors

Every non-2xx response has the same body:

```json
{
  "error": {
    "code": "UNAUTHENTICATED",
    "message": "The API key is not valid.",
    "retryable": false,
    "requestId": "0b7f6c1e-5d1c-4f43-9a55-2f4f3a2d9c10"
  }
}
```

* `code` is machine-readable, UPPER_SNAKE and append-only. Branch on it, never on `message`,
  and tolerate codes you don't know.
* `retryable` says whether the identical request, sent again after `Retry-After` or a short
  pause, can succeed with nothing else changed. `BUDGET_EXHAUSTED` is `false`: only the month
  turning or a raised plan clears it.
* `requestId` is also the `X-Request-Id` response header. Quote it to support. If you send an
  `X-Request-Id` of 8 to 128 letters, digits, `.`, `_` or `-`, it is used as the request's id.

The envelope is the one every Immix API uses, so its members are camelCase; the resources above
are snake_case, as the dataset's own manifests are.