Integration

REST API

Server-side API endpoints for Commerce Index integration.

Base URLs

Production
https://commerceindex.com/api
Staging
https://api.staging.commerceindex.com

Authentication

Include your API key in the request headers:

X-CI-Api-Key: your_api_key_here
Content-Type: application/json

Endpoints

POST
/api/collect/product-view

Track a product page view. Use this for server-side tracking.

Auth: X-CI-Api-Key header (optional)

{
  "brand_id": "brand_xyz",
  "product": {
    "product_id": "prod_123",
    "sku": "SKU-123",
    "title": "Product Name",
    "url": "https://brand.com/products/..."
  },
  "context": {
    "timestamp": "2025-12-22T15:30:00Z",
    "session_id": "sess_abc123",
    "country": "US",
    "locale": "en-US"
  }
}
POST
/api/collect/product-purchase

Track a completed purchase. Use this for server-side tracking.

Auth: X-CI-Api-Key header (optional)

{
  "brand_id": "brand_xyz",
  "order": {
    "order_id": "order_789",
    "currency": "USD",
    "total_value": 129.97,
    "items": [
      {
        "product_id": "prod_123",
        "sku": "SKU-123",
        "title": "Product Name",
        "quantity": 2,
        "unit_price": 39.99
      }
    ]
  },
  "context": {
    "timestamp": "2025-12-22T15:31:00Z",
    "session_id": "sess_abc123"
  }
}
GET
/api/ci/product-proof

Retrieve social proof data for a specific product.

Auth: X-CI-Api-Key header (optional)

Query Parameters

brand_idstring
Required
Your brand identifier
product_idstring
Required
The product identifier
window_viewsintegerMinutes for view count (default: 60)
window_purchasesintegerHours for purchase count (default: 24)
GET /api/ci/product-proof?brand_id=brand_xyz&product_id=prod_123&window_views=60&window_purchases=24

Error Codes

200Success - event accepted or data returned
400Bad Request - validation error in request body
401Unauthorized - invalid or missing API key
404Not Found - brand or product not found
500Server Error - internal error, retry later