Skip to content

API Overview

The SweetCode Cloud API is served from your configured proxy subdomain (e.g. ssp.yourshop.com) 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.

Submit tracking events for processing and forwarding to configured destinations.

Request Body:

{
"event_name": "purchase",
"event_data": {
"currency": "USD",
"value": 49.99,
"transaction_id": "T-12345",
"items": [
{
"item_id": "SKU-001",
"item_name": "Widget",
"quantity": 1,
"price": 49.99
}
]
},
"user_data": {
"client_id": "GA1.1.123456789.1234567890"
}
}

Response:

{
"success": true,
"event_id": "evt_abc123",
"destinations": ["ga4", "meta"]
}

Error Codes:

CodeHTTPDescription
domain_not_configured404No domain config found for hostname
subscription_inactive403Plan expired or suspended
request_limit_exceeded429Monthly request quota exhausted
rate_limited429Too many requests per minute
invalid_payload400Body exceeds 100KB or is malformed

Health check endpoint. Returns 200 OK with:

{
"status": "ok"
}

Management endpoints are prefixed with /v1/ on the management base URL.

  • POST /v1/auth/login — request a magic link
  • GET /v1/auth/verify — verify magic link token
  • POST /v1/auth/logout — invalidate session
  • GET /v1/domains — list domains for current org
  • POST /v1/domains — add a new domain
  • GET /v1/domains/:id — get domain details
  • PUT /v1/domains/:id — update domain config
  • DELETE /v1/domains/:id — remove a domain
  • GET /v1/orgs — list user’s organizations
  • POST /v1/orgs — create a new organization
  • PUT /v1/orgs/:id — update organization settings
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.