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; to keep receiving new and changed data use Synchronize Data Changes.

Prerequisites

  • WHALE_BASE_URL and WHALE_API_KEY are configured as in Get & Use an API Key, 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')"
FieldRequiredDescription
source_platformsConditionalPlatforms to export; required when your subscription is platform-limited
published_from / published_toNoPublication-time filter, RFC 3339; from must precede to
formatNojsonl (default) or parquet
compressionNoDetermined by format: jsonl uses gzip, parquet uses zstd; may be omitted
fieldsNojsonl only and may include platform_payload; parquet uses the fixed cross-platform schema without platform_payload
partition_byNoday (default) or hour; use hour for high-volume sources such as Reddit
max_rowsNoSafety limit per partition, 1–100000, default 100000
max_bytesNoSafety 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 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

FieldDescription
document_id / version_idWhale content ID and current version ID, usable with Read Content & History
external_content_id / canonical_urlSource content ID and canonical URL
source_platform / content_typePlatform and content type (dataset_id is internal; ignore it)
title / body / body_formatTitle, full body and body format
language / region / country_codeLanguage and region
published_atSource publication time
content_hash / size_bytes / char_countBody hash, byte size and character count
author / subreddit / score / external_parent_id / external_thread_idAuthor, community, score and reply relationships; select them explicitly in fields for jsonl, included by default in parquet
platform_payloadComplete 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.

HTTPcodeMeaning and action
400invalid_export_requestMalformed request body
400export_create_failedValidation failed, such as a format/compression mismatch, published_from after published_to, partial fields for parquet, or the daily export limit; fix per message
400invalid_export_filesequence is not a non-negative integer
401unauthorizedThe API key is invalid
402credit_insufficientYour organization’s credit balance is insufficient
403export_forbiddenExport is not enabled for your subscription, or platforms or fields exceed your grants
404export_not_found / export_file_not_foundThe job or file does not exist, belongs to another application, or has expired
429rate_limit_exceededRate limited; back off per Retry-After

See the public API reference for every field.