Rename site domain REST API
PUT
/api/sites/{id}/domain
const url = 'https://hitkeep.com/api/sites/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/domain';const options = { method: 'PUT', headers: {cookie: 'hk_token=<hk_token>', 'Content-Type': 'application/json'}, body: '{"domain":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://hitkeep.com/api/sites/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/domain \ --header 'Content-Type: application/json' \ --cookie hk_token=<hk_token> \ --data '{ "domain": "example" }'Renames the tracked domain of a site while keeping its analytics history. Requires site.manage_data (site admin or higher). The tracker only matches hits for the new domain after the rename.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”id
required
string format: uuid
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
domain
required
New apex domain without protocol or www prefix (e.g. example.com).
string
Examplegenerated
{ "domain": "example"}Responses
Section titled “Responses”Renamed site
Media typeapplication/json
object
created_at
string format: date-time
data_retention_days
integer
domain
string
id
string format: uuid
user_id
string format: uuid
Examplegenerated
{ "created_at": "2026-04-15T12:00:00Z", "data_retention_days": 1, "domain": "example", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "user_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Invalid domain
Media typeapplication/json
object
message
string
Examplegenerated
{ "message": "example"}Site not found
Media typeapplication/json
object
message
string
Examplegenerated
{ "message": "example"}Domain already in use by another site
Media typeapplication/json
object
message
string
Examplegenerated
{ "message": "example"}