Skip to content

Get storage stats

By , Head of IntegrationsUpdated

Open this page in a new chat

Short answer

Get storage stats with GET /v2/stats/storage. It returns, for each day, the storage your plan includes, the storage you used and the number of files, for the dates you give in from and to, or the last month. Each call needs a bearer token and counts towards your hourly API limit.

After reading this you will know

  • How to get storage stats
  • Which parameters it takes
  • Sample code in 9 languages and a sample answer

This command needs a bearer token and counts towards your hourly limit.

GEThttps://api.sirv.com/v2/stats/storage

Use this API method to check the total amount of data stored on a given day or each day over a certain period.

Query parameters

NameTypeRequiredExampleDescription
fromdate-timeNo2020-07-01T00:00:00.000Default: 1 month ago, rounded to start of day
todate-timeNo2020-07-05T00:00:00.000Default: now, rounded to end of day

Example request

// Your bearer token, from POST /v2/token, in the SIRV_TOKEN environment variable
const res = await fetch('https://api.sirv.com/v2/stats/storage?from=2020-07-01T00%3A00%3A00.000&to=2020-07-05T00%3A00%3A00.000', {
method: 'GET',
headers: { authorization: `Bearer ${process.env.SIRV_TOKEN}` },
});
console.log(res.status, await res.text());

Example response

{
"1593734400000": {
"plan": 100000000000,
"burstable": 500000000000,
"extra": 0,
"used": 49238608587,
"files": 65400,
"quotaExceededDate": null
},
"1593561600000": {
"plan": 100000000000,
"burstable": 500000000000,
"extra": 0,
"used": 49238608587,
"files": 65413,
"quotaExceededDate": null
}
}
Back to top