> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pureclarity.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Server-side personalization request

> Submit tracking events and retrieve personalized zone content from the server side.
This endpoint combines event tracking with zone content retrieval in a single request,
making it suitable for server-side rendered applications.

Visitor and session IDs should be persisted as cookies on the end user's browser:
- `pc_v_{access_key}` for the visitor ID
- `pc_sessid_{access_key}` for the session ID




## OpenAPI

````yaml /integrations/custom/api-reference/openapi.yaml post /api/serverside
openapi: 3.0.3
info:
  title: PureClarity Capture API
  description: >
    The PureClarity Capture API provides endpoints for server-side integration
    with the PureClarity

    personalization platform. Use these endpoints to submit tracking events,
    retrieve personalized

    recommendations, manage product data feeds, and handle GDPR compliance.


    ## Authentication


    All endpoints require your **Access Key** (`appKey` / `appId` / `AccessKey`)
    to identify your store.

    Server-side endpoints also require a **Secret Key** (`secretKey` /
    `SecretKey`) for authentication.


    You can find both keys in the PureClarity Admin console under **My Account >
    Integrations**.


    <Warning>Never expose your Secret Key in client-side code or public
    repositories.</Warning>


    ## Regional Endpoints


    PureClarity operates in two regions. Use the base URL for the region your
    account is provisioned in:


    | Region | Base URL |

    |--------|----------|

    | EU (Ireland) | `https://api-eu-w-1.pureclarity.net` |

    | US (Virginia) | `https://api-us-e-1.pureclarity.net` |


    For data feed operations via SFTP streaming, use the SFTP regional endpoints
    on port 443:


    | Region | SFTP Base URL |

    |--------|---------------|

    | EU (Ireland) | `https://sftp-eu-w-1.pureclarity.net` |

    | US (Virginia) | `https://sftp-us-e-1.pureclarity.net` |
  version: 1.0.0
  contact:
    name: PureClarity Support
    email: support@pureclarity.com
    url: https://pureclarity.com
  license:
    name: Proprietary
servers:
  - url: https://api-eu-w-1.pureclarity.net
    description: EU Region (Ireland)
  - url: https://api-us-e-1.pureclarity.net
    description: US Region (Virginia)
security: []
tags:
  - name: Server-side
    description: Server-side personalization and event tracking
  - name: Data Feeds
    description: Product, category, brand, and user data feed management
  - name: GDPR
    description: GDPR compliance endpoints for user data management
