Asynchronous Exports is available on Topsort’s public API.
Use an Advanced API key to call it.
Before you start
You need an Advanced API key. The API address ishttps://api.topsort.com.
The examples use curl. Save these once, so you can reuse them:
401 Unauthorized:
1. See what you can export
Ask which datasets exist and which columns each one allows. This call takes no parameters. A dataset is a kind of report. A dimension is how each row is split, such as the day or the vendor. A metric is a number in that row, such as clicks or spend.200 OK, shortened:
monitoring_metrics covers performance by campaign, placement, and device. reporting_summary accepts the same dimensions and metrics, plus attribution_type and auctions_won. See Available data.
If something fails on our side, the call returns
500 with internal_error. Contact our customer support team.
2. Ask for the file
Send the dataset, the columns you want, and the days you want.
Dates are local days of your marketplace. To export one day, send the same date as both
startDate and endDate. Columns in the file follow the order you send: dimensions first, then metrics.
The 31-day window and the 120-day history are defaults. Your marketplace can have different limits. If a request goes over them, the error message states your limit.
vendor_id is your own vendor ID, the same one you use across the Topsort API, both in vendorIds and in the file. In rare cases, vendor_id and vendor_name are empty in the file for a vendor whose details are not yet available for reporting.
Granularity has no default, so choose one explicitly:
For example,
"granularity": "total" with "dimensions": ["vendor_id"] gives one row per vendor, with that vendor’s numbers for the whole window.
Response 201 Created:
exportId. You need it for the next step. Each accepted export counts toward your daily quota of 20, which resets at midnight UTC.
400 Bad Request means the request breaks an export rule. detail says which one:
429 Too Many Requests (daily_request_limit_exceeded) means you used today’s quota. Wait until resetsAt in details. The Retry-After header says how many seconds are left.
422 Unprocessable Entity (validation_error) means a field such as granularity is missing, a list is empty, a dataset, dimension, metric, or granularity does not exist, or a date is not YYYY-MM-DD. details points to the field to fix.
3. Check until the file is ready
Ask for the export with theexportId from step 2.
pending or running, the response has no download link yet:
completed and has rows, the response includes downloadUrl:
completed and no rows matched, there is no file and no downloadUrl. The export still finishes as completed. message explains why.
failed, error says why. Failed exports are not retried. Request a new one. Use a shorter window or fewer dimensions if it failed because it took too long or the file was too large.
4. Download the file
Download the Parquet file fromdownloadUrl. The link already carries its own signature, so do not send the Authorization header.
downloadExpiresAt. If it expires, repeat step 3 to get a new link. You do not need to create a new export.
To take a quick look at the file with Python:
head() prints the first rows, so you can confirm the columns and the dates before you load the file anywhere else.