Run a custom report and download it as CSV
const url = 'https://example.com/api/v1/analytics/report/export?format=csv';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"from":"2026-03-01T00:00:00Z","to":"2026-03-08T00:00:00Z","timezone":"Europe/Moscow","groupBy":["sub_id:sub_id_2"],"filters":[{"field":"country","operator":"eq","value":"US"}],"metrics":["clicks","revenue","roi"],"orderBy":{"field":"revenue","direction":"asc"},"limit":100,"offset":0,"dateBasis":"click","compareWith":"previous_period","customMetrics":[{"name":"epc_x1000","formula":"revenue / clicks * 1000"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url 'https://example.com/api/v1/analytics/report/export?format=csv' \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "from": "2026-03-01T00:00:00Z", "to": "2026-03-08T00:00:00Z", "timezone": "Europe/Moscow", "groupBy": [ "sub_id:sub_id_2" ], "filters": [ { "field": "country", "operator": "eq", "value": "US" } ], "metrics": [ "clicks", "revenue", "roi" ], "orderBy": { "field": "revenue", "direction": "asc" }, "limit": 100, "offset": 0, "dateBasis": "click", "compareWith": "previous_period", "customMetrics": [ { "name": "epc_x1000", "formula": "revenue / clicks * 1000" } ] }'Authorizations
Заголовок раздела «Authorizations»Parameters
Заголовок раздела «Parameters»Query Parameters
Заголовок раздела «Query Parameters»Request Bodyrequired
Заголовок раздела «Request Bodyrequired»object
Example
2026-03-01T00:00:00ZExample
2026-03-08T00:00:00ZIANA timezone for date/hour/week/month bucketing. Defaults to the requesting user’s profile timezone (see PATCH /users/me).
Example
Europe/Moscow1..5 dimensions, e.g. [“date”, “country”] or [“sub_id:sub_id_2”]. Allowed: date, hour, week, month, link, offer, landing, network, traffic_source, country, city, device, os, browser, language, referer, bot, sub_id:<sub_id_1..sub_id_30>.
Example
[ "sub_id:sub_id_2"]object
Dimension to filter on — same vocabulary as groupBy (e.g. “country”, “sub_id:sub_id_2”)
Example
countryValue to compare against. Array required for in/not_in.
object
Example
USRestrict output to these metric names (base or custom). Default: all.
Example
[ "clicks", "revenue", "roi"]object
A groupBy dimension token or a metric name (base or custom)
Example
revenue‘click’: a conversion is attributed to the period of the click it’s linked to. ‘conversion’: attributed to its own converted_at.
object
Name this custom metric will appear under in the output
Example
epc_x1000Arithmetic expression over base metric names: + - * / and parentheses only
Example
revenue / clicks * 1000Responses
Заголовок раздела «Responses»CSV file download