Change Feed
The change feed lets your program keep pulling “which documents are new or changed”, then read details as needed. By the end of this page you can write a sync job that misses nothing.
It’s pull-only: your program polls, and MarsYoo never pushes.
Event types
| Event | Created when | Then read |
|---|---|---|
document.created | A new document is stored | Read documents in batch |
document.version.created | Title, body or other content changes and a new version is created | Read that version’s body with version_id |
document.metrics.updated | Metrics change | Read metric snapshots |
Delete and takedown events aren’t reliable yet; don’t use them to sync deletions.
First read
curl -sS --get "$WHALE_BASE_URL/v1/changes" \
-H "Authorization: Bearer $WHALE_API_KEY" \
--data-urlencode "event_type=document.created,document.version.created,document.metrics.updated" \
--data-urlencode "limit=100"Without cursor, reading starts from the earliest event in the retention window.
{
"items": [
{
"sequence": 42,
"event_id": "chg_xxx",
"event_type": "document.version.created",
"source_platform": "reddit",
"document_id": "doc_xxx",
"version_id": "ver_xxx",
"changed_fields": ["title", "body", "metadata"],
"occurred_at": "2026-10-09T11:55:00Z",
"ingested_at": "2026-10-09T12:00:02Z"
}
],
"next_cursor": "opaque-cursor"
}Events carry only IDs and changed field names, no body. Collect the document_ids on a page and read them in batch.
| Parameter | Meaning |
|---|---|
cursor | The previous page’s next_cursor. Omit on the first read |
limit | 1 to 200 per page, default 100 |
event_type | Event types, comma-separated |
source_platform | Platforms, comma-separated |
ingested_from, ingested_to | Filter by ingest time, RFC 3339 |
The sync loop
- Request a page with your saved cursor.
- Process every event on the page.
- After processing succeeds, save
next_cursor. - Request the next page with the new cursor.
Note: Always finish the whole page before saving the cursor. Save first and crash mid-way, and you’ll skip events.
The same cursor always returns the same page.
An empty page doesn’t mean you’re done
Each request searches for up to 8 seconds. Events outside your access are filtered out, so a page may have fewer than limit events or none at all, while next_cursor still moves forward.
- Process and save that cursor, then keep requesting.
- When the cursor stops changing, there are no new events for now; wait before requesting again.
Deduplication
- Every event is delivered at least once. Rarely, the same event appears twice with the same
event_idand differentsequence. Deduplicate byevent_idor make processing idempotent. - Events come in increasing
sequence. Gaps insequenceare normal, not losses.
Cursors are tied to filters
A cursor works only with the application and filters that produced it. If you change application, event types, platforms or time filters, start again without the old cursor.
Latency and retention
- New events are readable about 2 to 3 minutes after ingest.
- Events are kept for 30 days. Older cursors return
410. - If your job may stop for a long time, monitor when the cursor was last saved so it doesn’t exceed retention.
On 410:
- Drop the cursor and read again from the earliest retained event.
- Fill the gap with a bulk export by ingest time.
When something fails
On 503 changes_timeout or changes_unavailable, wait for Retry-After and retry with the same cursor. Don’t skip ahead.
Other errors: Error codes. The Python and Go SDKs work too, but you still save the cursor yourself.