Tiny Stats API

Authentication

The Tiny Stats API is secured through the use of the HTTP Authorization header via the Bearer syntax. Your access token can be found at https://stats.diet/developers.

  • Base URL   https://stats.diet/api  
  • Bearer Token  abc_123_your_access_token  

axios.defaults.baseURL = 'https://stats.diet/api';
axios.defaults.headers.common['Authorization'] = 'Bearer abc_123_your_access_token';

Sandbox

In order to facilitate Fooling Around™ before you unlock full access to your developer account you can hit all the following :token endpoints using the demo token.

GET /tokens/demo
GET /stats/demo/:interval
GET /images/demo/:interval

The POST endpoint is locked 😬 and the DELETE endpoint won’t work cause I can’t have you deleting my demo token 👿 Everything else though should work perfectly while you test and integrate.

Rate Limit

The rate limit set to 1000 requests per hour and 100 requests per minute. We will return the following headers to help you manage this.

x-rate-hr-limit
x-rate-hr-sent

x-rate-min-limit
x-rate-min-sent

Pings

Test your token and retrieve some basic information on your developer account.

 GET /ping  

 
axios.get('/ping')
.then((res) => {
  console.log(res);
})
.catch((err) => {
  console.error(err);
});

200 Success => {
  message: "Authorized. Token is valid",
  developer: {
    email: "hi@domain.com",
    tz: "America/New_York",
    tokens: 5
  },
  status: "success"
}

400 Error => {
  message: "Unauthorized. Token is invalid",
  status: "error"