Access bandwidth usage through API

Hey guys,

I would like to stay up to date on the bandwidth usage of my sites, to be able to quickly identify potential malicious activity that could incur excessive costs. I’d like to create a script that monitors the bandwidth usage every so often, and flat out takes the site offline if certain thresholds are surpassed. Is there any way to do this with the current Netlify API? I found ways to monitor your build minutes used, but nothing so far that does the same for the bandwidth. I know I can see them through the dashboard itself, but the point would be to create some sort of a fail-safe mechanism that would not require me to check the dashboard manually.

Thanks for your time!

Authorization: Bearer <token>

Do you know how often this updates your bandwidth? I’ve just been playing about with it as we’re wanting to set up something to trigger alerts when we go over certain amounts - but just in my testing over the past 24 hours it seems to constantly return the same number and then just once it jumped up a lot and then has remained static at that number. I was also wondering if it’s possible to get such figures at the site level, rather than account. Given that in the Netlify
UI you can see an hourly graph of bandwidth used by a particular site - I’m guessing that’s coming form the API but can’t find it documented.

Where are the bandwidth graphs? I can’t find any in my account.

If I go into one of my sites and to the Analytics page, there is a “Bandwidth used” chart at the bottom right.

1 Like

Ah, I don’t pay for analytics so I didn’t see the charts there.

1 Like