Skip to content

Incremental export

A recipe for keeping a copy of installs and in-app events in your storage with the flat raw rows. If hourly CSV files in a bucket suit you, Cloud export does the same without polling.

time_field=updated_at returns the installs with a version written in the window: new installs, reinstalls (a new random_user_id) and reattributions (a changed partner_id and click). Each install comes in its latest state.

  1. Request /v1/report/raw/installs with row_format=flat, time_field=updated_at and a window [from, to); page with offset until a page is shorter than limit.
  2. Upsert by app_id + affise_device_id + random_user_id; of two versions keep the one with the later updated_at.
  3. Start the next window a few minutes before the previous to (rows are written in batches, up to 60 seconds late) and end it a few minutes before now.
  4. Keep the window short — up to an hour. Every page reads the whole window again, so a day-long window is about ten times slower per page and may hit the request timeout for large apps.
curl -X POST https://restapi.affattr.com/v1/report/raw/installs \
-H 'API-KEY: <key>' -H 'Content-Type: application/json' \
-d '{"app_id":[123],"row_format":"flat","time_field":"updated_at",
"time_window":{"from_rfc3339":"2026-11-03T07:55:00Z","to_rfc3339":"2026-11-03T09:00:00Z"},
"pagination":{"offset":0,"limit":1000}}'

Things to know:

  • updated_at of a row may be later than to: the install was updated again after the window. It will also come in the window of that later update; the upsert keeps one row.
  • Do not take the updated_at of the last row as the next from: for the reason above it may skip installs. Move the window by its bounds and page inside it with offset.
  • The updates are kept 90 days. A window by updated_at older than 90 days may come back empty or incomplete. For the initial load or a gap longer than that, load the installs with a window by received_at or affise_event_timestamp, then go on by updated_at.

An event gets into exactly one received_at window, whenever it happened. Late events — sent from the SDK offline queue or by add_event with a past time — land in the window of the time we received them, not in a window you have already exported.

  1. Request /v1/report/raw/events with row_format=flat, time_field=received_at, page by page.
  2. Upsert by app_id + affise_device_id + random_user_id + affise_event_id.
  3. Move the window with an overlap of a few minutes, as for installs.

The attribution of an event row — partner_id, customer_user_id, is_re_install, product_id, google_* — is that of its install at the time of the request. When an install comes back from the updated_at export reattributed, either copy these fields to the stored events with the same app_id + affise_device_id + random_user_id, or request the events of the device again with devices_search.

A window by affise_event_timestamp reads the events received up to 7 days after the day the window ends; an event received later is returned only by a received_at window.

  • Clicks and impressions: windows by created_at with an overlap of a few minutes; key click_id.
  • Conversions: windows by created_at, key id (conversion_uuid). A conversion may change after it is created; request the last 48 hours again to pick the changes up.
  • Subscriptions: windows by received_at; updated_at is in the rows.

created_at of installs and events is the time the row was written; it is rewritten on reattribution and is not a reliable export cursor. Time fields: Time.