API Statistics

It's useful to know how many API requests you've used. There's an endpoint for that.

On the hosted plan, there's a /stats endpoint for your site which gives you a count of requests made by the requesting api token, and the total for the account.

🚧

This endpoint is rate limited

We rate-limit the /stats endpoint to one request every 10 seconds. This is to avoid the risk of api enumeration by hitting the endpoint lots of times in quick succession with different token attempts. You'll get a 503 error if you hit the endpoint too frequently.

Simply hit https://yoursite.rooftopcms.io/stats with a valid api-token header and you'll get a set of results which looks like this:

{
    "total": {
        "week": 94469,
        "month": 1449903,
        "day": 94469,
        "hour": 595,
        "minute": 30
    },
    "token": {
        "week": 91034,
        "month": 1351447,
        "day": 91034,
        "hour": 580,
        "minute": 30
    }
}

πŸ“˜

We don't expose all the tokens in this JSON

You'll see that there are 2 keys in the root: token and total. We considered exposing all the tokens here so you could see counts for each, but figured there might be situations where you don't want all API clients to see each others' tokens.