Skip to content

SDK Endpoints

These endpoints are called by the Ttoolab pixel in the browser. They are the public HTTP interface for experimentation and event collection.

Base URL: https://sdk.ttoolab.com


Fetches experiment assignments, variant changes, surveys, and integration settings for the current page.

| Parameter | Required | Description | | :-------- | :------- | :---------- | | projectKey | Yes | Your project’s public key | | anonymousId | Yes | Visitor anonymous ID (UUID format) | | url | No | Current page URL (used for URL rule matching) |

Terminal window
curl "https://sdk.ttoolab.com/sdk/bootstrap?projectKey=PROJECT_KEY&anonymousId=550e8400-e29b-41d4-a716-446655440000&url=https%3A%2F%2Fexample.com%2Fpricing"
{
"projectKey": "PROJECT_KEY",
"anonymousId": "550e8400-e29b-41d4-a716-446655440000",
"version": "2025-06-09T12:00:00.000Z",
"fetchedAt": "2025-06-09T12:00:01.000Z",
"hasActiveExperiments": true,
"assignments": [
{
"experimentKey": "hero-cta-test",
"experimentId": "hero-cta-test",
"experimentName": "Hero CTA Test",
"variantKey": "variant-b",
"variantId": "variant-b",
"variantName": "Variant B",
"isControl": false
}
],
"experiments": [
{
"experimentKey": "hero-cta-test",
"experimentId": "hero-cta-test",
"status": "running",
"variant": {
"key": "variant-b",
"changes": [
{
"selector": "#hero-cta",
"operation": "set_text",
"value": "Get started free",
"orderIndex": 0
}
]
},
"goals": []
}
],
"integrations": {
"googleAnalytics": {
"enabled": true,
"gtmEventsEnabled": true
},
"clarity": {
"enabled": false
}
}
}
  • Returns an empty blob when no experiments match the URL.
  • Response is not cached (Cache-Control: private, no-store).

Records an exposure or custom conversion event.

| Field | Type | Required | Description | | :---- | :--- | :------- | :---------- | | projectKey | string | Yes | Project public key | | anonymousId | string | Yes | Visitor anonymous ID | | eventName | string | Yes | Event name (e.g. $exposure, purchase) | | payload | object | No | Custom event properties | | url | string | No | Current page URL | | referrer | string | No | Document referrer | | userAgent | string | No | Browser user agent | | assignments | array | Yes | Active experiment assignments | | createdAt | string | No | ISO 8601 timestamp |

Terminal window
curl -X POST "https://sdk.ttoolab.com/sdk/event" \
-H "Content-Type: application/json" \
-d '{
"projectKey": "PROJECT_KEY",
"anonymousId": "550e8400-e29b-41d4-a716-446655440000",
"eventName": "purchase",
"payload": { "revenue": 99.90, "order_id": "ORD-12345" },
"url": "https://example.com/checkout/success",
"referrer": "https://example.com/checkout",
"userAgent": "Mozilla/5.0",
"assignments": [
{
"experimentKey": "hero-cta-test",
"experimentId": "hero-cta-test",
"variantKey": "variant-b",
"variantId": "variant-b",
"isControl": false
}
],
"createdAt": "2025-06-09T12:00:05.000Z"
}'
{ "success": true }

Records CES survey lifecycle events and responses.

  • shown
  • accepted
  • dismissed
  • completed

Loads a survey preview configuration for dashboard preview mode. Requires a preview token query parameter.


Health check endpoint.

{
"ok": true,
"service": "ttoolab-worker",
"kv": true
}

| Asset | URL | | :---- | :— | | Minified SDK | https://sdk.ttoolab.com/ttoolab.min.js | | Full SDK | https://sdk.ttoolab.com/ttoolab.js |

Load with optional project key:

<script async src="https://sdk.ttoolab.com/ttoolab.min.js?project=PROJECT_KEY"></script>

See Errors for HTTP status codes and error messages.