API Documentation

How to get started

In order to take advantage of our API you need to create API Key and Secret. Click here to do so.

Once you've generated your API Key and Secret you can start using our API.

We describe how to authenticate and use our API below.

Authentication

The base URL of our API is https://api.toastedanalytics.com/client

Each request made to one of our endpoints requires authentication by using API Key and Secret that you've generated in your Toasted Analytics Dashboard.

Pass the following authentication headers with each request:

X-API-Key: "YOUR_API_KEY_HERE"
X-API-Secret: "YOUR_API_SECRET_HERE"

Please note that both keys should be kept confidential, using your API Key & Secret in a publicly available frontend application is therefore not allowed since this will expose both of your keys to the public granting everyone access to your Toasted Analytics account.

Endpoints

get
List websites

https://api.toastedanalytics.com/client/v1/websites
Returns a list of your websites
Request
Response
Request
Headers
X-API-Secret
required
string
Your API Secret
X-API-Key
required
string
Your API Key
Response
200: OK
{
"data": [
{
"uuid": "c34be1d1-4301-4a1f-8ca9-7a4a7f138aa7",
"name": "Some Website"
"domain": "somewebsite.com",
"createdAt": 1579556817
},
{
"uuid": "09cdf9e5-11aa-48b5-8c29-ba356721e9b3",
"name": "Another Website",
"domain": "another-website.com",
"createdAt": 1579655156
}
]

get
Get website statistics

https://api.toastedanalytics.com/client/v1/website/{WEBSITE_UUID}/stats
Returns pageview stats in a given time window (both daily and total)
Request
Response
Request
Path Parameters
WEBSITE_UUID
required
string
UUID of the website
Headers
X-API-Key
required
string
Your API Key
X-API-Secret
required
string
Your API Secret
Query Parameters
from
required
string
UNIX Timestamp
to
required
string
UNIX Timestamp
Response
200: OK
{
"daily": [
{
"date": "19-01-2020",
"visits": 7
},
{
"date": "20-01-2020",
"visits": 4
}
],
"uniqueDaily": [
{
"date": "19-01-2020",
"visits": 7
},
{
"date": "20-01-2020",
"visits": 4
}
],
"totals": {
"paths": {
"/": 11
},
"browsers": {
"chrome": 10,
"firefox": 1
},
"os": {
"macos": 3,
"windows": 2,
"linux": 2,
"android": 4
},
"ref": {
"https://google.com/": 8
},
"refGrouped": {
"google.com": 8
},
"noRef": 0,
"country": {
"BE": 3,
"RU": 1,
"US": 4,
"ZA": 1,
"TR": 2
},
"utm": {},
"platformType": {
"desktop": 7,
"mobile": 4
},
"visits": 11
},
"uniqueTotals": {
"paths": {
"/": 11
},
"browsers": {
"chrome": 10,
"firefox": 1
},
"os": {
"macos": 3,
"windows": 2,
"linux": 2,
"android": 4
},
"ref": {
"https://google.com/": 8
},
"refGrouped": {
"google.com": 8
},
"noRef": 0,
"country": {
"BE": 3,
"RU": 1,
"US": 4,
"ZA": 1,
"TR": 2
},
"utm": {},
"platformType": {
"desktop": 7,
"mobile": 4
},
"visits": 11
},
"countryInfo": {
"unrecognized": {
"coordinates": [
0,
0
],
"name": "Unrecognized"
},
"BE": {
"coordinates": [
50.83333333,
4
],
"name": "Belgium"
},
"RU": {
"coordinates": [
60,
100
],
"name": "Russia"
},
"US": {
"coordinates": [
38,
-97
],
"name": "United States"
},
"ZA": {
"coordinates": [
-29,
24
],
"name": "South Africa"
},
"TR": {
"coordinates": [
39,
35
],
"name": "Turkey"
}
},
"meta": {
"from": "2020-01-18T23:00:00.000Z",
"to": "2020-02-02T22:59:59.999Z"
}
}