Download Markdown

Read Metrics & Author Snapshots

Each time a document is collected, its likes, comments, views and other metrics are recorded as a snapshot. By the end of this page you can read snapshot history, compare against similar documents, and copy a time window of snapshots into your own system.

Read a document’s metric history

Bash
curl -sS "$WHALE_BASE_URL/v1/documents/$DOCUMENT_ID/snapshots?limit=500" \
  -H "Authorization: Bearer $WHALE_API_KEY"
JSON
{
  "snapshots": [
    {
      "id": "ds_01J...",
      "snapshot_at": "2026-09-02T10:00:00Z",
      "metrics": {"like_count": 1204, "comment_count": 86, "repost_count": 45, "view_count": 152000},
      "author_snapshot": {"follower_count": 89000}
    }
  ]
}
  • Newest first, up to 500, no pagination.
  • metrics: common metrics (like_count, comment_count, share_count, view_count, play_count, collect_count and so on) plus platform-specific ones. Definitions per platform are in the field reference.
  • author_snapshot: the author’s follower count and similar at that time. Absent when the platform doesn’t provide it.
  • Collection intervals vary. Plot trends using each snapshot’s snapshot_at; don’t assume one per hour.

For just the latest metrics, add "include_latest_snapshot": true when reading documents in batch.

Compare with similar documents

To answer “is 86 comments a lot?”, use metric baselines. They give the distribution of a metric for documents of the same platform and type, and where your value falls:

JSON
POST /v1/metrics/baselines/query
 
{
  "platform": "reddit",
  "content_type": "post",
  "age_bucket": "1_7d",
  "metric": "comment_count",
  "target_value": 86
}
JSON
{
  "status": "observed",
  "as_of": "2026-10-30T00:00:00Z",
  "lookback_days": 30,
  "sample_size": 182340,
  "distribution": {"min": 0, "max": 21430, "mean": 14.2, "percentiles": {"0.5": 3, "0.9": 31, "0.99": 260}},
  "target": {"value": 86, "percentile": 0.962}
}

target.percentile: 0.962 means more comments than 96.2% of similar documents.

ParameterMeaning
age_bucketTime since publish when the snapshot was taken: 0_24h, 1_7d, 7d_plus or any (default). Use 0_24h for new documents, or older ones inflate the distribution
as_ofRead the baseline for an earlier day; not later than now
percentilesUp to 20 values between 0 and 1, ascending. Default 0.1, 0.25, 0.5, 0.75, 0.9, 0.95, 0.99
min_sample_sizeNo distribution below this many samples; default 100
  • Baselines are computed daily from the 30 days of snapshots before the cutoff, counting each document once.
  • If status isn’t observed there’s no distribution: insufficient_samples, unsupported_metric or metric_unavailable.
  • Available metrics: GET /v1/metrics/registry.
  • Requires access to the platform and the metrics field.

Copy all snapshots in a time window

To copy snapshots in bulk, don’t call per document; use GET /v1/snapshots:

Bash
curl -sS --get "$WHALE_BASE_URL/v1/snapshots" \
  -H "Authorization: Bearer $WHALE_API_KEY" \
  --data-urlencode "source_platform=app_store,google_play" \
  --data-urlencode "content_type=product_listing" \
  --data-urlencode "snapshot_from=2026-10-24T00:00:00Z" \
  --data-urlencode "snapshot_to=2026-10-25T00:00:00Z" \
  --data-urlencode "limit=500"
ParameterMeaning
snapshot_from, snapshot_toRequired. Start inclusive, end exclusive, up to 31 days
source_platformPlatforms, comma-separated. Optional when the application has only one kind of platform
content_typeOptional; read only some types
limit1 to 500, default 200
cursorThe previous next_cursor; keep the other parameters unchanged
JSON
{
  "snapshots": [
    {
      "id": "snap_0d99...",
      "document_id": "doc_01J...",
      "version_id": "ver_01J...",
      "source_platform": "google_play",
      "source_record_key": "google_play:relations:com.example.app:similar:us:2026-11-04:ab12cd",
      "snapshot_at": "2026-11-04T03:12:45.123Z",
      "metrics": {"entries": 6},
      "content_type": "product_listing"
    }
  ],
  "next_cursor": "eyJhdCI6..."
}

No next_cursor means you’ve read everything.

Things to know:

  • Snapshots fall into windows by snapshot_at (when they were received). Batches around midnight may land in the next day; to group by collection date, use the date in source_record_key.
  • Late snapshots appear in their own window. When syncing daily, also re-read the previous day.
  • When a document’s content doesn’t change, new snapshots keep the old version_id. Rebuild daily data from snapshots, not from version dates.
  • Platforms in one request must be of the same kind, or you get 400; split the request.
  • metrics needs metrics access and author_snapshot needs author access. Access limited by language, region or publish time can’t use this endpoint and returns 403.

Read raw data for snapshots

When you need the platform’s raw data, send the snapshots from the previous step in groups of 100:

JSON
POST /v1/snapshots/payloads/batch-get
 
{
  "items": [
    {"document_id": "doc_01J...", "snapshot_id": "snap_01J...", "snapshot_at": "2026-11-04T03:12:45.123Z"}
  ]
}

Take all three values from GET /v1/snapshots as-is: document_id, id (as snapshot_id) and snapshot_at. A mismatched time won’t be found.

JSON
{
  "snapshots": [
    {"document_id": "doc_01J...", "snapshot_id": "snap_01J...", "platform_payload": {"snapshot_date": "2026-11-04", "entries": []}},
    {"document_id": "doc_01J...", "snapshot_id": "snap_01K...", "error": {"code": "not_found", "message": "document snapshot not found"}}
  ]
}
  • You get the raw data stored with the snapshot’s version, plus this snapshot’s platform_metrics. Snapshots taken while content didn’t change return the same raw data.
  • Snapshots without a version (such as a rating with no text) return the raw data of that ingest.
  • Returned in request order; duplicates appear once.
  • A failed item has error: not_found (missing or time mismatch) or forbidden (no snapshot access).
  • More than 100 items or missing fields returns 400 invalid_query for the whole request.
  • 100 items usually take 1 to 2 seconds. Read sequentially with at most 2 concurrent requests.

Example: rebuild all snapshots for one day

  1. Read the day with GET /v1/snapshots and limit=500 until there’s no next_cursor.
  2. Take the collection date from each snapshot’s source_record_key. If you only need metrics, you’re done.
  3. For raw data, call POST /v1/snapshots/payloads/batch-get with 100 snapshots at a time.
  4. Match raw data to step 1 by snapshot_id. Check not_found items individually with GET /v1/documents/{document_id}/snapshots.

When something fails

A query timeout returns 503 document_query_timeout; retry later with the same cursor rather than restarting with a smaller window. Other errors: Error codes.