The Moat Analytics API is a simple way to programmatically retrieve your data organized by whatever metrics you want.

Customized Documentation

Please submit your token to access API documentation specific to the datasets:


The API uses token-based authentication which is passed in a header to make an authenticated request.

A Sample HTTP Request

Building an HTTP request with a token is simple. Assuming your token is abc123, you would create an Authorization header with the value Bearer abc123 like the example below to

HTTP/1.1 GET /1/stats.json
Authorization: Bearer abc123

Example Code

Here are a few examples of sending an authentication token using some common libraries and tools.

cURL from the command line

When using cURL, we are piping the output to a tool called jq which pretty prints JSON on the command line:

$ curl -s -H 'Authorization: Bearer abc123'\
  ',loads&start=2018-10-08&end=2018-10-08' | jq .
    "data_available": true,
    "results": {
        "details": [
                "level1_label": "ABC",
                "level1_id": "123",
                "loads": 1000
                "level1_label": "XYZ",
                "level1_id": "456",
                "loads": 100
        "summary": {
            "loads": 1100
    "query": {
        "end": "2018-10-08",
        "start": "2018-10-08",
        "metrics": "level1,loads"


Using GuzzleHttp library:

// Using Composer, you would include GuzzleHttp library like so:
require_once 'vendor/autoload.php';

$client = new \GuzzleHttp\Client([
    'base_uri' => ''

$query = [
    'start' => '2018-10-01',
    'end' => '2018-10-01',
    'metrics' => 'level1,loads'

$headers = [
    'Authorization' => 'Bearer abc123'

try {
    $resp = $client->get('/stats.json', ['query' => $query, 'headers' => $headers]);
} catch (\GuzzleHttp\Exception\ClientException $exception) {
    echo "Error from API: " . $exception->getMessage() . "\n";


Using urllib3 module:

import urllib3
import datetime

token = 'abc123'
auth_header = 'Bearer {}'.format(token)
yesterday = ( - datetime.timedelta(days=1)).strftime('%Y-%m-%d')
metrics = ('level1', 'loads')
query = {
    'metrics': ','.join(metrics),
    'start': yesterday,
    'end': yesterday
http = urllib3.PoolManager()
resp = http.request('GET', '',
                    headers={'Authorization': auth_header})



If you are unable to log in and you are receiving an HTTP status code of 401, that means you have provided an invalid token. Make sure that you are using the token exactly as it was provided without any additional characters except for a single space to separate the word Bearer and the actual token. Example: Authorization: Bearer abc123