Ingest audience messages
curl --request POST \
--url https://api.immutable.com/v1/audience/messages \
--header 'Content-Type: application/json' \
--header 'x-immutable-publishable-key: <x-immutable-publishable-key>' \
--data '
{
"messages": [
{
"type": "<string>",
"messageId": "<string>",
"eventTimestamp": "<string>",
"anonymousId": "<string>",
"deviceId": "<string>",
"sessionId": "<string>",
"context": {
"library": "<string>",
"libraryVersion": "<string>",
"userAgent": "<string>",
"locale": "<string>",
"timezone": "<string>",
"screen": "<string>",
"screenDensity": 123,
"pageUrl": "<string>",
"pagePath": "<string>",
"pageReferrer": "<string>",
"pageTitle": "<string>",
"browserLanguage": "<string>"
},
"eventName": "<string>",
"properties": {},
"userId": "<string>",
"identityType": "<string>",
"traits": {},
"fromId": "<string>",
"fromType": "<string>",
"toId": "<string>",
"toType": "<string>",
"surface": "<string>",
"consentLevel": "<string>",
"test": true
}
]
}
'import requests
url = "https://api.immutable.com/v1/audience/messages"
payload = { "messages": [
{
"type": "<string>",
"messageId": "<string>",
"eventTimestamp": "<string>",
"anonymousId": "<string>",
"deviceId": "<string>",
"sessionId": "<string>",
"context": {
"library": "<string>",
"libraryVersion": "<string>",
"userAgent": "<string>",
"locale": "<string>",
"timezone": "<string>",
"screen": "<string>",
"screenDensity": 123,
"pageUrl": "<string>",
"pagePath": "<string>",
"pageReferrer": "<string>",
"pageTitle": "<string>",
"browserLanguage": "<string>"
},
"eventName": "<string>",
"properties": {},
"userId": "<string>",
"identityType": "<string>",
"traits": {},
"fromId": "<string>",
"fromType": "<string>",
"toId": "<string>",
"toType": "<string>",
"surface": "<string>",
"consentLevel": "<string>",
"test": True
}
] }
headers = {
"x-immutable-publishable-key": "<x-immutable-publishable-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-immutable-publishable-key': '<x-immutable-publishable-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
messages: [
{
type: '<string>',
messageId: '<string>',
eventTimestamp: '<string>',
anonymousId: '<string>',
deviceId: '<string>',
sessionId: '<string>',
context: {
library: '<string>',
libraryVersion: '<string>',
userAgent: '<string>',
locale: '<string>',
timezone: '<string>',
screen: '<string>',
screenDensity: 123,
pageUrl: '<string>',
pagePath: '<string>',
pageReferrer: '<string>',
pageTitle: '<string>',
browserLanguage: '<string>'
},
eventName: '<string>',
properties: {},
userId: '<string>',
identityType: '<string>',
traits: {},
fromId: '<string>',
fromType: '<string>',
toId: '<string>',
toType: '<string>',
surface: '<string>',
consentLevel: '<string>',
test: true
}
]
})
};
fetch('https://api.immutable.com/v1/audience/messages', 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.immutable.com/v1/audience/messages",
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([
'messages' => [
[
'type' => '<string>',
'messageId' => '<string>',
'eventTimestamp' => '<string>',
'anonymousId' => '<string>',
'deviceId' => '<string>',
'sessionId' => '<string>',
'context' => [
'library' => '<string>',
'libraryVersion' => '<string>',
'userAgent' => '<string>',
'locale' => '<string>',
'timezone' => '<string>',
'screen' => '<string>',
'screenDensity' => 123,
'pageUrl' => '<string>',
'pagePath' => '<string>',
'pageReferrer' => '<string>',
'pageTitle' => '<string>',
'browserLanguage' => '<string>'
],
'eventName' => '<string>',
'properties' => [
],
'userId' => '<string>',
'identityType' => '<string>',
'traits' => [
],
'fromId' => '<string>',
'fromType' => '<string>',
'toId' => '<string>',
'toType' => '<string>',
'surface' => '<string>',
'consentLevel' => '<string>',
'test' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-immutable-publishable-key: <x-immutable-publishable-key>"
],
]);
$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.immutable.com/v1/audience/messages"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"type\": \"<string>\",\n \"messageId\": \"<string>\",\n \"eventTimestamp\": \"<string>\",\n \"anonymousId\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"context\": {\n \"library\": \"<string>\",\n \"libraryVersion\": \"<string>\",\n \"userAgent\": \"<string>\",\n \"locale\": \"<string>\",\n \"timezone\": \"<string>\",\n \"screen\": \"<string>\",\n \"screenDensity\": 123,\n \"pageUrl\": \"<string>\",\n \"pagePath\": \"<string>\",\n \"pageReferrer\": \"<string>\",\n \"pageTitle\": \"<string>\",\n \"browserLanguage\": \"<string>\"\n },\n \"eventName\": \"<string>\",\n \"properties\": {},\n \"userId\": \"<string>\",\n \"identityType\": \"<string>\",\n \"traits\": {},\n \"fromId\": \"<string>\",\n \"fromType\": \"<string>\",\n \"toId\": \"<string>\",\n \"toType\": \"<string>\",\n \"surface\": \"<string>\",\n \"consentLevel\": \"<string>\",\n \"test\": true\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-immutable-publishable-key", "<x-immutable-publishable-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.immutable.com/v1/audience/messages")
.header("x-immutable-publishable-key", "<x-immutable-publishable-key>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"type\": \"<string>\",\n \"messageId\": \"<string>\",\n \"eventTimestamp\": \"<string>\",\n \"anonymousId\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"context\": {\n \"library\": \"<string>\",\n \"libraryVersion\": \"<string>\",\n \"userAgent\": \"<string>\",\n \"locale\": \"<string>\",\n \"timezone\": \"<string>\",\n \"screen\": \"<string>\",\n \"screenDensity\": 123,\n \"pageUrl\": \"<string>\",\n \"pagePath\": \"<string>\",\n \"pageReferrer\": \"<string>\",\n \"pageTitle\": \"<string>\",\n \"browserLanguage\": \"<string>\"\n },\n \"eventName\": \"<string>\",\n \"properties\": {},\n \"userId\": \"<string>\",\n \"identityType\": \"<string>\",\n \"traits\": {},\n \"fromId\": \"<string>\",\n \"fromType\": \"<string>\",\n \"toId\": \"<string>\",\n \"toType\": \"<string>\",\n \"surface\": \"<string>\",\n \"consentLevel\": \"<string>\",\n \"test\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.immutable.com/v1/audience/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-immutable-publishable-key"] = '<x-immutable-publishable-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"type\": \"<string>\",\n \"messageId\": \"<string>\",\n \"eventTimestamp\": \"<string>\",\n \"anonymousId\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"context\": {\n \"library\": \"<string>\",\n \"libraryVersion\": \"<string>\",\n \"userAgent\": \"<string>\",\n \"locale\": \"<string>\",\n \"timezone\": \"<string>\",\n \"screen\": \"<string>\",\n \"screenDensity\": 123,\n \"pageUrl\": \"<string>\",\n \"pagePath\": \"<string>\",\n \"pageReferrer\": \"<string>\",\n \"pageTitle\": \"<string>\",\n \"browserLanguage\": \"<string>\"\n },\n \"eventName\": \"<string>\",\n \"properties\": {},\n \"userId\": \"<string>\",\n \"identityType\": \"<string>\",\n \"traits\": {},\n \"fromId\": \"<string>\",\n \"fromType\": \"<string>\",\n \"toId\": \"<string>\",\n \"toType\": \"<string>\",\n \"surface\": \"<string>\",\n \"consentLevel\": \"<string>\",\n \"test\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"accepted": 123,
"rejected": 123,
"rejections": [
{
"messageId": "<string>",
"errors": [
{
"field": "<string>",
"code": "INVALID_FORMAT",
"message": "<string>"
}
]
}
]
}{
"message": "all fields must be provided",
"link": "https://docs.immutable.com",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "VALIDATION_ERROR",
"details": {}
}{
"message": "all fields must be provided",
"link": "https://docs.immutable.com",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "UNAUTHORISED_REQUEST",
"details": {}
}{
"message": "all fields must be provided",
"link": "https://docs.immutable.com",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "TOO_MANY_REQUESTS_ERROR",
"details": {}
}{
"message": "all fields must be provided",
"link": "https://docs.immutable.com",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "INTERNAL_SERVER_ERROR",
"details": {}
}ingest
Ingest audience messages
POST
/
v1
/
audience
/
messages
Ingest audience messages
curl --request POST \
--url https://api.immutable.com/v1/audience/messages \
--header 'Content-Type: application/json' \
--header 'x-immutable-publishable-key: <x-immutable-publishable-key>' \
--data '
{
"messages": [
{
"type": "<string>",
"messageId": "<string>",
"eventTimestamp": "<string>",
"anonymousId": "<string>",
"deviceId": "<string>",
"sessionId": "<string>",
"context": {
"library": "<string>",
"libraryVersion": "<string>",
"userAgent": "<string>",
"locale": "<string>",
"timezone": "<string>",
"screen": "<string>",
"screenDensity": 123,
"pageUrl": "<string>",
"pagePath": "<string>",
"pageReferrer": "<string>",
"pageTitle": "<string>",
"browserLanguage": "<string>"
},
"eventName": "<string>",
"properties": {},
"userId": "<string>",
"identityType": "<string>",
"traits": {},
"fromId": "<string>",
"fromType": "<string>",
"toId": "<string>",
"toType": "<string>",
"surface": "<string>",
"consentLevel": "<string>",
"test": true
}
]
}
'import requests
url = "https://api.immutable.com/v1/audience/messages"
payload = { "messages": [
{
"type": "<string>",
"messageId": "<string>",
"eventTimestamp": "<string>",
"anonymousId": "<string>",
"deviceId": "<string>",
"sessionId": "<string>",
"context": {
"library": "<string>",
"libraryVersion": "<string>",
"userAgent": "<string>",
"locale": "<string>",
"timezone": "<string>",
"screen": "<string>",
"screenDensity": 123,
"pageUrl": "<string>",
"pagePath": "<string>",
"pageReferrer": "<string>",
"pageTitle": "<string>",
"browserLanguage": "<string>"
},
"eventName": "<string>",
"properties": {},
"userId": "<string>",
"identityType": "<string>",
"traits": {},
"fromId": "<string>",
"fromType": "<string>",
"toId": "<string>",
"toType": "<string>",
"surface": "<string>",
"consentLevel": "<string>",
"test": True
}
] }
headers = {
"x-immutable-publishable-key": "<x-immutable-publishable-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'x-immutable-publishable-key': '<x-immutable-publishable-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
messages: [
{
type: '<string>',
messageId: '<string>',
eventTimestamp: '<string>',
anonymousId: '<string>',
deviceId: '<string>',
sessionId: '<string>',
context: {
library: '<string>',
libraryVersion: '<string>',
userAgent: '<string>',
locale: '<string>',
timezone: '<string>',
screen: '<string>',
screenDensity: 123,
pageUrl: '<string>',
pagePath: '<string>',
pageReferrer: '<string>',
pageTitle: '<string>',
browserLanguage: '<string>'
},
eventName: '<string>',
properties: {},
userId: '<string>',
identityType: '<string>',
traits: {},
fromId: '<string>',
fromType: '<string>',
toId: '<string>',
toType: '<string>',
surface: '<string>',
consentLevel: '<string>',
test: true
}
]
})
};
fetch('https://api.immutable.com/v1/audience/messages', 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.immutable.com/v1/audience/messages",
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([
'messages' => [
[
'type' => '<string>',
'messageId' => '<string>',
'eventTimestamp' => '<string>',
'anonymousId' => '<string>',
'deviceId' => '<string>',
'sessionId' => '<string>',
'context' => [
'library' => '<string>',
'libraryVersion' => '<string>',
'userAgent' => '<string>',
'locale' => '<string>',
'timezone' => '<string>',
'screen' => '<string>',
'screenDensity' => 123,
'pageUrl' => '<string>',
'pagePath' => '<string>',
'pageReferrer' => '<string>',
'pageTitle' => '<string>',
'browserLanguage' => '<string>'
],
'eventName' => '<string>',
'properties' => [
],
'userId' => '<string>',
'identityType' => '<string>',
'traits' => [
],
'fromId' => '<string>',
'fromType' => '<string>',
'toId' => '<string>',
'toType' => '<string>',
'surface' => '<string>',
'consentLevel' => '<string>',
'test' => true
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-immutable-publishable-key: <x-immutable-publishable-key>"
],
]);
$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.immutable.com/v1/audience/messages"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"type\": \"<string>\",\n \"messageId\": \"<string>\",\n \"eventTimestamp\": \"<string>\",\n \"anonymousId\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"context\": {\n \"library\": \"<string>\",\n \"libraryVersion\": \"<string>\",\n \"userAgent\": \"<string>\",\n \"locale\": \"<string>\",\n \"timezone\": \"<string>\",\n \"screen\": \"<string>\",\n \"screenDensity\": 123,\n \"pageUrl\": \"<string>\",\n \"pagePath\": \"<string>\",\n \"pageReferrer\": \"<string>\",\n \"pageTitle\": \"<string>\",\n \"browserLanguage\": \"<string>\"\n },\n \"eventName\": \"<string>\",\n \"properties\": {},\n \"userId\": \"<string>\",\n \"identityType\": \"<string>\",\n \"traits\": {},\n \"fromId\": \"<string>\",\n \"fromType\": \"<string>\",\n \"toId\": \"<string>\",\n \"toType\": \"<string>\",\n \"surface\": \"<string>\",\n \"consentLevel\": \"<string>\",\n \"test\": true\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-immutable-publishable-key", "<x-immutable-publishable-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.immutable.com/v1/audience/messages")
.header("x-immutable-publishable-key", "<x-immutable-publishable-key>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"type\": \"<string>\",\n \"messageId\": \"<string>\",\n \"eventTimestamp\": \"<string>\",\n \"anonymousId\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"context\": {\n \"library\": \"<string>\",\n \"libraryVersion\": \"<string>\",\n \"userAgent\": \"<string>\",\n \"locale\": \"<string>\",\n \"timezone\": \"<string>\",\n \"screen\": \"<string>\",\n \"screenDensity\": 123,\n \"pageUrl\": \"<string>\",\n \"pagePath\": \"<string>\",\n \"pageReferrer\": \"<string>\",\n \"pageTitle\": \"<string>\",\n \"browserLanguage\": \"<string>\"\n },\n \"eventName\": \"<string>\",\n \"properties\": {},\n \"userId\": \"<string>\",\n \"identityType\": \"<string>\",\n \"traits\": {},\n \"fromId\": \"<string>\",\n \"fromType\": \"<string>\",\n \"toId\": \"<string>\",\n \"toType\": \"<string>\",\n \"surface\": \"<string>\",\n \"consentLevel\": \"<string>\",\n \"test\": true\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.immutable.com/v1/audience/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-immutable-publishable-key"] = '<x-immutable-publishable-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"type\": \"<string>\",\n \"messageId\": \"<string>\",\n \"eventTimestamp\": \"<string>\",\n \"anonymousId\": \"<string>\",\n \"deviceId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"context\": {\n \"library\": \"<string>\",\n \"libraryVersion\": \"<string>\",\n \"userAgent\": \"<string>\",\n \"locale\": \"<string>\",\n \"timezone\": \"<string>\",\n \"screen\": \"<string>\",\n \"screenDensity\": 123,\n \"pageUrl\": \"<string>\",\n \"pagePath\": \"<string>\",\n \"pageReferrer\": \"<string>\",\n \"pageTitle\": \"<string>\",\n \"browserLanguage\": \"<string>\"\n },\n \"eventName\": \"<string>\",\n \"properties\": {},\n \"userId\": \"<string>\",\n \"identityType\": \"<string>\",\n \"traits\": {},\n \"fromId\": \"<string>\",\n \"fromType\": \"<string>\",\n \"toId\": \"<string>\",\n \"toType\": \"<string>\",\n \"surface\": \"<string>\",\n \"consentLevel\": \"<string>\",\n \"test\": true\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"accepted": 123,
"rejected": 123,
"rejections": [
{
"messageId": "<string>",
"errors": [
{
"field": "<string>",
"code": "INVALID_FORMAT",
"message": "<string>"
}
]
}
]
}{
"message": "all fields must be provided",
"link": "https://docs.immutable.com",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "VALIDATION_ERROR",
"details": {}
}{
"message": "all fields must be provided",
"link": "https://docs.immutable.com",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "UNAUTHORISED_REQUEST",
"details": {}
}{
"message": "all fields must be provided",
"link": "https://docs.immutable.com",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "TOO_MANY_REQUESTS_ERROR",
"details": {}
}{
"message": "all fields must be provided",
"link": "https://docs.immutable.com",
"trace_id": "e47634b79a5cd6894ddc9639ec4aad26",
"code": "INTERNAL_SERVER_ERROR",
"details": {}
}Headers
Body
application/json
Required array length:
1 - 100 elementsShow child attributes
Show child attributes
Response
OK
Count of rejected messages. accepted + rejected always equals the number of messages submitted. May exceed rejections.length: messages that share a duplicated messageId are each counted here but collapse into a single rejections entry for that id.
Always present, even when empty. One entry per distinct rejected messageId.
Show child attributes
Show child attributes
Was this page helpful?
⌘I