paths:
  /api/serverside:
    post:
      tags:
        - Server-side
      summary: Server-side personalization request
      description: >
        Submit tracking events and retrieve personalized zone content from the
        server side.

        This endpoint combines event tracking with zone content retrieval in a
        single request,

        making it suitable for server-side rendered applications.


        Visitor and session IDs should be persisted as cookies on the end user's
        browser:

        - `pc_v_{access_key}` for the visitor ID

        - `pc_sessid_{access_key}` for the session ID
      operationId: serverSideRequest
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ServerSideRequest'
            example:
              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
      responses:
        '200':
          description: Successful response with personalized zone content
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerSideResponse'
              example:
                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
        '400':
          description: Validation error (e.g. missing required fields)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Invalid or unrecognised access key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ServerSideRequest:
      type: object
      required:
        - appId
        - secretKey
        - currentUrl
        - userAgent
        - ip
      properties:
        appId:
          type: string
          description: Your store's unique access key
        secretKey:
          type: string
          description: Your store's secret key for server-side authentication
        currentUrl:
          type: string
          format: uri
          description: The full URL of the page being rendered
        userAgent:
          type: string
          description: The end user's browser user agent string
        ip:
          type: string
          description: The end user's IP address
        visitorId:
          type: string
          description: >-
            Persistent visitor identifier. If omitted, a new one is generated
            and returned in the response.
        sessionId:
          type: string
          description: >-
            Session identifier. If omitted, a new one is generated and returned
            in the response.
        referer:
          type: string
          description: The HTTP referer header value from the end user's request
        currency:
          type: string
          description: ISO 4217 currency code (e.g. GBP, USD, EUR)
          example: GBP
        events:
          type: array
          description: Array of tracking events to record
          items:
            $ref: '#/components/schemas/TrackingEvent'
        zones:
          type: array
          description: Array of zone IDs to retrieve personalized content for
          items:
            type: string
          example:
            - HP-01
            - PP-01
    ServerSideResponse:
      type: object
      properties:
        visitorId:
          type: string
          description: >
            Visitor identifier. Store as a persistent cookie named
            `pc_v_{access_key}`

            on the end user's browser.
        sessionId:
          type: string
          description: >
            Session identifier. Store as a session cookie named
            `pc_sessid_{access_key}`

            on the end user's browser.
        errors:
          type: array
          description: Array of error messages, if any
          items:
            type: string
        zones:
          type: object
          description: >
            Map of zone IDs to their personalized content. Each zone contains

            content based on the zone type configured in the PureClarity
            dashboard.
          additionalProperties:
            $ref: '#/components/schemas/ZoneContent'
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          description: Array of error messages
          items:
            type: string
    TrackingEvent:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: |
            The event type name. Supported event types:
            - `page_view` - Page view tracking
            - `product_view` - Product page view
            - `product_rate` - Product rating
            - `set_basket` - Update basket contents
            - `order` - Order completion
            - `customer_details` - Customer identification
          enum:
            - page_view
            - product_view
            - product_rate
            - set_basket
            - order
            - customer_details
        data:
          description: Event-specific data. Structure varies by event type.
          oneOf:
            - $ref: '#/components/schemas/PageViewEvent'
            - $ref: '#/components/schemas/ProductViewEvent'
            - $ref: '#/components/schemas/ProductRateEvent'
            - $ref: '#/components/schemas/SetBasketEvent'
            - $ref: '#/components/schemas/OrderEvent'
            - $ref: '#/components/schemas/CustomerDetailsEvent'
    ZoneContent:
      type: object
      description: Personalized content for a single zone
      properties:
        title:
          type: string
          description: Display title for the zone
        type:
          type: string
          description: The content type of the zone
          enum:
            - recommender-product
            - recommender-category
            - recommender-brand
            - image-carousel
            - image
            - html
        items:
          type: array
          description: Array of items for recommender zones
          items:
            $ref: '#/components/schemas/ProductRecommenderItem'
        html:
          type: string
          description: Pre-rendered HTML content (for html zone type)
    PageViewEvent:
      type: object
      description: Data for a `page_view` event
      required:
        - page_type
      properties:
        page_type:
          type: string
          description: The type of page being viewed
          enum:
            - homepage
            - search_results
            - category_listing_page
            - product_page
            - basket_page
            - order_complete_page
            - other
        product_id:
          type: string
          description: Product ID when on a product page
        category_id:
          type: string
          description: Category ID when on a category listing page
        brand_id:
          type: string
          description: Brand ID when on a brand page
    ProductViewEvent:
      type: object
      description: Data for a `product_view` event
      required:
        - id
      properties:
        id:
          type: string
          description: The unique product ID
    ProductRateEvent:
      type: object
      description: Data for a `product_rate` event
      required:
        - id
        - rating
      properties:
        id:
          type: string
          description: The unique product ID
        rating:
          type: number
          description: The rating value
    SetBasketEvent:
      type: object
      description: |
        Data for a `set_basket` event. Pass the `items` property containing the
        full current basket contents. Send an empty array to clear the basket.
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/BasketItem'
    OrderEvent:
      type: object
      description: |
        Data for an `order` event. At least one customer identifier
        (`userid`, `email`, or `accid`) is required.
      required:
        - orderid
        - items
      properties:
        orderid:
          type: string
          description: Unique order identifier. Each order ID should only be sent once.
        ordertotal:
          type: number
          description: Total order value in base currency
        userid:
          type: string
          description: Unique user identifier
        email:
          type: string
          format: email
          description: Customer email address
        accid:
          type: string
          description: B2B account identifier
        groupid:
          type: string
          description: User group for price banding
        title:
          type: string
          description: Customer title (e.g. Mr, Mrs)
        firstname:
          type: string
          description: Customer first name
        lastname:
          type: string
          description: Customer last name
        zipcode:
          type: string
          description: Delivery zip/postal code
        postcode:
          type: string
          description: Delivery postal code (alias for zipcode)
        dob:
          type: string
          description: Date of birth in YYYY-MM-DD format
          example: '1990-01-15'
        items:
          type: array
          description: Order line items
          items:
            $ref: '#/components/schemas/BasketItem'
    CustomerDetailsEvent:
      type: object
      description: |
        Data for a `customer_details` event. At least one identifier
        (`userid`, `email`, or `accid`) is required.
      properties:
        userid:
          type: string
          description: Unique user identifier
        email:
          type: string
          format: email
          description: Customer email address
        accid:
          type: string
          description: B2B account identifier
        firstname:
          type: string
          description: Customer first name
        lastname:
          type: string
          description: Customer last name
        title:
          type: string
          description: Customer title (e.g. Mr, Mrs)
        group_id:
          type: string
          description: User group identifier
    ProductRecommenderItem:
      type: object
      description: A product item returned in a recommender zone
      properties:
        Id:
          type: string
          description: Product ID
        Sku:
          type: string
          description: Product SKU
        Title:
          type: string
          description: Product title
        Description:
          type: string
          description: Product description
        Link:
          type: string
          description: Product page URL
        Image:
          type: string
          description: Product image URL
        ImageOverlay:
          type: string
          description: Overlay image URL
        AllImages:
          type: array
          description: All product images
          items:
            type: string
        Price:
          type: number
          description: Current price
        WasPrice:
          type: number
          description: Original price before discount
        SavingPrice:
          type: number
          description: Amount saved
        DisplayPrice:
          type: string
          description: Formatted display price with currency symbol
        DisplayWasPrice:
          type: string
          description: Formatted original price
        SavingDisplayPrice:
          type: string
          description: Formatted saving amount
        CurrencySymbol:
          type: string
          description: Currency symbol
        SavingPercent:
          type: string
          description: Percentage saving
        Categories:
          type: array
          description: Product category IDs
          items:
            type: string
        Brand:
          type: object
          description: Brand information
        SearchTags:
          type: array
          description: Product search tags
          items:
            type: string
        OnOffer:
          type: boolean
          description: Whether the product is on offer
        NewArrival:
          type: boolean
          description: Whether the product is a new arrival
    BasketItem:
      type: object
      required:
        - id
        - qty
        - unitprice
      properties:
        id:
          type: string
          description: Product ID
        qty:
          type: number
          description: Quantity in the basket
        unitprice:
          type: number
          description: Unit price (use `.` as decimal separator)

````