Перейти к содержимому

Run a custom report and download it as CSV

POST
/api/v1/analytics/report/export
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" } ] }'
format
string
Allowed values: csv
Media typeapplication/json
object
from
required
string

Example

2026-03-01T00:00:00Z
to
required
string

Example

2026-03-08T00:00:00Z
timezone

IANA timezone for date/hour/week/month bucketing. Defaults to the requesting user’s profile timezone (see PATCH /users/me).

string

Example

Europe/Moscow
groupBy
required

1..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>.

Array<string>

Example

[
"sub_id:sub_id_2"
]
filters
Array<object>
object
field
required

Dimension to filter on — same vocabulary as groupBy (e.g. “country”, “sub_id:sub_id_2”)

string

Example

country
operator
required
string
Allowed values: eq neq in not_in
value
required

Value to compare against. Array required for in/not_in.

object

Example

US
metrics

Restrict output to these metric names (base or custom). Default: all.

Array<string>

Example

[
"clicks",
"revenue",
"roi"
]
orderBy
object
field
required

A groupBy dimension token or a metric name (base or custom)

string

Example

revenue
direction
string
default: desc
Allowed values: asc desc
limit
number
default: 100 >= 1 <= 1000
offset
number
0
dateBasis

‘click’: a conversion is attributed to the period of the click it’s linked to. ‘conversion’: attributed to its own converted_at.

string
default: click
Allowed values: click conversion
compareWith
string
Allowed values: previous_period
customMetrics
Array<object>
object
name
required

Name this custom metric will appear under in the output

string

Example

epc_x1000
formula
required

Arithmetic expression over base metric names: + - * / and parentheses only

string

Example

revenue / clicks * 1000

CSV file download