Skip to main content

PUT /api/v1/sites/:site_id

Updates a site’s domain and/or tracker script configuration. You can change the domain, update tracker settings, or both in a single request. Requires the sites:provision:* API scope and at least editor-level access to the site.
This endpoint is only available with a subscription that includes the Sites API feature.

Authentication

Requires a valid API key with the sites:provision:* scope passed in the Authorization header.

Path Parameters

site_id
string
required
The domain of the site to update. Can be the current domain or the previous domain if it was changed.Examples: example.com, blog.example.com

Request Body

At least one of domain or tracker_script_configuration must be provided.
domain
string
The new domain for the site. Must be different from the current domain.The domain will be automatically normalized (lowercased, stripped of protocol/www prefix).
Domain changes are tracked - the old domain is stored in domain_changed_from and you can still access the site using the old domain.
tracker_script_configuration
object
Tracker script configuration settings to update. Only the fields you provide will be updated; other fields will retain their current values.

Response

domain
string
The domain of the site (updated if changed).
timezone
string
The timezone of the site.
custom_properties
array
List of allowed custom event properties for the site.
tracker_script_configuration
object
The complete tracker script configuration after the update.
curl -X PUT https://plausible.io/api/v1/sites/example.com \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "domain": "new-example.com"
  }'

Notes

  • Domain changes and tracker configuration updates are performed as a transaction - if one fails, both are rolled back
  • You must have at least editor-level access to update a site (owner, admin, or editor role)
  • When updating tracker configuration, only the fields you specify are changed - all other fields keep their existing values
  • Consolidated views cannot be updated via this API
  • The old domain is preserved in the database and can still be used to access the site after a domain change

Build docs developers (and LLMs) love