Batch requests
The batch method helps you send an array of identify, group, track, page and/or screen requests in a single call, so you don't have to send multiple requests. Our server-side sources use this method automatically to increase performance.
Requests are limited to 500KB total per request and 32KB per call in the request. In a batch request, the context and integrations objects apply to all calls in the request. You can't set different context or integrations values for different calls in the same request.
- enumX
- Strict - Mode const:1When set to
1, enables strict validation that returns proper HTTP error codes (400/401) for validation failures. When not set or set to any other value, the API operates in permissive mode, logging errors but returning HTTP 200. Learn morevalues- 1
- Type: arraybatch
A group of requests you want to send to Data Pipelines in the call.
- context
A dictionary of context about a source call/event, like the user’s IP address or locale. Context is automatically collected by our source libraries.
A dictionary of context about a source call/event, like the user’s IP address or locale. Context is automatically collected by our source libraries.
- activeType: boolean
Whether a user is active.
This is usually used when you send an .identify() call to update the traits independently of when you've “last seen” a user.
- campaignType: object
Contains information about the campaign that resulted in the API call, gathered from, or mapping to, UTM parameters (e.g.
utm_source). - channelType: stringenum
The channel the event originated from.
values- browser
- server
- mobile
- ipType: string
The user's IP address. This isn't captured by our libraries, but by our servers when we receive client-side events (like from our JavaScript source).
- localeType: string
The locale string for the current user, e.g.
en-US. - pageType: object
Contains information about the current page in the browser. This is automatically collected by our JavaScript source.
- userType: string
Agent The user agent of the device making the request
- Type: objectintegrations
Contains a list of booleans indicating the integrations that are enabled (true) or disabled (false). By default, all integrations are enabled (returning an empty object). Set
"All": falseto reverse this behavior.
- 200
A successful request returns an empty object response.
curl https://cdp.customer.io/v1/batch \
--request POST \
--header 'X-Strict-Mode: 1' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic username:password' \
--data '{
"batch": [
{
"type": "identify",
"traits": {
"name": "Cool Person",
"email": "cool.person@example.com",
"likes_baseball": true,
"games_attended": 5
},
"userId": "97980cfea0067"
}
],
"context": {
"active": true,
"ip": "",
"locale": "",
"userAgent": "",
"channel": "browser",
"campaign": {
"name": "",
"source": "",
"medium": "",
"term": "",
"content": "",
"Additional UTM Parameters": ""
},
"page": {
"name": "",
"path": "",
"referrer": "",
"search": "",
"title": "",
"url": "",
"keywords": [
""
]
}
},
"integrations": {
"All": true,
"Salesforce": false
}
}'
A successful request returns an empty object response.