Catch that Millionth Download with Bintray’s New Statistics API

Want to know exactly how many times your packages have been downloaded? Bintray has always given you download statistics through its UI, but now you can also get them for professional repositories via REST API. Detailed statistics on downloads per version over any time frame give you deep insights into how your software releases are consumed.
If you have never used statistics in Bintray, go ahead and check it out in the user guide.

Let’s see an example
Say I want to get the daily number of downloads of ‘myCoolPackage’ from October 1st to October 8th, 2015. This is what the stats look like in the Bintray UI:

myCoolPackage Downloads UI Stats Per Week

According to the chart, ‘myCoolPackage’ was downloaded a total of 147,752 times in that period. We can clearly see that there were downloads every day; there were dips on October 4th (Sunday) and October 8th (the chart was generated on October 8th around midday), and the most popular versions were 1.1.0 and 1.2.0.

Now you can get all this information programmatically using the new REST API. Here’s the “daily downloads” API as it is described in the REST API documentation:

GET /packages/:subject/:repo/:package/stats/time_range_downloads

To get the statistics displayed in the chart above, I would use the following command:

curl -X GET "" -u tamarUser:***my-top-secret-api-key*** -H "content-type:application/json" -d “{\"from\":\"2015-10-01T12:08:56.235z\",\"to\":\"2015-10-08T12:08:56.235z\"}"

I get the following response in JSON format:


The response provides all of the same data that Bintray uses to create the chart in the UI. For each day within the requested date range in which downloads occurred, it lists the number of downloads per version. As simple JSON output, you can easily parse the response and use it any way that helps you analyze your package downloads quickly and effectively. You are now able to identify trends in downloads, your popular versions and more.

Other statistics REST APIs include: total downloads and downloads by country. Keep an eye on this blog to hear about new APIs when we add them.

Good luck!

One thought on “Catch that Millionth Download with Bintray’s New Statistics API

  1. I am a maintainer for the Homebrew “chapel” package, but I am not connected with the Homebrew team in any way. Chapel itself is not on Bintray, as far as I know, except for our Homebrew bottles- which get installed by the Homebrew team, not us. (However, we are on GitHub, including a GH organization).

    I would like to use the Bintray API to obtain daily download stats for the Chapel Homebrew bottles. However, I tried this

    curl -uawallace-cray:xxxxxxxx -H “Content-Type: application/json”

    and the best I could get was:

    The Homebrew maintainers say this should work, because they set the “public” flags on Bintray:
    {“name”: “#{bintray_package}”,
    “public_download_numbers”: true,
    “public_stats”: true}

    Your docs say download stats are available “for Professional repositories”, but I do not know if package/homebrew/bottles/chapel is Professional. Is that the problem?

    My “awallace-cray” Bintray account is not “Premium”, either. I just created it to try the API. I am willing to explore other possibilities, especiallly with some guidance. The Bintray-GitHub integration may be useful. Any suggestions?

    Thanks very much!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s