Skip to main content

Usage endpoints

The Platform API exposes two usage endpoints. Both are read-only — they reflect what the console shows on the Overview page.

GET /v1/usage

Returns total storage and trailing-24-hour bandwidth usage across all buckets on your account.

Request

curl -H "Authorization: Bearer $(echo -n "$KEY:$SECRET" | base64)" \
https://api.filebase.io/v1/usage

Response

{
"storage": {
"bytes": 4977622511155
},
"bandwidth": {
"bytes": 12345678
}
}
FieldDescription
storage.bytesTotal bytes stored across all buckets, updated hourly.
bandwidth.bytesTotal egress bytes over the trailing 24 hours.

GET /v1/usage/storage/{bucket}

Returns storage usage for a single bucket.

Request

curl -H "Authorization: Bearer $(echo -n "$KEY:$SECRET" | base64)" \
https://api.filebase.io/v1/usage/storage/my-bucket

Response

{
"storage": {
"bytes": 1251576869
}
}
FieldDescription
storage.bytesBytes stored in this bucket.

Scripting examples

Bash — daily storage report

#!/bin/bash
AUTH=$(echo -n "$FILEBASE_KEY:$FILEBASE_SECRET" | base64)
GB=$(curl -sH "Authorization: Bearer $AUTH" \
https://api.filebase.io/v1/usage \
| jq -r '.storage.bytes / 1024 / 1024 / 1024 | floor')
echo "Storage: ${GB} GB"

Python — per-bucket breakdown

import os, base64, requests

auth = base64.b64encode(
f"{os.environ['FILEBASE_KEY']}:{os.environ['FILEBASE_SECRET']}".encode()
).decode()

headers = {'Authorization': f'Bearer {auth}'}

# List buckets via the S3 API, then query usage for each
import boto3
s3 = boto3.client('s3',
endpoint_url='https://s3.filebase.io',
region_name='auto',
aws_access_key_id=os.environ['FILEBASE_KEY'],
aws_secret_access_key=os.environ['FILEBASE_SECRET'],
)

for bucket in s3.list_buckets()['Buckets']:
name = bucket['Name']
r = requests.get(
f'https://api.filebase.io/v1/usage/storage/{name}',
headers=headers,
)
bytes_used = r.json()['storage']['bytes']
print(f'{name:30} {bytes_used / 1024 / 1024:>10.1f} MB')

What's next