curl --request POST \
--url https://api.example.com/batch \
--header 'Content-Type: <content-type>' \
--data '
{
"type": "<string>",
"payload": {}
}
'{
"status": "<string>",
"batch": true,
"processed": 123,
"batched": {},
"results": [
{}
]
}Send multiple events in a single request for improved performance
curl --request POST \
--url https://api.example.com/batch \
--header 'Content-Type: <content-type>' \
--data '
{
"type": "<string>",
"payload": {}
}
'{
"status": "<string>",
"batch": true,
"processed": 123,
"batched": {},
"results": [
{}
]
}The batch endpoint allows you to send multiple analytics events in a single HTTP request, improving performance and reducing network overhead. It supports both track events and outgoing link events.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/databuddy-analytics/Databuddy/llms.txt
Use this file to discover all available pages before exploring further.
website_id query parameter. The website must exist and be accessible.
application/json"track" for analytics eventseventId (string, optional): Unique identifier for deduplicationname (string, required): Event nameanonymousId (string, required): Anonymous user identifiersessionId (string, required): Session identifiersessionStartTime (number, required): Session start timestamp (Unix ms)timestamp (number, required): Event timestamp (Unix ms)path (string, required): Page path where event occurredtitle (string, required): Page titlereferrer (string, required): Referrer URLscreen_resolution (string, required): Screen resolution (e.g., “1920x1080”)viewport_size (string, required): Viewport size (e.g., “1440x900”)timezone (string, required): User timezonelanguage (string, required): Browser languageconnection_type (string, optional): Connection type (“wifi”, “cellular”, “ethernet”, “unknown”)rtt (number, optional): Round-trip time in millisecondsdownlink (number, optional): Download speed in Mbpsutm_source (string, optional): UTM source parameterutm_medium (string, optional): UTM medium parameterutm_campaign (string, optional): UTM campaign parameterutm_term (string, optional): UTM term parameterutm_content (string, optional): UTM content parameterload_time (number, optional): Page load time in millisecondsdom_ready_time (number, optional): DOM ready time in millisecondsttfb (number, optional): Time to first byte in millisecondstime_on_page (number, optional): Time spent on page in millisecondsscroll_depth (number, optional): Scroll depth percentage (0-100)interaction_count (number, optional): Number of interactionspage_count (number, optional): Pages viewed in session"outgoing_link" for link click trackingeventId (string, required): Unique identifieranonymousId (string, optional): Anonymous user identifiersessionId (string, optional): Session identifiertimestamp (number, optional): Event timestamp (Unix ms)href (string, required): Link URLtext (string, optional): Link text contentproperties (object, optional): Additional custom propertiessuccess or errortrue for batch requeststrack (number): Number of track events processedoutgoing_link (number): Number of outgoing link events processedstatus (string): success or error for this specific eventtype (string): Event type (track or outgoing_link)eventId (string, optional): Event ID if providedmessage (string, optional): Error message if failedcurl -X POST 'https://api.databuddy.io/batch?website_id=550e8400-e29b-41d4-a716-446655440000' \
-H "Content-Type: application/json" \
-d '[
{
"type": "track",
"payload": {
"eventId": "evt_123",
"name": "page_view",
"anonymousId": "anon_456",
"sessionId": "sess_789",
"sessionStartTime": 1709251200000,
"timestamp": 1709251200000,
"path": "/dashboard",
"title": "Dashboard",
"referrer": "https://google.com",
"screen_resolution": "1920x1080",
"viewport_size": "1440x900",
"timezone": "America/New_York",
"language": "en-US",
"load_time": 1200,
"ttfb": 250
}
},
{
"type": "outgoing_link",
"payload": {
"eventId": "evt_124",
"anonymousId": "anon_456",
"sessionId": "sess_789",
"timestamp": 1709251210000,
"href": "https://external-site.com",
"text": "Learn More"
}
}
]'
{
"status": "success",
"batch": true,
"processed": 2,
"batched": {
"track": 1,
"outgoing_link": 1
},
"results": [
{
"status": "success",
"type": "track",
"eventId": "evt_123"
},
{
"status": "success",
"type": "outgoing_link",
"eventId": "evt_124"
}
]
}
curl -X POST 'https://api.databuddy.io/batch?website_id=550e8400-e29b-41d4-a716-446655440000' \
-H "Content-Type: application/json" \
-d '[
{
"type": "track",
"payload": {
"name": "button_click",
"anonymousId": "anon_123",
"sessionId": "sess_456",
"sessionStartTime": 1709251200000,
"timestamp": 1709251205000,
"path": "/pricing",
"title": "Pricing",
"referrer": "",
"screen_resolution": "1366x768",
"viewport_size": "1366x768",
"timezone": "UTC",
"language": "en"
}
},
{
"type": "track",
"payload": {
"name": "form_submit",
"anonymousId": "anon_123",
"sessionId": "sess_456",
"sessionStartTime": 1709251200000,
"timestamp": 1709251220000,
"path": "/contact",
"title": "Contact Us",
"referrer": "/pricing",
"screen_resolution": "1366x768",
"viewport_size": "1366x768",
"timezone": "UTC",
"language": "en"
}
}
]'
{
"status": "error",
"message": "Batch too large"
}
{
"status": "error",
"message": "Batch endpoint expects array of events"
}
{
"status": "success",
"batch": true,
"processed": 2,
"batched": {
"track": 1,
"outgoing_link": 0
},
"results": [
{
"status": "success",
"type": "track",
"eventId": "evt_123"
},
{
"status": "error",
"message": "Invalid event schema",
"eventType": "track",
"eventId": "evt_124"
}
]
}