The reports API allows you to request more granular reporting for images within your Sources by creating a cURL request. Here's an example of a report request using cURL:
curl -u "<API_KEY>:" "https://api.imgix.com/v2/account/reports?limit=5&sort=report_key&order=desc&offset=9"
Make a request
Before you begin making a report request using our API, it's important you first install cURL for your command line.
Once installed, you can follow the steps below to make a request to our reporting API:
- Open your command line
- Use the command
curl -u "<API_KEY>:" "https://api.imgix.com/v2/account/reports
- Replace <API_KEY> with your own API key. You can get this within your imgix account settings.
- You will receive a JSON response with a list of reports, their report types and a file link to download the report
Note that the file links automatically expire after a period of time. You can regenerate new links by making another request to our reporting API.
You can apply parameters to fine tune your report request. The available parameters are:
sort: The field to sort on.
order: "desc" will trigger descending order.
limit: The maximum number of records to return.
offset: The first n records to skip (useful when sorting).
filter[key]: Filter on key.
Here's an example of a report with parameters applied:
curl -u "<API_KEY>:" "https://api.imgix.com/v2/account/reports?limit=5&sort=report_key&order=desc&offset=9
Types of reports
The image analytics report contains daily metrics for each master image, updated once a day. It includes the number of requests and errors generated by each image. You can download an example here:
The Source analytics report contains daily metrics for each Source, updated once a day. It includes information regarding total master images, total bandwidth, average response times and more. You can download an example here:
The CDN logs report contains daily logs for requests made to our CDN for your images, updated once a day. It will include information such as referrers, user agents, cache hits/misses per image and more. You can download an example here:
The mild errors report contains data regarding the number of 4xx level errors that occur per image, updated once per day. You can download an example report here:
Request has timed out
Your request to the API may time out if there are too many results to return. You can solve this by setting a limit on the number of records fetched using the limit parameter. Example:
curl -u "<API_KEY>:" "https://api.imgix.com/v2/account/reports?limit=5
See the Parameters section above in order to find more information on sorting through reports.