Requirements:
- Cloudflare account
- Command line tool such as Command on a Windows machine, and Terminal or iTerm on a Mac
- Appropriate access level privileges to your Cloudflare.com so you can source identifying keys such as the (Zone ID and API keys which you will need).
We are going to use a Cloudflare API called "Analytics dashboard API". This analytics dashboard API will give you a bunch of analytics that you would normally see in your dashboard, however, I am going to focus on showing you how to get your bandwidth numbers, including the cached and uncached bandwidth figures.
You can always view more analytics fields and other optional parameters by following the steps on the Cloudflare API page: https://api.cloudflare.com/#zone-analytics-dashboard