Events
Send server-side events for anything the browser cannot see: OAuth callbacks, payment webhooks, queue workers.
| Endpoint | Method | Path | Permission |
|---|---|---|---|
| Send events Send server-side events | POST | /v1/events | events:write |
Base URL https://app.sourceloop.ai/api/v1
Send events
Send server-side events
POST /v1/events
Requires events:write
For anything the browser cannot see: OAuth callbacks, payment webhooks, queue workers. Events are validated and classified with exactly the same rules the browser tracker applies, so a server-side conversion attributes identically.
Each event needs an email, a phone, or an `anonymous_id` to be attributable. Read `_sl_aid` from the visitor's cookie and pass it as `anonymous_id` to stitch a backend event to their browsing history.
Partial success: one malformed event does not discard the batch.
curl -s -X POST "https://app.sourceloop.ai/api/v1/events" \
-H "Authorization: Bearer $SOURCELOOP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"events": [
{
"event_type": "custom",
"event_name": "signup_completed",
"email": "[email protected]",
"anonymous_id": "a1b2c3"
}
]
}' const res = await fetch(
"https://app.sourceloop.ai/api/v1/events",
{
method: "POST",
headers: {
Authorization: `Bearer ${process.env.SOURCELOOP_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"events": [
{
"event_type": "custom",
"event_name": "signup_completed",
"email": "[email protected]",
"anonymous_id": "a1b2c3"
}
]
}),
},
);
const data = await res.json(); import os, requests
res = requests.post(
"https://app.sourceloop.ai/api/v1/events",
headers={"Authorization": f"Bearer {os.environ['SOURCELOOP_API_KEY']}"},
json={
"events": [
{
"event_type": "custom",
"event_name": "signup_completed",
"email": "[email protected]",
"anonymous_id": "a1b2c3"
}
]
},
)
data = res.json() Headers
Idempotency-Keystringheader
Request body
websitestringeventsobject[]required
Event
events[].event_typestringExample
customevents[].event_namestringExample
signup_completedevents[].occurred_atstring (date-time)
Identity
events[].emailstringevents[].phonestringevents[].anonymous_idstringThe visitor's _sl_aid cookie value.
Value
events[].revenuenumberevents[].currencystringevents[].propertiesobject
Responses
-
200Accepted and rejected counts -
400Something was wrong with the request or the credential. -
429Too many requests for this workspace in the current minute. Wait Retry-After seconds and repeat the request unchanged.