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