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
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.
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
Tracker script configuration settings to update. Only the fields you provide will be updated; other fields will retain their current values. Show Tracker Script Configuration Fields
tracker_script_configuration.installation_type
The installation method used. Valid values: manual, wordpress, or null.
tracker_script_configuration.track_404_pages
Enable tracking of 404 error pages.
tracker_script_configuration.hash_based_routing
Enable hash-based routing for single-page applications.
tracker_script_configuration.outbound_links
Enable automatic tracking of outbound link clicks.
tracker_script_configuration.file_downloads
Enable automatic tracking of file downloads.
tracker_script_configuration.revenue_tracking
Enable revenue tracking for goals.
tracker_script_configuration.tagged_events
Enable CSS class-based event tracking.
tracker_script_configuration.form_submissions
Enable automatic tracking of form submissions.
tracker_script_configuration.pageview_props
Enable custom properties on pageviews.
Response
The domain of the site (updated if changed).
The timezone of the site.
List of allowed custom event properties for the site.
tracker_script_configuration
The complete tracker script configuration after the update. Show Configuration Fields
tracker_script_configuration.id
The unique identifier for this configuration.
tracker_script_configuration.installation_type
The installation method.
tracker_script_configuration.track_404_pages
Whether 404 tracking is enabled.
tracker_script_configuration.hash_based_routing
Whether hash-based routing is enabled.
tracker_script_configuration.outbound_links
Whether outbound link tracking is enabled.
tracker_script_configuration.file_downloads
Whether file download tracking is enabled.
tracker_script_configuration.revenue_tracking
Whether revenue tracking is enabled.
tracker_script_configuration.tagged_events
Whether CSS class-based event tracking is enabled.
tracker_script_configuration.form_submissions
Whether form submission tracking is enabled.
tracker_script_configuration.pageview_props
Whether pageview properties are enabled.
Change Domain
Update Tracker Configuration
Change Domain and Update Tracker
200 Response
400 Error - No Changes
400 Error - Same Domain
400 Error - Invalid Configuration
404 Error - Site Not Found
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