Skip to content

API Overview

The SweetCode Cloud API is served from your configured proxy subdomain (e.g. ssp.yourshop.com) for proxy operations, and from ssp.sweetcode.cloud for management operations.

PurposeBase URL
Proxyhttps://ssp.yourshop.com
Managementhttps://ssp.sweetcode.cloud

Management API endpoints require a session token passed via the sc_session cookie. Sessions are created through the magic-link login flow.

The proxy endpoint (/v1/events) uses a different authentication mechanism — a per-domain verification token passed via the X-SSP-Token header. This token is generated automatically by Pixel Manager for WooCommerce.

Submit tracking events for processing and forwarding to configured destinations. This is the primary endpoint used by Pixel Manager for WooCommerce.

Headers:

HeaderRequiredDescription
X-SSP-TokenYesHMAC verification token for the domain
Content-TypeYesMust be application/json

Request Body:

{
"events": [
{
"eventName": "Purchase",
"eventTime": 1700000000,
"eventSourceUrl": "https://yourshop.com/checkout/order-received/123/",
"userData": {
"email": "customer@example.com",
"ipAddress": "203.0.113.42",
"userAgent": "Mozilla/5.0...",
"fbc": "fb.1.1700000000.AbCdEf",
"fbp": "fb.1.1700000000.1234567890"
},
"customData": {
"currency": "USD",
"value": 49.99,
"orderId": "T-12345",
"contents": [
{
"id": "SKU-001",
"name": "Widget",
"quantity": 1,
"price": 49.99
}
],
"numItems": 1
}
}
]
}

Supported Event Types:

Event NameDescription
PageVisitPage view (home, category, product, etc.)
ViewContentProduct or content page view
SearchSearch query on the store
AddToCartItem added to shopping cart
AddToWishlistItem added to wishlist
PurchaseCompleted purchase / order
LeadLead form submission
SignUpAccount registration
CustomCustom event (passed through as-is)

Response (success):

{
"success": true
}

Error Codes:

CodeHTTPDescription
domain_not_configured404No domain config found for the hostname
subscription_inactive403Plan expired or suspended
request_limit_exceeded429Monthly request quota exhausted
rate_limited429Too many requests per minute from this IP
invalid_payload400Body exceeds 100 KB or fails validation

Pre-formatted event passthrough for Pixel Manager for WooCommerce. Events are forwarded to destination APIs as-is — the Worker injects credentials but does not transform the payload. This endpoint is used internally by Pixel Manager and is not intended for direct use.

Health check endpoint. Returns 200 OK with:

{
"status": "ok"
}

Management endpoints are prefixed with /v1/ on the management base URL (ssp.sweetcode.cloud). All management endpoints require an authenticated session.

MethodEndpointDescription
POST/v1/auth/loginRequest a magic link email
GET/v1/auth/callbackVerify magic link token
POST/v1/auth/logoutInvalidate session
GET/v1/auth/meGet current user info
MethodEndpointDescription
GET/v1/orgsList user’s organizations
POST/v1/orgsCreate a new organization
GET/v1/org/settingsGet org details + subscription
PATCH/v1/org/settingsUpdate org name
GET/v1/org/membersList members with roles
POST/v1/org/members/inviteInvite a member by email
GET/v1/org/usageCurrent billing period usage
GET/v1/org/subscriptionSubscription details
GET/v1/org/daily-usageDaily usage breakdown (charts)
GET/v1/org/eventsQuery event logs (filtered)
MethodEndpointDescription
GET/v1/domainsList domains for current org
POST/v1/domainsAdd a new domain
GET/v1/domains/:idGet domain details
POST/v1/domains/:id/verifyVerify DNS configuration
POST/v1/domains/:id/regenerate-tokenRegenerate sync token
POST/v1/domains/:id/resyncTrigger config resync
DELETE/v1/domains/:idRemove a domain

Sync (used by Pixel Manager for WooCommerce)

Section titled “Sync (used by Pixel Manager for WooCommerce)”
MethodEndpointDescription
POST/v1/sync/register-callbackRegister WooCommerce callback URL
POST/v1/sync/domain-configPush destination configuration
EndpointLimit
Proxy events120 req/IP/minute
Login5 req/email/hour
Management API60 req/session/min

Exceeding a rate limit returns HTTP 429 with a rate_limited error code.