Skip to main content
POST
/
api
/
serverside
Server-side personalization request
curl --request POST \
  --url https://api-eu-w-1.pureclarity.net/api/serverside \
  --header 'Content-Type: application/json' \
  --data '
{
  "appId": "your-access-key",
  "secretKey": "your-secret-key",
  "currentUrl": "https://www.example.com/products/shoes",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64)",
  "ip": "203.0.113.50",
  "currency": "GBP",
  "events": [
    {
      "name": "page_view",
      "data": {
        "page_type": "product_page"
      }
    },
    {
      "name": "product_view",
      "data": {
        "id": "PROD-001"
      }
    }
  ],
  "zones": [
    "HP-01",
    "PP-01"
  ]
}
'
{
  "visitorId": "abc123-visitor-id",
  "sessionId": "xyz789-session-id",
  "zones": {
    "HP-01": {
      "title": "Recommended for you",
      "type": "recommender-product",
      "items": [
        {
          "Id": "PROD-001",
          "Title": "Running Shoes",
          "Price": 59.99,
          "Link": "/products/running-shoes",
          "Image": "https://cdn.example.com/shoes.jpg"
        }
      ]
    }
  }
}

Body

application/json
appId
string
required

Your store's unique access key

secretKey
string
required

Your store's secret key for server-side authentication

currentUrl
string<uri>
required

The full URL of the page being rendered

userAgent
string
required

The end user's browser user agent string

ip
string
required

The end user's IP address

visitorId
string

Persistent visitor identifier. If omitted, a new one is generated and returned in the response.

sessionId
string

Session identifier. If omitted, a new one is generated and returned in the response.

referer
string

The HTTP referer header value from the end user's request

currency
string

ISO 4217 currency code (e.g. GBP, USD, EUR)

Example:

"GBP"

events
object[]

Array of tracking events to record

zones
string[]

Array of zone IDs to retrieve personalized content for

Example:
["HP-01", "PP-01"]

Response

Successful response with personalized zone content

visitorId
string

Visitor identifier. Store as a persistent cookie named pc_v_{access_key} on the end user's browser.

sessionId
string

Session identifier. Store as a session cookie named pc_sessid_{access_key} on the end user's browser.

errors
string[]

Array of error messages, if any

zones
object

Map of zone IDs to their personalized content. Each zone contains content based on the zone type configured in the PureClarity dashboard.