Introduction

The Publytics API gives read-only access to the same data you see in the dashboard. Every endpoint is a GET request to https://publytics.net/api and answers in JSON: you find them all in the endpoint list.

Data can be read only for sites whose subscription is active and not in overage.

Authentication

The API uses Bearer Token authentication. To create a token, click on your user icon in the top right corner, select "API" and click on the "Create" button. Remember to save the token somewhere safe, as it will not be displayed again.

Send the token in the Authorization header of every request:

Authorization: Bearer {token}

A token has the same permissions as your user: it reads only the sites, custom views and networks you can access, and only the report sections you are allowed to see.

Site identifier

Every endpoint except /sites reads a single site, whose identifier {siteId} goes in the path. It can be:

  • a site: its unique tracking ID, which you find in the "Tracking Options" page (e.g.: example.com/EXMPL1)
  • a custom view of a site: {trackingId}@{viewId} (e.g.: EXMPL1@12)
  • a network: network={networkId} (e.g.: network=3)

GET /sites lists all the identifiers your token can read.

Limits

Every plan includes a number of API / MCP calls per hour (100 on Lite, 1,000 on Business, 10,000 on Enterprise), charged to the owner of the site or network you read. When they are used up the API answers 429 Too Many Requests until the next hour, with a Retry-After header. You can follow the usage in the Plan management page. GET /sites is not charged.

In addition, every user can make up to 30 calls per minute, GET /sites included. Beyond that the API answers 429 Too Many Requests, with a Retry-After header telling how many seconds to wait.

Errors

When a request fails, the JSON body explains why.

Status Meaning
400 The dimension in the path is not supported (e.g. /visitors/city)
403 The site has no active subscription or is in overage, its plan does not include API calls, or a parameter is above its maximum (limit, realtimeRange) or not allowed (realtimeMetric)
404 The site, custom view or network does not exist, or you cannot access it
429 Too many calls: see Limits
500 The request could not be completed: the token is missing or not valid, your user cannot see the report section of the endpoint, or a parameter is malformed (e.g. a filter, or a sortOrder other than asc and desc)

Example API Call

curl 'https://publytics.net/api/site/{siteId}/visitors/hostname' \
  --header 'Authorization: Bearer {token}'