Track Event
curl --request POST \
--url https://api.migma.ai/v1/events \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "PROJECT_ID",
"name": "purchase.completed",
"identifiers": {
"email": "ada@example.com",
"externalOrderId": "order_8891"
},
"properties": {
"value": 49.99,
"currency": "USD"
}
}
'import requests
url = "https://api.migma.ai/v1/events"
payload = {
"projectId": "PROJECT_ID",
"name": "purchase.completed",
"identifiers": {
"email": "ada@example.com",
"externalOrderId": "order_8891"
},
"properties": {
"value": 49.99,
"currency": "USD"
}
}
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: 'PROJECT_ID',
name: 'purchase.completed',
identifiers: {email: 'ada@example.com', externalOrderId: 'order_8891'},
properties: {value: 49.99, currency: 'USD'}
})
};
fetch('https://api.migma.ai/v1/events', 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",
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' => 'PROJECT_ID',
'name' => 'purchase.completed',
'identifiers' => [
'email' => 'ada@example.com',
'externalOrderId' => 'order_8891'
],
'properties' => [
'value' => 49.99,
'currency' => 'USD'
]
]),
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"
payload := strings.NewReader("{\n \"projectId\": \"PROJECT_ID\",\n \"name\": \"purchase.completed\",\n \"identifiers\": {\n \"email\": \"ada@example.com\",\n \"externalOrderId\": \"order_8891\"\n },\n \"properties\": {\n \"value\": 49.99,\n \"currency\": \"USD\"\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")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"PROJECT_ID\",\n \"name\": \"purchase.completed\",\n \"identifiers\": {\n \"email\": \"ada@example.com\",\n \"externalOrderId\": \"order_8891\"\n },\n \"properties\": {\n \"value\": 49.99,\n \"currency\": \"USD\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/events")
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\": \"PROJECT_ID\",\n \"name\": \"purchase.completed\",\n \"identifiers\": {\n \"email\": \"ada@example.com\",\n \"externalOrderId\": \"order_8891\"\n },\n \"properties\": {\n \"value\": 49.99,\n \"currency\": \"USD\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"stored": true,
"eventId": "<string>",
"dedupeKey": "<string>"
},
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}Track Event
Record a customer event for a project. Requires the audience:write permission. Contact resolution is consent safe: profile fields may update, subscription status never changes. Send an Idempotency-Key header (or a body dedupeKey) for replay safety; without either, every call stores a distinct event. Events carrying identifiers.externalOrderId and a numeric properties.value are recorded as conversions attributed to the last email the contact clicked within five days.
POST
/
v1
/
events
Track Event
curl --request POST \
--url https://api.migma.ai/v1/events \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"projectId": "PROJECT_ID",
"name": "purchase.completed",
"identifiers": {
"email": "ada@example.com",
"externalOrderId": "order_8891"
},
"properties": {
"value": 49.99,
"currency": "USD"
}
}
'import requests
url = "https://api.migma.ai/v1/events"
payload = {
"projectId": "PROJECT_ID",
"name": "purchase.completed",
"identifiers": {
"email": "ada@example.com",
"externalOrderId": "order_8891"
},
"properties": {
"value": 49.99,
"currency": "USD"
}
}
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: 'PROJECT_ID',
name: 'purchase.completed',
identifiers: {email: 'ada@example.com', externalOrderId: 'order_8891'},
properties: {value: 49.99, currency: 'USD'}
})
};
fetch('https://api.migma.ai/v1/events', 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",
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' => 'PROJECT_ID',
'name' => 'purchase.completed',
'identifiers' => [
'email' => 'ada@example.com',
'externalOrderId' => 'order_8891'
],
'properties' => [
'value' => 49.99,
'currency' => 'USD'
]
]),
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"
payload := strings.NewReader("{\n \"projectId\": \"PROJECT_ID\",\n \"name\": \"purchase.completed\",\n \"identifiers\": {\n \"email\": \"ada@example.com\",\n \"externalOrderId\": \"order_8891\"\n },\n \"properties\": {\n \"value\": 49.99,\n \"currency\": \"USD\"\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")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"projectId\": \"PROJECT_ID\",\n \"name\": \"purchase.completed\",\n \"identifiers\": {\n \"email\": \"ada@example.com\",\n \"externalOrderId\": \"order_8891\"\n },\n \"properties\": {\n \"value\": 49.99,\n \"currency\": \"USD\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/events")
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\": \"PROJECT_ID\",\n \"name\": \"purchase.completed\",\n \"identifiers\": {\n \"email\": \"ada@example.com\",\n \"externalOrderId\": \"order_8891\"\n },\n \"properties\": {\n \"value\": 49.99,\n \"currency\": \"USD\"\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"stored": true,
"eventId": "<string>",
"dedupeKey": "<string>"
},
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}{
"success": true,
"data": null,
"error": "<string>"
}Authorizations
Headers
Body
application/json
Was this page helpful?