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.
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
API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where YOUR_API_KEY is obtained from the Migma dashboard under Settings → Developers → API Keys.
Headers
Replay-safe key. Takes precedence over the body dedupeKey.
200Body
Event name, e.g. purchase.completed. Names containing refund or cancelled record negative conversion amounts.
120Contact identity for the event. At least one of email or subscriberId is required. Provider ids (externalCustomerId, externalCheckoutId, externalOrderId) support integrations and conversion attribution.
Show child attributes
Show child attributes
8040Contact metadata to update. Profile updates never change subscription status, tags, or consent. Events never opt a contact in.
Show child attributes
Show child attributes
Event facts. Up to 16KB, 50 top-level keys, 4 levels deep. A numeric value (major units, e.g. 49.99) together with identifiers.externalOrderId records a conversion; currency is an ISO code, default USD.
When the event happened. Defaults to receipt time.
Event-identity dedupe key. Replaying the same key stores nothing and returns the original eventId.
200Was this page helpful?