Sites provisioning API

The sites provisioning API lets owners and managers add sites to a subscription and delete them from their own code: for example, to set up Publytics automatically when you launch a new website or onboard a new client. It follows the same rules as the "Add website" and "Site options" pages:

  • an owner creates, reads and deletes the sites of their own subscription;
  • a manager creates and reads the sites of the subscriptions they manage. Only the owner can delete a site.

The sites provisioning API is included in the Business and Enterprise plans. It works on the subscriptions whose plan includes it: a manager can provision sites for a Business owner even with a Lite plan of their own, and not the other way round. It is not available during the free trial.

Every path starts with https://publytics.net/api and answers in JSON. Send the request body as JSON, with the Content-Type: application/json header.

Authentication

The provisioning endpoints need an API token with the Sites provisioning permission. Tokens are read-only by default: to create one that can provision sites, click on your user icon in the top right corner, select "API", check Sites provisioning and click on "Create". Tokens created without it, and the tokens of the MCP server, get 403 Forbidden.

Authorization: Bearer {token}

A provisioning token also reads data, like any other token: see the API introduction.

The provisioning calls are not charged to the API / MCP calls per hour of the plan, but they count towards the 30 calls per minute of your user.

List subscriptions

GET /subscriptions

Lists your own subscription and the ones you manage, with how many websites each can still host and its sites. Use owner_id to create a site on a subscription you manage.

Response

{
  "subscriptions": [
    {
      "owner_id": 12,
      "name": "Jane Doe",
      "yours": true,
      "status": "active",
      "websites": { "used": 3, "limit": 5 },
      "sites_provisioning": true,
      "can_add_sites": true,
      "sites": [
        { "site": "EXMPL1", "domain": "example.com", "timezone": "Europe/Rome", "owner_id": 12, "created_at": "2026-11-07T10:15:00+00:00" }
      ]
    }
  ]
}
Field Content
owner_id The owner of the subscription
yours true for your own subscription, false for one you manage
status active, trial or inactive
websites The sites on the subscription and its maximum (null during the trial and for plans without a maximum)
sites_provisioning Whether the plan of the subscription includes the sites provisioning API (Business and Enterprise). Without it, the other endpoints refuse its sites
can_add_sites Whether a new site can be added now through the API: the plan includes the sites provisioning API and is below its maximum websites
sites The sites of the subscription. site is the tracking ID, used as {siteId} in the other endpoints

Create a site

POST /sites

Parameter Description Default
domain Required. The domain of the site, e.g. example.com. A protocol, www. and a path are removed: https://www.Example.com/blog becomes example.com.
timezone The timezone of the reports, as an IANA identifier (e.g. Europe/Rome, America/New_York, UTC). It cannot be changed later from the dashboard. Europe/Rome
owner_id The subscription that will host the site: yours or one you manage. Your subscription
allow_duplicate true creates the site even if the subscription already has one with the same domain. false
curl -X POST 'https://publytics.net/api/sites' \
  --header 'Authorization: Bearer {token}' \
  --header 'Content-Type: application/json' \
  --data '{"domain": "example.com", "timezone": "Europe/Rome"}'

Response 201 Created

{
  "site": "EXMPL1",
  "domain": "example.com",
  "timezone": "Europe/Rome",
  "owner_id": 12,
  "created_at": "2026-11-07T10:15:00+00:00",
  "tracking_code": "<script defer data-domain=\"example.com/EXMPL1\" src=\"https://api.publytics.net/js/script.manual.min.js\"></script>\n<script>..."
}

Install tracking_code in the <head> of every page of the site, as described in Register and tag a website. The owner and every manager of the subscription become admins of the new site.

If the subscription already has a site with the same domain, the API answers 409 Conflict with that site in the site field, and creates nothing: a retried request never creates the same site twice. Send "allow_duplicate": true to create a second site with the same domain.

Get a site

GET /sites/{siteId}

Returns a site of a subscription you own or manage, in the same format as Create a site, tracking code included.

Delete a site

DELETE /sites/{siteId}

Deletes a site, as the "Delete site" button of the site options: it is removed from its networks, and its team permissions, pending transfers, custom alerts and scheduled emails are deleted. Only the owner of the subscription can delete a site.

curl -X DELETE 'https://publytics.net/api/sites/EXMPL1' \
  --header 'Authorization: Bearer {token}'

Response

{ "deleted": true }

Errors

Status Meaning
401 The token is missing or not valid
403 The token does not have the Sites provisioning permission; the subscription is not yours and you do not manage it; its plan does not include the sites provisioning API (Lite, trial or inactive subscription); it has reached its maximum websites; or a manager tried to delete a site
404 The site does not exist, or it is not on a subscription you own or manage
409 The subscription already has a site with this domain (see Create a site)
422 The domain or the timezone is missing or not valid
429 Too many calls per minute