API for account information

December 6, 2016 2.4k views
Debian API

Does anyone have any ideas for getting accounting information via the API? As our droplets increase it would be great to have a way of pinging the API for costings. We could then use that information to build a local dashboard that refreshes every so often. At the moment, every time a droplet is built, via the API or otherwise, somebody has to manually record the costing in a local spreadsheet - seems a bit stone age!


3 Answers

I don’t think there is billing API available.

But you can find a work around. If you want just to calculate how much Droplets will cost you monthly, use API to fetch all Droplets. Then based on size calculate how much each will cost and sum it.

If you want real-time stats you can do that too.
Fetch all Droplets. List has Created at which will tell you when you created.
Calculate how much hours passed for that month. Don't forget that Droplets are charged for 672 hours per month.
Now you have real time stats whenever you need.

Don’t forget Snapshots, Backups and Block Storage if you use it.

Great, thanks for the replies.
I think I could also make use of Tags (provided they were created with the correct information on droplet creation) and sum the values that way.

Lots for me to try, thanks.

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!