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
curl -sS "$WHALE_BASE_URL/v1/documents/$DOCUMENT_ID/snapshots?limit=500" \
-H "Authorization: Bearer $WHALE_API_KEY"{
"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_countand 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:
POST /v1/metrics/baselines/query
{
"platform": "reddit",
"content_type": "post",
"age_bucket": "1_7d",
"metric": "comment_count",
"target_value": 86
}{
"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.
| Parameter | Meaning |
|---|---|
age_bucket | Time 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_of | Read the baseline for an earlier day; not later than now |
percentiles | Up 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_size | No 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
statusisn’tobservedthere’s no distribution:insufficient_samples,unsupported_metricormetric_unavailable. - Available metrics:
GET /v1/metrics/registry. - Requires access to the platform and the
metricsfield.
Copy all snapshots in a time window
To copy snapshots in bulk, don’t call per document; use GET /v1/snapshots:
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"| Parameter | Meaning |
|---|---|
snapshot_from, snapshot_to | Required. Start inclusive, end exclusive, up to 31 days |
source_platform | Platforms, comma-separated. Optional when the application has only one kind of platform |
content_type | Optional; read only some types |
limit | 1 to 500, default 200 |
cursor | The previous next_cursor; keep the other parameters unchanged |
{
"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 insource_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. metricsneeds metrics access andauthor_snapshotneeds author access. Access limited by language, region or publish time can’t use this endpoint and returns403.
Read raw data for snapshots
When you need the platform’s raw data, send the snapshots from the previous step in groups of 100:
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.
{
"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) orforbidden(no snapshot access). - More than 100 items or missing fields returns
400 invalid_queryfor 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
- Read the day with
GET /v1/snapshotsandlimit=500until there’s nonext_cursor. - Take the collection date from each snapshot’s
source_record_key. If you only need metrics, you’re done. - For raw data, call
POST /v1/snapshots/payloads/batch-getwith 100 snapshots at a time. - Match raw data to step 1 by
snapshot_id. Checknot_founditems individually withGET /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.