Datalink generates the reports you configure in the Xeneta platform, once or on a schedule, as CSV, Excel or ZIP files. The /datalink/report endpoint lets your own scripts download those reports with your API key, without a browser and without email or SFTP delivery:
https://api.xeneta.com/v3.0/datalink/reportDownloading a report takes two requests:
- Call the endpoint with the id of a Datalink configuration. It returns the report object, which describes the report and carries a link to download it.
- Download the file from that link within 300 seconds. The link does not need your API key.
By default, the endpoint returns the newest report of the configuration. You can also request the newest report generated on a given day, or one specific report. See Get a report for details. To find out whether a new report is available without downloading anything, see Polling for new reports.
The endpoint serves the same reports you can download from the configuration's page in the Xeneta platform, whichever delivery method the configuration uses.
Access
The endpoint authenticates your requests with your API key, like the rest of the Xeneta API.
A report can only be downloaded with the API key of the user who created its configuration. That user also needs the same permissions as in the Xeneta platform: access to Datalink for the configuration's product (ocean or air), access to Datalink configurations, and access to every dataset the configuration uses.
Configurations are personalDatalink configurations are not shared with the other users in your organization, and neither are their reports. A colleague's API key gets
404with the codeconfiguration_not_found, exactly as for a configuration that does not exist.
A configuration that has been deleted in the Xeneta platform can no longer be downloaded through the API.
Configuration id
Every Datalink configuration has an id, which is part of the URL of the configuration's page in the Xeneta platform:
| Product | Configuration page URL |
|---|---|
| Ocean | https://app.xeneta.com/ocean/datalink/configurations/xArk/1 |
| Air | https://app.xeneta.com/air/datalink/xArk |
In both examples, the configuration id is xArk. Ids are case-sensitive, so be sure to copy them exactly as they appear.
Usage and quota
Downloading a report does not count towards your API quota, however often you download it. Quota is consumed when Datalink generates a report, not when you download it.