curl --request POST \
--url https://api.instantly.ai/api/v2/email-marketing/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event_name": "form.submitted",
"email": "jane@acme.com",
"subscriber_id": "0198c2a4-3f1e-7000-8000-000000000000"
}
'import requests
url = "https://api.instantly.ai/api/v2/email-marketing/events"
payload = {
"event_name": "form.submitted",
"email": "jane@acme.com",
"subscriber_id": "0198c2a4-3f1e-7000-8000-000000000000"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event_name: 'form.submitted',
email: 'jane@acme.com',
subscriber_id: '0198c2a4-3f1e-7000-8000-000000000000'
})
};
fetch('https://api.instantly.ai/api/v2/email-marketing/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.instantly.ai/api/v2/email-marketing/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event_name\": \"form.submitted\",\n \"email\": \"jane@acme.com\",\n \"subscriber_id\": \"0198c2a4-3f1e-7000-8000-000000000000\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.instantly.ai/api/v2/email-marketing/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([
'event_name' => 'form.submitted',
'email' => 'jane@acme.com',
'subscriber_id' => '0198c2a4-3f1e-7000-8000-000000000000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.instantly.ai/api/v2/email-marketing/events"
payload := strings.NewReader("{\n \"event_name\": \"form.submitted\",\n \"email\": \"jane@acme.com\",\n \"subscriber_id\": \"0198c2a4-3f1e-7000-8000-000000000000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"receipt_id": "0198c2a4-3f1e-7000-8000-000000000000",
"deduplicated": false
}{
"statusCode": 400,
"error": "Bad Request",
"message": "limit: must be at most 50",
"code": "VALIDATION_ERROR"
}{
"statusCode": 401,
"error": "Unauthorized",
"message": "Missing Authorization header"
}{
"statusCode": 402,
"error": "Payment Required",
"message": "Workspace does not have an active paid plan"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "Workspace suspended due to a high bounce or spam complaint rate. Please contact support.",
"code": "WORKSPACE_SUSPENDED"
}{
"statusCode": 404,
"error": "Not Found",
"message": "Not found",
"code": "NOT_FOUND"
}{
"statusCode": 408,
"error": "Request Timeout",
"message": "An internal error occurred"
}{
"statusCode": 409,
"error": "Conflict",
"message": "The resource has changed. Reload it and try again.",
"code": "CONFLICT"
}{
"statusCode": 429,
"error": "Too Many Requests",
"message": "Rate limit exceeded"
}{
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal error occurred"
}Track a customer event
Records an event about a contact, such as a form submission or a purchase, and returns its receipt. The event is stored before the response and processed afterwards, so journey triggers and conversions see it shortly after. Only API keys can call this endpoint: an OAuth token gets 401.
Requires one of the following scopes: email_marketing_events:create, email_marketing_events:all, all:create, all:all
curl --request POST \
--url https://api.instantly.ai/api/v2/email-marketing/events \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"event_name": "form.submitted",
"email": "jane@acme.com",
"subscriber_id": "0198c2a4-3f1e-7000-8000-000000000000"
}
'import requests
url = "https://api.instantly.ai/api/v2/email-marketing/events"
payload = {
"event_name": "form.submitted",
"email": "jane@acme.com",
"subscriber_id": "0198c2a4-3f1e-7000-8000-000000000000"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
event_name: 'form.submitted',
email: 'jane@acme.com',
subscriber_id: '0198c2a4-3f1e-7000-8000-000000000000'
})
};
fetch('https://api.instantly.ai/api/v2/email-marketing/events', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.post("https://api.instantly.ai/api/v2/email-marketing/events")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"event_name\": \"form.submitted\",\n \"email\": \"jane@acme.com\",\n \"subscriber_id\": \"0198c2a4-3f1e-7000-8000-000000000000\"\n}")
.asString();<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.instantly.ai/api/v2/email-marketing/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([
'event_name' => 'form.submitted',
'email' => 'jane@acme.com',
'subscriber_id' => '0198c2a4-3f1e-7000-8000-000000000000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.instantly.ai/api/v2/email-marketing/events"
payload := strings.NewReader("{\n \"event_name\": \"form.submitted\",\n \"email\": \"jane@acme.com\",\n \"subscriber_id\": \"0198c2a4-3f1e-7000-8000-000000000000\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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))
}{
"receipt_id": "0198c2a4-3f1e-7000-8000-000000000000",
"deduplicated": false
}{
"statusCode": 400,
"error": "Bad Request",
"message": "limit: must be at most 50",
"code": "VALIDATION_ERROR"
}{
"statusCode": 401,
"error": "Unauthorized",
"message": "Missing Authorization header"
}{
"statusCode": 402,
"error": "Payment Required",
"message": "Workspace does not have an active paid plan"
}{
"statusCode": 403,
"error": "Forbidden",
"message": "Workspace suspended due to a high bounce or spam complaint rate. Please contact support.",
"code": "WORKSPACE_SUSPENDED"
}{
"statusCode": 404,
"error": "Not Found",
"message": "Not found",
"code": "NOT_FOUND"
}{
"statusCode": 408,
"error": "Request Timeout",
"message": "An internal error occurred"
}{
"statusCode": 409,
"error": "Conflict",
"message": "The resource has changed. Reload it and try again.",
"code": "CONFLICT"
}{
"statusCode": 429,
"error": "Too Many Requests",
"message": "Rate limit exceeded"
}{
"statusCode": 500,
"error": "Internal Server Error",
"message": "An internal error occurred"
}Authorizations
Body
- Option 1
- Option 2
Your unique ID for this event, up to 128 characters, used to deduplicate retries. Sending the same event_id with the same body again returns the first receipt with deduplicated: true; the same event_id with a different body gives 409. Without event_id nothing is deduplicated, so a retried request is recorded twice. All API keys of a workspace share one namespace, so use globally unique values such as a UUID.
1 - 128"form-submission-8371"
Response
The event was accepted, or was a repeat of an accepted event