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, and the dimensions and metrics they accept in Dimensions and metrics.

On Business and Enterprise plans, owners and managers can also create and delete sites with the Sites provisioning API, which needs a token with the Sites provisioning permission.

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, or a dimension that is not in the audience dataset in /acquisition/{dimension})
401 The token is missing or not valid
403 Your role on the site does not include the report section the endpoint needs (GET /site/{siteId}/meta lists the sections you can read); 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; or the endpoint does not exist
422 The query is too large: more than 100 conditions in dimensionsFilters, 50 in metricsFilters or 10 dimensions; or too heavy to complete (shorten the period, or group by fewer dimensions)
429 Too many calls: see Limits
500 The request could not be completed: a parameter is malformed (e.g. a filter with a joining word at the wrong level or an unknown dimension, or a sortOrder other than asc and desc)

Example API Call

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