Skip to content

API Documentation

Even though the composer client package is dedicated to Laravel, the API basically works with every client! So if you'd like to use the tool, even if you're not using Laravel, you may just trigger the API requests manually.

Authentication

In order to use the API, you should authenticate your request by including your API token as a bearer token value:

Authorization: Bearer API_TOKEN_HERE

TIP

You'll receive an API token after creating a new instance, our you can find your existing API tokens inside the app on the instance page.

Headers

Make sure you have the following content type headers are set on every request:

Accept: application/json Content-Type: application/json

URI

SimpleStats API is hosted on the following base URI:

https://simplestats.io/api/v1/

Errors

SimpleStats uses standard HTTP response codes to communicate the outcome of API requests. These codes offer immediate insight into whether a request has been successful, encountered an error, or requires additional action.

CodeDescription
200Everything is ok.
400Valid data was given but the request has failed.
401No valid API Key was given.
404The request resource could not be found.
422The payload has missing required parameters or invalid data was given.
429Too many attempts.
500Request failed due to an internal error in SimpleStats.
503SimpleStats is offline for maintenance.

Rate Limit

The rate limits for our API are 120 requests per minute by default. If you have special needs for more requests, please contact us to request more capacity.

Endpoints

At the moment, only the create endpoints are available. But if the id already exists on our side, the record gets updated with the new data.

Create Visitor

HTTP Request

POST /api/v1/stats-visitor

Core parameters:

KeyTypeDescription
timestring requiredThe time when the user has registerd.
Format: Y-m-d H:i:s P, before or equal now
ipstring nullableThe ip of the user. (does not get stored)
user_agentstring nullableThe user_agent of the user. (does not get stored)
track_refererstring nullableThe http tracking referer of the user.
track_sourcestring nullableThe tracking source of the user.
track_mediumstring nullableThe tracking medium of the user.
track_campaignstring nullableThe tracking campaign of the user.
track_termstring nullableThe tracking term of the user.
track_contentstring nullableThe tracking content of the user.
page_entrystring nullableThe tracking page_entry of the user.

Optional parameters:

KeyTypeDescription
location_countrystring nullableThe location country of the user. (If the ip is set, we take the country that refers to it.)
location_regionstring nullableThe location region of the user. (If the ip is set, we take the region that refers to it.)
location_citystring nullableThe location city of the user. (If the ip is set, we take the city that refers to it.)
device_typestring nullableThe device type of the user. (If the user_agent is set, we take the device type that refers to it.)
device_platformstring nullableThe device platform (OS) of the user. (If the user_agent is set, we take the device platform that refers to it.)
device_browserstring nullableThe device browser of the user. (If the user_agent is set, we take the device browser that refers to it.)
page_entrystring nullableThe page entry point of the user.

Payload

json
{
    "ip": "127.0.0.1",
    "user_agent": "Mozilla/5.0 (Linux; Android 13; Pixel 6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Mobile Safari/537.36",
    "track_source": "test",
    "time": "2024-04-04"
}

Response

json
{
    "message": "Request accepted."
}

Create User

HTTP Request

POST /api/v1/stats-user

Core parameters:

KeyTypeDescription
idmixed requiredThe user id.
timestring requiredThe time when the user has registerd.
Format: Y-m-d H:i:s P, before or equal now
ipstring nullableThe ip of the user. (does not get stored)
user_agentstring nullableThe user_agent of the user. (does not get stored)
track_refererstring nullableThe http tracking referer of the user.
track_sourcestring nullableThe tracking source of the user.
track_mediumstring nullableThe tracking medium of the user.
track_campaignstring nullableThe tracking campaign of the user.
track_termstring nullableThe tracking term of the user.
track_contentstring nullableThe tracking content of the user.
page_entrystring nullableThe tracking page_entry of the user.

Optional parameters:

KeyTypeDescription
location_countrystring nullableThe location country of the user. (If the ip is set, we take the country that refers to it.)
location_regionstring nullableThe location region of the user. (If the ip is set, we take the region that refers to it.)
location_citystring nullableThe location city of the user. (If the ip is set, we take the city that refers to it.)
device_typestring nullableThe device type of the user. (If the user_agent is set, we take the device type that refers to it.)
device_platformstring nullableThe device platform (OS) of the user. (If the user_agent is set, we take the device platform that refers to it.)
device_browserstring nullableThe device browser of the user. (If the user_agent is set, we take the device browser that refers to it.)
page_entrystring nullableThe page entry point of the user.

Payload

json
{
    "id": 1,
    "track_source": "test",
    "time": "2024-04-04"
}

Response

json
{
    "message": "Request accepted."
}

Create Login

HTTP Request

POST /api/v1/stats-login

Parameters

KeyTypeDescription
stats_user_idinteger requiredThe id of the user trying to login.
timestring requiredThe time when the user tries to login.
Format: Y-m-d H:i:s P, before or equal now

Payload

json
{
    "stats_user_id": 1,
    "time": "2024-04-04"
}

Response

json
{
    "message": "Request accepted."
}

Create Payment

HTTP Request

POST /api/v1/stats-payment

Parameters

KeyTypeDescription
idmixed requiredThe payment id.
stats_user_idinteger requiredThe user id associated with the payment.
timestring requiredThe time when the payment happened.
Format: Y-m-d H:i:s P, before or equal now
grossnumeric requiredThe gross amount of the payment in cents.
(e.g.: $1 = 100 Cent)
netnumeric requiredThe net amount of the payment in cents.
(e.g.: $1 = 100 Cent).
currencystring requiredThe ISO-4217 currency code of the payment.
(e.g.: EUR, USD, GBP ...)

Payload

json
{
    "id": "1",
    "stats_user_id": "1",
    "gross": 2000,
    "net": 1800,
    "currency": "EUR",
    "time": "2024-04-04"
}

Response

json
{
    "message": "Request accepted."
}