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.
Base URLs
Section titled “Base URLs”| Purpose | Base URL |
|---|---|
| Proxy | https://ssp.yourshop.com |
| Management | https://ssp.sweetcode.cloud |
Authentication
Section titled “Authentication”Management API endpoints require a session token passed via the sc_session cookie. Sessions are created through the magic link login flow.
Proxy Endpoints
Section titled “Proxy Endpoints”POST /v1/events
Section titled “POST /v1/events”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:
| Code | HTTP | Description |
|---|---|---|
domain_not_configured | 404 | No domain config found for hostname |
subscription_inactive | 403 | Plan expired or suspended |
request_limit_exceeded | 429 | Monthly request quota exhausted |
rate_limited | 429 | Too many requests per minute |
invalid_payload | 400 | Body exceeds 100KB or is malformed |
GET /health
Section titled “GET /health”Health check endpoint. Returns 200 OK with:
{ "status": "ok"}Management API
Section titled “Management API”Management endpoints are prefixed with /v1/ on the management base URL.
Authentication
Section titled “Authentication”POST /v1/auth/login— request a magic linkGET /v1/auth/verify— verify magic link tokenPOST /v1/auth/logout— invalidate session
Domains
Section titled “Domains”GET /v1/domains— list domains for current orgPOST /v1/domains— add a new domainGET /v1/domains/:id— get domain detailsPUT /v1/domains/:id— update domain configDELETE /v1/domains/:id— remove a domain
Organizations
Section titled “Organizations”GET /v1/orgs— list user’s organizationsPOST /v1/orgs— create a new organizationPUT /v1/orgs/:id— update organization settings
Rate Limits
Section titled “Rate Limits”| Endpoint | Limit |
|---|---|
| Proxy events | 120 req/IP/minute |
| Login | 5 req/email/hour |
| Management API | 60 req/session/min |
Exceeding a rate limit returns HTTP 429 with a rate_limited error code.