Read as needed; not a required onboarding step. Path：[Data Access Path](/en/docs)

# Bulk Data Exports

When you need offline analysis or want to take a large amount of content at once, use an export instead of calling read endpoints one item at a time. Exports are asynchronous: you create a job, Whale generates files in the background partitioned by UTC day or hour, and you download them when it finishes.

An export contains only the **current version** of each item. For history or metric snapshots use [Read Content & History](/en/docs/documents); to keep receiving new and changed data use [Synchronize Data Changes](/en/docs/change-feed).

## Prerequisites

- `WHALE_BASE_URL` and `WHALE_API_KEY` are configured as in [Get & Use an API Key](/en/docs/authentication), and you have curl and jq.
- Your application's subscription has export enabled (`export_allowed`). Without it, creating a job returns `403 export_forbidden`; ask your organization administrator to request it from Whale.
- If your subscription is limited to specific platforms, pass `source_platforms` explicitly and stay within that scope.

## Create an Export


```bash
export_response="$(curl -sS --fail-with-body -X POST "$WHALE_BASE_URL/v1/exports" \
  -H "Authorization: Bearer $WHALE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_platforms": ["reddit"],
    "published_from": "2026-10-01T00:00:00Z",
    "published_to": "2026-10-08T00:00:00Z",
    "format": "jsonl",
    "partition_by": "hour"
  }')"
printf '%s' "$export_response" | jq .
EXPORT_ID="$(printf '%s' "$export_response" | jq -er '.export_id')"
```


| Field | Required | Description |
| --- | ---: | --- |
| `source_platforms` | Conditional | Platforms to export; required when your subscription is platform-limited |
| `published_from` / `published_to` | No | Publication-time filter, RFC 3339; `from` must precede `to` |
| `format` | No | `jsonl` (default) or `parquet` |
| `compression` | No | Determined by format: `jsonl` uses `gzip`, `parquet` uses `zstd`; may be omitted |
| `fields` | No | `jsonl` only and may include `platform_payload`; `parquet` uses the fixed cross-platform schema without `platform_payload` |
| `partition_by` | No | `day` (default) or `hour`; use `hour` for high-volume sources such as Reddit |
| `max_rows` | No | Safety limit per partition, 1–100000, default 100000 |
| `max_bytes` | No | Safety limit per partition, up to 1073741824 (1 GiB), default maximum |

A successful request returns `202`:


```json
{
  "export_id": "exp_01K...",
  "status": "queued",
  "format": "jsonl",
  "compression": "gzip",
  "rows": 0,
  "bytes": 0,
  "file_count": 0,
  "partitions": 7,
  "created_at": "2026-10-14T08:00:00Z",
  "expires_at": "2026-10-21T08:00:00Z"
}
```


### Partitions and Row Limits

A job with a time range uses UTC-day partitions by default. With `partition_by=hour`, it uses UTC-hour partitions. `max_rows` and `max_bytes` are safety boundaries for each partition. If data remains after a boundary is reached, the partition fails explicitly instead of reporting a silently truncated success.

Use hourly partitions for million-row-per-day sources such as Reddit. If one hour still exceeds a boundary, narrow the time range or split jobs by platform. Use [Synchronize Data Changes](/en/docs/change-feed) for continuous delivery.

## Check Progress


```bash
curl -sS --fail-with-body "$WHALE_BASE_URL/v1/exports/$EXPORT_ID" \
  -H "Authorization: Bearer $WHALE_API_KEY" | jq '{status, rows, bytes, file_count, partitions, error}'
```


`status` moves through `queued` and `running`, and ends as `succeeded`, `failed`, `cancelled` or `expired`. Poll starting at five-second intervals and back off. On `failed`, `error` explains why; failed partitions are retried automatically and resume from completed work.

## Download Files

When the job is `succeeded`, list its files:


```bash
curl -sS --fail-with-body "$WHALE_BASE_URL/v1/exports/$EXPORT_ID/files" \
  -H "Authorization: Bearer $WHALE_API_KEY" | jq .
```



```json
{
  "files": [
    {"sequence": 0, "format": "manifest", "rows": 18234, "bytes": 2048, "download_url": "/v1/exports/exp_01K.../files/0", "expires_at": "2026-10-21T08:00:00Z"},
    {"sequence": 1000001, "format": "jsonl", "rows": 5000, "bytes": 3145728, "download_url": "/v1/exports/exp_01K.../files/1000001", "expires_at": "2026-10-21T08:00:00Z"}
  ]
}
```


