Track Events (Batch)
curl --request POST \
--url https://api.migma.ai/v1/events/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "<string>",
"events": [
{
"name": "<string>",
"identifiers": {
"email": "jsmith@example.com",
"subscriberId": "<string>",
"externalCustomerId": "<string>",
"externalCheckoutId": "<string>",
"externalOrderId": "<string>"
},
"origin": "api",
"eventVersion": "<string>",
"profile": {
"firstName": "<string>",
"lastName": "<string>",
"phone": "<string>",
"country": "<string>",
"language": "<string>",
"customFields": {}
},
"properties": {},
"occurredAt": "2023-11-07T05:31:56Z",
"dedupeKey": "<string>"
}
]
}
'import requests
url = "https://api.migma.ai/v1/events/batch"
payload = {
"projectId": "<string>",
"events": [
{
"name": "<string>",
"identifiers": {
"email": "jsmith@example.com",
"subscriberId": "<string>",
"externalCustomerId": "<string>",
"externalCheckoutId": "<string>",
"externalOrderId": "<string>"
},
"origin": "api",
"eventVersion": "<string>",
"profile": {
"firstName": "<string>",
"lastName": "<string>",
"phone": "<string>",
"country": "<string>",
"language": "<string>",
"customFields": {}
},
"properties": {},
"occurredAt": "2023-11-07T05:31:56Z",
"dedupeKey": "<string>"
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
projectId: '<string>',
events: [
{
name: '<string>',
identifiers: {
email: 'jsmith@example.com',
subscriberId: '<string>',
externalCustomerId: '<string>',
externalCheckoutId: '<string>',
externalOrderId: '<string>'
},
origin: 'api',
eventVersion: '<string>',
profile: {
firstName: '<string>',
lastName: '<string>',
phone: '<string>',
country: '<string>',
language: '<string>',
customFields: {}
},
properties: {},
occurredAt: '2023-11-07T05:31:56Z',
dedupeKey: '<string>'
}
]
})
};
fetch('https://api.migma.ai/v1/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.migma.ai/v1/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([
'projectId' => '<string>',
'events' => [
[
'name' => '<string>',
'identifiers' => [
'email' => 'jsmith@example.com',
'subscriberId' => '<string>',
'externalCustomerId' => '<string>',
'externalCheckoutId' => '<string>',
'externalOrderId' => '<string>'
],
'origin' => 'api',
'eventVersion' => '<string>',
'profile' => [
'firstName' => '<string>',
'lastName' => '<string>',
'phone' => '<string>',
'country' => '<string>',
'language' => '<string>',
'customFields' => [
]
],
'properties' => [
],
'occurredAt' => '2023-11-07T05:31:56Z',
'dedupeKey' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.migma.ai/v1/events/batch"
payload := strings.NewReader("{\n \"projectId\": \"<string>\",\n \"events\": [\n {\n \"name\": \"<string>\",\n \"identifiers\": {\n \"email\": \"jsmith@example.com\",\n \"subscriberId\": \"<string>\",\n \"externalCustomerId\": \"<string>\",\n \"externalCheckoutId\": \"<string>\",\n \"externalOrderId\": \"<string>\"\n },\n \"origin\": \"api\",\n \"eventVersion\": \"<string>\",\n \"profile\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phone\": \"<string>\",\n \"country\": \"<string>\",\n \"language\": \"<string>\",\n \"customFields\": {}\n },\n \"properties\": {},\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"dedupeKey\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.migma.ai/v1/events/batch")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"<string>\",\n \"events\": [\n {\n \"name\": \"<string>\",\n \"identifiers\": {\n \"email\": \"jsmith@example.com\",\n \"subscriberId\": \"<string>\",\n \"externalCustomerId\": \"<string>\",\n \"externalCheckoutId\": \"<string>\",\n \"externalOrderId\": \"<string>\"\n },\n \"origin\": \"api\",\n \"eventVersion\": \"<string>\",\n \"profile\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phone\": \"<string>\",\n \"country\": \"<string>\",\n \"language\": \"<string>\",\n \"customFields\": {}\n },\n \"properties\": {},\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"dedupeKey\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/events/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"projectId\": \"<string>\",\n \"events\": [\n {\n \"name\": \"<string>\",\n \"identifiers\": {\n \"email\": \"jsmith@example.com\",\n \"subscriberId\": \"<string>\",\n \"externalCustomerId\": \"<string>\",\n \"externalCheckoutId\": \"<string>\",\n \"externalOrderId\": \"<string>\"\n },\n \"origin\": \"api\",\n \"eventVersion\": \"<string>\",\n \"profile\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phone\": \"<string>\",\n \"country\": \"<string>\",\n \"language\": \"<string>\",\n \"customFields\": {}\n },\n \"properties\": {},\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"dedupeKey\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"accepted": 123,
"duplicates": 123,
"results": [
{
"index": 123,
"stored": true,
"eventId": "<string>",
"dedupeKey": "<string>"
}
],
"invalid": [
{
"index": 123,
"error": "<string>"
}
]
},
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}Track Events (Batch)
Record up to 500 events in one request with row-level partial success: one malformed row never fails the batch. Idempotency is per row via dedupeKey; a request-level Idempotency-Key header is rejected. Aggregate properties payloads are limited to 1MB.
POST
/
v1
/
events
/
batch
Track Events (Batch)
curl --request POST \
--url https://api.migma.ai/v1/events/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "<string>",
"events": [
{
"name": "<string>",
"identifiers": {
"email": "jsmith@example.com",
"subscriberId": "<string>",
"externalCustomerId": "<string>",
"externalCheckoutId": "<string>",
"externalOrderId": "<string>"
},
"origin": "api",
"eventVersion": "<string>",
"profile": {
"firstName": "<string>",
"lastName": "<string>",
"phone": "<string>",
"country": "<string>",
"language": "<string>",
"customFields": {}
},
"properties": {},
"occurredAt": "2023-11-07T05:31:56Z",
"dedupeKey": "<string>"
}
]
}
'import requests
url = "https://api.migma.ai/v1/events/batch"
payload = {
"projectId": "<string>",
"events": [
{
"name": "<string>",
"identifiers": {
"email": "jsmith@example.com",
"subscriberId": "<string>",
"externalCustomerId": "<string>",
"externalCheckoutId": "<string>",
"externalOrderId": "<string>"
},
"origin": "api",
"eventVersion": "<string>",
"profile": {
"firstName": "<string>",
"lastName": "<string>",
"phone": "<string>",
"country": "<string>",
"language": "<string>",
"customFields": {}
},
"properties": {},
"occurredAt": "2023-11-07T05:31:56Z",
"dedupeKey": "<string>"
}
]
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
projectId: '<string>',
events: [
{
name: '<string>',
identifiers: {
email: 'jsmith@example.com',
subscriberId: '<string>',
externalCustomerId: '<string>',
externalCheckoutId: '<string>',
externalOrderId: '<string>'
},
origin: 'api',
eventVersion: '<string>',
profile: {
firstName: '<string>',
lastName: '<string>',
phone: '<string>',
country: '<string>',
language: '<string>',
customFields: {}
},
properties: {},
occurredAt: '2023-11-07T05:31:56Z',
dedupeKey: '<string>'
}
]
})
};
fetch('https://api.migma.ai/v1/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.migma.ai/v1/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([
'projectId' => '<string>',
'events' => [
[
'name' => '<string>',
'identifiers' => [
'email' => 'jsmith@example.com',
'subscriberId' => '<string>',
'externalCustomerId' => '<string>',
'externalCheckoutId' => '<string>',
'externalOrderId' => '<string>'
],
'origin' => 'api',
'eventVersion' => '<string>',
'profile' => [
'firstName' => '<string>',
'lastName' => '<string>',
'phone' => '<string>',
'country' => '<string>',
'language' => '<string>',
'customFields' => [
]
],
'properties' => [
],
'occurredAt' => '2023-11-07T05:31:56Z',
'dedupeKey' => '<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.migma.ai/v1/events/batch"
payload := strings.NewReader("{\n \"projectId\": \"<string>\",\n \"events\": [\n {\n \"name\": \"<string>\",\n \"identifiers\": {\n \"email\": \"jsmith@example.com\",\n \"subscriberId\": \"<string>\",\n \"externalCustomerId\": \"<string>\",\n \"externalCheckoutId\": \"<string>\",\n \"externalOrderId\": \"<string>\"\n },\n \"origin\": \"api\",\n \"eventVersion\": \"<string>\",\n \"profile\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phone\": \"<string>\",\n \"country\": \"<string>\",\n \"language\": \"<string>\",\n \"customFields\": {}\n },\n \"properties\": {},\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"dedupeKey\": \"<string>\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.migma.ai/v1/events/batch")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"<string>\",\n \"events\": [\n {\n \"name\": \"<string>\",\n \"identifiers\": {\n \"email\": \"jsmith@example.com\",\n \"subscriberId\": \"<string>\",\n \"externalCustomerId\": \"<string>\",\n \"externalCheckoutId\": \"<string>\",\n \"externalOrderId\": \"<string>\"\n },\n \"origin\": \"api\",\n \"eventVersion\": \"<string>\",\n \"profile\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phone\": \"<string>\",\n \"country\": \"<string>\",\n \"language\": \"<string>\",\n \"customFields\": {}\n },\n \"properties\": {},\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"dedupeKey\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/events/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"projectId\": \"<string>\",\n \"events\": [\n {\n \"name\": \"<string>\",\n \"identifiers\": {\n \"email\": \"jsmith@example.com\",\n \"subscriberId\": \"<string>\",\n \"externalCustomerId\": \"<string>\",\n \"externalCheckoutId\": \"<string>\",\n \"externalOrderId\": \"<string>\"\n },\n \"origin\": \"api\",\n \"eventVersion\": \"<string>\",\n \"profile\": {\n \"firstName\": \"<string>\",\n \"lastName\": \"<string>\",\n \"phone\": \"<string>\",\n \"country\": \"<string>\",\n \"language\": \"<string>\",\n \"customFields\": {}\n },\n \"properties\": {},\n \"occurredAt\": \"2023-11-07T05:31:56Z\",\n \"dedupeKey\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"accepted": 123,
"duplicates": 123,
"results": [
{
"index": 123,
"stored": true,
"eventId": "<string>",
"dedupeKey": "<string>"
}
],
"invalid": [
{
"index": 123,
"error": "<string>"
}
]
},
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}Authorizations
API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where YOUR_API_KEY is obtained from the Migma dashboard under Settings → Developers → API Keys.
Body
application/json
Was this page helpful?
⌘I