Ghost ID Docs
Product documentation
Back to Dashboard

Sites API

Use the Sites API to list the sites available to the current account and manage individual site records.

🌐 Endpoints

GET/api/sites

List all sites available to the current signed-in user.

🔑 Authentication required: Yes, via session cookie.

Example Request

Bash
curl --request GET \
  --url https://analytics.ghostid.ai/api/sites \
  --cookie "session=YOUR_SESSION_COOKIE"

Response Example

JSON
{
  "sites": [
    {
      "siteId": 4,
      "name": "Ghost ID",
      "domain": "ghostid.ai",
      "trackingMode": "third-party",
      "firstPartyDomain": "go.ghostid.ai"
    }
  ]
}
POST/api/sites

Add a new site to your Ghost ID account.

🔑 Authentication required: Yes, via session cookie.

Parameters

NameTypeRequiredDescription
domainstringYesPrimary domain to track.
namestringNoDisplay name shown in the dashboard.

Request Body

JSON
{
  "domain": "example.com",
  "name": "My Site"
}

Example Request

Bash
curl --request POST \
  --url https://analytics.ghostid.ai/api/sites \
  --cookie "session=YOUR_SESSION_COOKIE" \
  --header "Content-Type: application/json" \
  --data '{
    "domain": "example.com",
    "name": "My Site"
  }'

Response Example

JSON
{
  "site": {
    "siteId": 12,
    "name": "My Site",
    "domain": "example.com"
  }
}
PUT/api/sites/:id

Update an existing site record.

🔑 Authentication required: Yes, via session cookie.

Parameters

NameTypeRequiredDescription
idpathYesSite ID returned by Ghost ID.
namestringNoUpdated site name.
domainstringNoUpdated tracked domain.

Request Body

JSON
{
  "name": "New Name",
  "domain": "new.example.com"
}

Example Request

Bash
curl --request PUT \
  --url https://analytics.ghostid.ai/api/sites/12 \
  --cookie "session=YOUR_SESSION_COOKIE" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "New Name",
    "domain": "new.example.com"
  }'

Response Example

JSON
{
  "site": {
    "siteId": 12,
    "name": "New Name",
    "domain": "new.example.com"
  }
}
DELETE/api/sites/:id

Delete a site and remove it from your account.

🔑 Authentication required: Yes, via session cookie.

Parameters

NameTypeRequiredDescription
idpathYesSite ID to delete.

Example Request

Bash
curl --request DELETE \
  --url https://analytics.ghostid.ai/api/sites/12 \
  --cookie "session=YOUR_SESSION_COOKIE"

Response Example

JSON
{
  "success": true
}