Download each file. `download_url` is a relative path: prefix it with `WHALE_BASE_URL` and send the same API key:


```bash
curl -sS --fail-with-body "$WHALE_BASE_URL/v1/exports/$EXPORT_ID/files" \
  -H "Authorization: Bearer $WHALE_API_KEY" |
  jq -r '.files[] | "\(.sequence) \(.format)"' |
  while read -r sequence format; do
    case "$format" in
      jsonl) extension="jsonl.gz" ;;
      parquet) extension="parquet" ;;
      *) extension="json" ;;
    esac
    curl -sS --fail-with-body -o "export-$EXPORT_ID-$sequence.$extension" \
      "$WHALE_BASE_URL/v1/exports/$EXPORT_ID/files/$sequence" \
      -H "Authorization: Bearer $WHALE_API_KEY"
  done
```


- The file with `sequence` `0` is the manifest (`manifest.json`): format, total rows, and each partition's time range, row count and files. Shards provide a `sequence` and an authenticated relative `download_url`, not storage paths.
- The rest are data shards. Their `sequence` is "partition number × 1000000 + shard number", so the first shard of partition 1 is `1000001`. Download by the values returned in `files`; do not compute them yourself.
- Shard formats: `jsonl` is GZIP-compressed JSON Lines with one item per line; `parquet` is ZSTD-compressed Parquet.
- Files and the job expire **7 days** after creation. After that they cannot be downloaded; create a new job.

## Exported Fields

| Field | Description |
| --- | --- |
| `document_id` / `version_id` | Whale content ID and current version ID, usable with [Read Content & History](/en/docs/documents) |
| `external_content_id` / `canonical_url` | Source content ID and canonical URL |
| `source_platform` / `content_type` | Platform and content type (`dataset_id` is internal; ignore it) |
| `title` / `body` / `body_format` | Title, full body and body format |
| `language` / `region` / `country_code` | Language and region |
| `published_at` | Source publication time |
| `content_hash` / `size_bytes` / `char_count` | Body hash, byte size and character count |
| `author` / `subreddit` / `score` / `external_parent_id` / `external_thread_id` | Author, community, score and reply relationships; select them explicitly in `fields` for `jsonl`, included by default in `parquet` |
| `platform_payload` | Complete platform-specific fields; JSONL only, explicitly selected and field-authorized |

Every requested field must be within your subscription's field grants, otherwise the request returns `403 export_forbidden`.

## Cancel a Job


```bash
curl -sS --fail-with-body -X POST "$WHALE_BASE_URL/v1/exports/$EXPORT_ID/cancel" \
  -H "Authorization: Bearer $WHALE_API_KEY"
```


The response is `202`, with `status` reflecting the actual state. After `cancelled`, the job will not retry, publish new files, or return to `running` or `succeeded`. The worker stops at a checkpoint; the current small batch or an in-flight request may finish first. Failed jobs awaiting retries can also be cancelled.

Repeated cancellation does not restart work. A job that already succeeded or expired keeps that state and returns `succeeded` or `expired`. Cancellation does not delete source content; files published before cancellation remain downloadable until they expire.

## Billing, Limits and Errors

Each export creation is metered as one request and charged at your organization's pricing; failed creations are refunded. Export creation has a daily limit (see the rate limits on the application's Access restrictions page in the Portal); once reached, creation returns 429 `rate_limit_exceeded` for the rest of the UTC day.

| HTTP | code | Meaning and action |
| --- | --- | --- |
| 400 | `invalid_export_request` | Malformed request body |
| 400 | `export_create_failed` | Validation failed, such as a format/compression mismatch, `published_from` after `published_to`, partial `fields` for `parquet`, or the daily export limit; fix per `message` |
| 400 | `invalid_export_file` | `sequence` is not a non-negative integer |
| 401 | `unauthorized` | The API key is invalid |
| 402 | `credit_insufficient` | Your organization's credit balance is insufficient |
| 403 | `export_forbidden` | Export is not enabled for your subscription, or platforms or fields exceed your grants |
| 404 | `export_not_found` / `export_file_not_found` | The job or file does not exist, belongs to another application, or has expired |
| 429 | `rate_limit_exceeded` | Rate limited; back off per `Retry-After` |

See the [public API reference](/en/public-api-reference) for every field.

## Continue Your Task

[Return to the integration path](/en/docs); return to your task after consulting this reference.