Report bucket storage used against a budget
b2_bucket_usageCalculate B2 bucket storage usage and compare it to a budget, flagging buckets that exceed a set percentage. Includes all file versions, with unfinished large uploads reported separately.
Instructions
Reports bytes stored per bucket and how that compares to a budget, flagging buckets over the threshold. B2 exposes no usage endpoint, so this is computed by summing every file version, INCLUDING old versions, which B2 also bills for. The figure EXCLUDES parts of unfinished large uploads, which B2 does bill for; those uploads are counted separately as unfinishedLargeFiles, so treat bytesUsed as a floor rather than a total. Omitting bucketName scans every bucket, which costs one transaction per 1000 versions per bucket and is the most expensive call this server makes. A scan is capped at 20 pages per bucket and sets truncated when the cap stops it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bucketName | No | Bucket to measure. Omit to scan every bucket. | |
| budgetBytes | No | Budget to measure against. Defaults to 10 GiB, B2 free tier. | |
| thresholdPercent | No | Percent of budget at which a bucket is flagged. Defaults to 80. |