- 31 Oct 2024
- 1 Minute to read
- Print
- PDF
API: Sub-Accounts Accessing Bucket and Utilization Data Through an API
- Updated on 31 Oct 2024
- 1 Minute to read
- Print
- PDF
How can my Sub-Accounts access Bucket and Utilization data through an API?
You have a Sub-Account that is looking for a way to programmatically access bucket and utilization data for their Sub-Account. They might be looking for this data to monitor activity across different departments, or maybe they are managing different customers by creating separate Buckets.
By using Wasabi Billing Endpoints, your Sub-Accounts can access daily summary utilization of their Sub-Account as well as daily utilizations of all buckets broken down into per-bucket components.
API Base URL: https://billing.wasabisys.com
Available Endpoints:
GET /utilization
GET /utilization/bucket
How to use the Billing Endpoint?
For security reasons, the Billing Endpoints caller must use HTTPS, as any non-HTTPS calls will be redirected to HTTPS endpoints. The caller must use the Access Key and Secret Key generated in the Wasabi Console as the Authorization header value. If you need to generate a new Wasabi API Access Key Set, see this how to article (Creating a Wasabi API Access Key Set)
Authorization Header
Authorization : :
GET /utilization
Return the daily storage and data transfer associated with the Sub-Account, across all buckets in the Sub-Account. Using from and to query string parameters (in the format YYYY-MM-DD) will apply date filters to the result set.
Parameters to query with
Key | Value | Description |
---|---|---|
from | yyyy-mm-dd | Data from this date |
to | yyyy-mm-dd | Data to this date |
csv | true | Format the response in a CSV format |
GET /utilization/bucket
Return all daily utilizations of the Sub-Account which is broken down into per-bucket components.
Example API call for Monthly Bucket Utilization
GET https://billing.wasabisys.com/utilization/bucket/?withname=true&from=2022-05-31&to=2022-06-01
This will give you all the Bucket Utilization metrics including the Bucket Name for May 31 to June 1. This is essentially 1 daily record for each bucket on June 1.
Parameters to query with
Key | Value | Description |
---|---|---|
withname | true | Includes Bucket Name in the response |
from | yyyy-mm-dd | Data from this date |
to | yyyy-mm-dd | Data to this date |
csv | true | Format the response in a CSV format |
How to calculate Total Storage in TB based on the API response
Total Storage (TB) = Active Storage (TB) + Deleted Storage (TB)
Active Storage (TB) = ( PaddedStorageSizeBytes + MetadataStorageSizeBytes) / 1024 / 1024 / 1024 / 1024
Deleted Storage (TB) = DeletedStorageSizeBytes / 1024 / 1024 / 1024 / 1024
Want to calculate storage charges based on utilization? See this how-to article How do I calculate charges based on bucket utilization?
Want to set up an email notification for storage based upon this API? See this KB article about sending email notifications using the Billing API.