Track multiple events in a batch
curl --request POST \
--url https://api.engagefabric.com/events/batch \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"projectId": "123e4567-e89b-12d3-a456-426614174000",
"externalUserId": "user_12345",
"eventType": "lesson_completed",
"properties": {
"lessonId": "math-101",
"score": 95,
"duration": 300
},
"timestamp": "2025-11-17T10:30:00Z",
"idempotencyKey": "evt_user12345_lesson_20251117_103000"
}
]
}
'import requests
url = "https://api.engagefabric.com/events/batch"
payload = { "events": [
{
"projectId": "123e4567-e89b-12d3-a456-426614174000",
"externalUserId": "user_12345",
"eventType": "lesson_completed",
"properties": {
"lessonId": "math-101",
"score": 95,
"duration": 300
},
"timestamp": "2025-11-17T10:30:00Z",
"idempotencyKey": "evt_user12345_lesson_20251117_103000"
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
projectId: '123e4567-e89b-12d3-a456-426614174000',
externalUserId: 'user_12345',
eventType: 'lesson_completed',
properties: {lessonId: 'math-101', score: 95, duration: 300},
timestamp: '2025-11-17T10:30:00Z',
idempotencyKey: 'evt_user12345_lesson_20251117_103000'
}
]
})
};
fetch('https://api.engagefabric.com/events/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.engagefabric.com/events/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'events' => [
[
'projectId' => '123e4567-e89b-12d3-a456-426614174000',
'externalUserId' => 'user_12345',
'eventType' => 'lesson_completed',
'properties' => [
'lessonId' => 'math-101',
'score' => 95,
'duration' => 300
],
'timestamp' => '2025-11-17T10:30:00Z',
'idempotencyKey' => 'evt_user12345_lesson_20251117_103000'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.engagefabric.com/events/batch"
payload := strings.NewReader("{\n \"events\": [\n {\n \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"eventType\": \"lesson_completed\",\n \"properties\": {\n \"lessonId\": \"math-101\",\n \"score\": 95,\n \"duration\": 300\n },\n \"timestamp\": \"2025-11-17T10:30:00Z\",\n \"idempotencyKey\": \"evt_user12345_lesson_20251117_103000\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.engagefabric.com/events/batch")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"eventType\": \"lesson_completed\",\n \"properties\": {\n \"lessonId\": \"math-101\",\n \"score\": 95,\n \"duration\": 300\n },\n \"timestamp\": \"2025-11-17T10:30:00Z\",\n \"idempotencyKey\": \"evt_user12345_lesson_20251117_103000\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.engagefabric.com/events/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n {\n \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"eventType\": \"lesson_completed\",\n \"properties\": {\n \"lessonId\": \"math-101\",\n \"score\": 95,\n \"duration\": 300\n },\n \"timestamp\": \"2025-11-17T10:30:00Z\",\n \"idempotencyKey\": \"evt_user12345_lesson_20251117_103000\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"accepted": 10,
"rejected": 2,
"skipped": 1,
"results": [
{
"eventId": "123e4567-e89b-12d3-a456-426614174000",
"status": "PENDING",
"skipped": false,
"message": "Event queued for processing",
"existingEventId": "<string>"
}
]
}Events
Track multiple events in a batch
Submit multiple events for processing in a single request. Useful for offline sync or bulk imports.
POST
/
events
/
batch
Track multiple events in a batch
curl --request POST \
--url https://api.engagefabric.com/events/batch \
--header 'Content-Type: application/json' \
--data '
{
"events": [
{
"projectId": "123e4567-e89b-12d3-a456-426614174000",
"externalUserId": "user_12345",
"eventType": "lesson_completed",
"properties": {
"lessonId": "math-101",
"score": 95,
"duration": 300
},
"timestamp": "2025-11-17T10:30:00Z",
"idempotencyKey": "evt_user12345_lesson_20251117_103000"
}
]
}
'import requests
url = "https://api.engagefabric.com/events/batch"
payload = { "events": [
{
"projectId": "123e4567-e89b-12d3-a456-426614174000",
"externalUserId": "user_12345",
"eventType": "lesson_completed",
"properties": {
"lessonId": "math-101",
"score": 95,
"duration": 300
},
"timestamp": "2025-11-17T10:30:00Z",
"idempotencyKey": "evt_user12345_lesson_20251117_103000"
}
] }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
events: [
{
projectId: '123e4567-e89b-12d3-a456-426614174000',
externalUserId: 'user_12345',
eventType: 'lesson_completed',
properties: {lessonId: 'math-101', score: 95, duration: 300},
timestamp: '2025-11-17T10:30:00Z',
idempotencyKey: 'evt_user12345_lesson_20251117_103000'
}
]
})
};
fetch('https://api.engagefabric.com/events/batch', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.engagefabric.com/events/batch",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'events' => [
[
'projectId' => '123e4567-e89b-12d3-a456-426614174000',
'externalUserId' => 'user_12345',
'eventType' => 'lesson_completed',
'properties' => [
'lessonId' => 'math-101',
'score' => 95,
'duration' => 300
],
'timestamp' => '2025-11-17T10:30:00Z',
'idempotencyKey' => 'evt_user12345_lesson_20251117_103000'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.engagefabric.com/events/batch"
payload := strings.NewReader("{\n \"events\": [\n {\n \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"eventType\": \"lesson_completed\",\n \"properties\": {\n \"lessonId\": \"math-101\",\n \"score\": 95,\n \"duration\": 300\n },\n \"timestamp\": \"2025-11-17T10:30:00Z\",\n \"idempotencyKey\": \"evt_user12345_lesson_20251117_103000\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.engagefabric.com/events/batch")
.header("Content-Type", "application/json")
.body("{\n \"events\": [\n {\n \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"eventType\": \"lesson_completed\",\n \"properties\": {\n \"lessonId\": \"math-101\",\n \"score\": 95,\n \"duration\": 300\n },\n \"timestamp\": \"2025-11-17T10:30:00Z\",\n \"idempotencyKey\": \"evt_user12345_lesson_20251117_103000\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.engagefabric.com/events/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"events\": [\n {\n \"projectId\": \"123e4567-e89b-12d3-a456-426614174000\",\n \"externalUserId\": \"user_12345\",\n \"eventType\": \"lesson_completed\",\n \"properties\": {\n \"lessonId\": \"math-101\",\n \"score\": 95,\n \"duration\": 300\n },\n \"timestamp\": \"2025-11-17T10:30:00Z\",\n \"idempotencyKey\": \"evt_user12345_lesson_20251117_103000\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"accepted": 10,
"rejected": 2,
"skipped": 1,
"results": [
{
"eventId": "123e4567-e89b-12d3-a456-426614174000",
"status": "PENDING",
"skipped": false,
"message": "Event queued for processing",
"existingEventId": "<string>"
}
]
}Body
application/json
Array of events to track
Show child attributes
Show child attributes
⌘I
