Documentation Index
Fetch the complete documentation index at: https://stashfyle.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Retrieve your current usage statistics including storage, bandwidth, and upload counts.
Response
Total storage used in bytes.
Bandwidth used this period in bytes.
Number of uploads this period.
Start of current billing period (YYYY-MM-DD).
Example
curl https://api.stashfyle.com/v1/usage \
-H "Authorization: Bearer sk_live_xxx"
{
"storage_bytes": 524288000,
"bandwidth_bytes": 1073741824,
"upload_count": 150,
"period_start": "2024-01-01"
}
Understanding Usage
Storage
Total bytes of all files currently stored. Decreases when you delete files.
const storageGB = usage.storage_bytes / (1024 * 1024 * 1024);
console.log(`Using ${storageGB.toFixed(2)} GB`);
Bandwidth
Total bytes downloaded from your files this billing period. Resets monthly.
Bandwidth has zero egress fees thanks to Cloudflare R2. Limits are for fair use only.
Upload Count
Number of files uploaded this billing period. Resets monthly.
Monitoring Usage
Check Against Limits
const PLAN_LIMITS = {
free: { storage: 1 * 1024 * 1024 * 1024, uploads: 1000 },
hobby: { storage: 10 * 1024 * 1024 * 1024, uploads: 50000 },
pro: { storage: 100 * 1024 * 1024 * 1024, uploads: 500000 },
};
async function checkUsage(plan) {
const response = await fetch('https://api.stashfyle.com/v1/usage', {
headers: { 'Authorization': `Bearer ${API_KEY}` }
});
const usage = await response.json();
const limits = PLAN_LIMITS[plan];
return {
storageUsedPercent: (usage.storage_bytes / limits.storage) * 100,
uploadsUsedPercent: (usage.upload_count / limits.uploads) * 100,
isNearLimit: usage.storage_bytes > limits.storage * 0.8
};
}
Set Up Alerts
async function checkAndAlert() {
const { storageUsedPercent, isNearLimit } = await checkUsage('hobby');
if (isNearLimit) {
// Send notification to upgrade or clean up
console.warn(`Storage at ${storageUsedPercent.toFixed(1)}%`);
}
}
// Run daily
setInterval(checkAndAlert, 24 * 60 * 60 * 1000);
Plan Limits Reference
| Plan | Storage | Bandwidth/mo | Uploads/mo |
|---|
| Free | 1 GB | 5 GB | 1,000 |
| Hobby | 10 GB | 50 GB | 50,000 |
| Pro | 100 GB | 500 GB | 500,000 |
Errors
| Code | Status | Description |
|---|
unauthorized | 401 | Invalid or missing API key |
rate_limit_exceeded | 429 | Too many requests |