Skip to content
Market History

Exports

An export is a large /query/v1/bars request built in the background: one dataset, one timeframe, up to 1,000 tickers over any range. The server pages the bars for you, writes them to Parquet files and gives you links. You download the files with wget (or anything that speaks HTTP ranges) and check them against the sha256 in the manifest.

The bars are the ones paging /query/v1/bars with format=parquet returns, at the same price. Use an export when paging would take hours; for a few tickers, paging is simpler.

Terminal window
curl -s https://getmarkethistory.com/query/v1/exports \
-H "Authorization: Bearer $MARKET_HISTORY_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: btc-eth-2021-2025" \
-d '{"dataset": "crypto/spot", "tickers": ["BTCUSDT", "ETHUSDT"],
"timeframe": "1m", "start": "2021-01-01", "end": "2025-12-31"}' | tee export.json
ID=$(jq -r .id export.json)
{
"id": "0b1e8c1e-2f3a-4c5d-8e9f-a0b1c2d3e4f5",
"state": "queued",
"position": 1,
"series_total": 2,
"max_bars": 250000000
}

The answer is 202 with a Location header pointing at the export’s status.

Field Meaning
dataset One dataset id, as in /query/v1/bars (crypto/spot, stocks/us). Required.
tickers 1 to 1,000 distinct tickers. Required.
timeframe One timeframe (1m, 1h, 1d). Required.
start, end Dates (2021-01-01) or ISO timestamps with seconds, as in /query/v1/bars. Optional.
columns, adjust, gap_policy, feed, tz As in /query/v1/bars. Optional.
max_bars The most bars this export may cost. Optional: by default, the bars your account and key can spend now. The balance is read again when the build starts, and the build never goes past it either. A build that would pass either stops as failed (over_budget), uncharged.
product bars, the only product exports serve for now. Optional.

Any other field is a 400. The first ticker is checked against the API before the export is queued, so a bad dataset, timeframe, column or feed is refused at once. A ticker after the first that has no bars is found during the build: it is listed under skipped and costs nothing.

Send an Idempotency-Key to retry safely: the same key and body answers 200 with the export it created, the same key with another body answers 409.

Terminal window
curl -s https://getmarkethistory.com/query/v1/exports/${ID} \
-H "Authorization: Bearer $MARKET_HISTORY_KEY"
{
"id": "0b1e8c1e-2f3a-4c5d-8e9f-a0b1c2d3e4f5",
"state": "ready",
"progress": {
"series_done": 2,
"series_total": 2,
"rows": 4207680,
"bytes": 98304000,
"bars": 4207700
},
"bars_charged": 4207700,
"error": null,
"skipped": null,
"expires_at": "2026-11-15T10:00:00.000Z",
"downloads_left": null,
"manifest_url": "https://getmarkethistory.com/query/v1/exports/0b1e…/<token>/manifest.json",
"urls_url": "https://getmarkethistory.com/query/v1/exports/0b1e…/<token>/urls.txt"
}
state Meaning
queued Waiting its turn; position is its place in the queue.
running Being built; progress counts tickers, rows, bytes and bars so far.
built Built, not yet paid: your balance cannot pay for it (error says how many bars it needs). Top up.
ready Paid and downloadable until expires_at. manifest_url and urls_url are set.
failed Stopped; error says why (over_budget, payment_required: no bars left when the build started, not_exportable, too_large, internal). Nothing charged.
cancelled You cancelled it before it was ready. Nothing charged.
expired Its links ran out, or you deleted it. The files are gone.

While an export is queued or running the status carries Retry-After: 60: poll once a minute. Exports are built one at a time, outside the early-morning (UTC) hours when the data is updated, so a large one can take hours to start. GET /query/v1/exports lists your exports of the last 30 days. The dashboard shows them too.

The file links carry a random token of their own: they need no API key, so wget can fetch them as they are. Anyone with a link can download the files until it expires, so treat it like a key.

Terminal window
wget -c -i "$(curl -s https://getmarkethistory.com/query/v1/exports/${ID} \
-H "Authorization: Bearer $MARKET_HISTORY_KEY" | jq -r .urls_url)"

urls.txt lists one URL per file, under https://getmarkethistory.com/dl/<token>/. Files are named <index>_<ticker>_<timeframe>.parquet; a ticker whose bars pass 4 GiB is split into …_1.parquet, …_2.parquet in time order. Each file is a Parquet file with the columns /query/v1/bars returns for format=parquet.

The files are plain static files: Range requests and resumes work as with any web server, so wget -c, curl -C - or any download manager can pick up a broken download where it stopped. There is no limit on how many times you download them before the links expire.

manifest.json lists every file with its ticker, feed, rows, bytes, first and last bar, and the sha256 of its bytes:

Terminal window
curl -s -o manifest.json "$(curl -s https://getmarkethistory.com/query/v1/exports/${ID} \
-H "Authorization: Bearer $MARKET_HISTORY_KEY" | jq -r .manifest_url)"
jq -r '.files[] | "\(.sha256) \(.name)"' manifest.json | sha256sum -c

Every line should end in OK. A file that does not match is incomplete: delete it and run wget again.

Terminal window
curl -s -X DELETE https://getmarkethistory.com/query/v1/exports/${ID} \
-H "Authorization: Bearer $MARKET_HISTORY_KEY"

An export that is queued, running or built is cancelled, free. A ready one is ended early: its links stop working and its files are deleted. It is not refunded.

  • Same price as paging. Each file is billed like the /query/v1/bars pages it was built from: in blocks of 100 bars, with nothing extra for the export. The total is bars_charged.
  • Charged once, after it is built. Nothing is held when you ask. The export is charged the first time it is read after it is built: its status or the list with your API key, the dashboard, or a download link. Opening the status URL in a browser tab does not charge it (that answers 403: use a key). Your key’s monthly cap applies.
  • Nothing charged for an export that fails, is cancelled or never becomes ready. A built export your balance cannot pay for waits for a top-up until 72 hours after it was built, then expires, uncharged.
  • Free bars do not pay for exports. Exports are paid from bought or plan bars only.
  • A ready export is charged whether or not you download it, as a page you discard is.
Limit Value
Exports per account 1 queued or running at a time; 5 asked per day (UTC)
Per export 1 dataset, 1 timeframe, up to 1,000 tickers and 15 billion bars
Size 50 GB and 5,000 files per export; files split at 4 GiB
Links 72 hours after it is built (at least 24 hours after it is charged)

An export charged in its last 24 hours keeps its links for 24 hours from the charge, so one charged at hour 71 expires at hour 95; one charged earlier expires at hour 72.

Some datasets do not allow exports: asking for one answers 403. Page them through /query/v1/bars instead. A dataset may also cap the bars per export.

Status When
402 The export is built but your balance cannot pay for it yet (out_of_bars).
404 A wrong link, or a file the export does not have (not_found).
409 The export is not built yet (not_ready): poll its status.
410 The links expired, or the export was deleted, cancelled or failed (gone). A file link past its expiry answers 404.
416 A range past the end of the file. wget -c on a finished file gets this; it means the file is complete. The body may be an HTML page, not JSON.

The other routes answer like /query/v1/bars: 401 without a key, 402 when your balance or key cap cannot cover max_bars, 429 with Retry-After when an account limit or the queue is full. See Errors.