v1.0.0
OpenAPI 3.1.0

Batch requests

US region

Client Libraries

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.

Headers
  • X-Strict-Mode
    enum
    const:  
    1

    When 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 more

    values
    • 1
Body
application/json
  • batch
    Type: array

    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.

      • active
        Type: 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.

      • campaign
        Type: object

        Contains information about the campaign that resulted in the API call, gathered from, or mapping to, UTM parameters (e.g. utm_source).

      • channel
        Type: stringenum

        The channel the event originated from.

        values
        • browser
        • server
        • mobile
      • ip
        Type: 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).

      • locale
        Type: string

        The locale string for the current user, e.g. en-US.

      • page
        Type: object

        Contains information about the current page in the browser. This is automatically collected by our JavaScript source.

      • userAgent
        Type: string

        The user agent of the device making the request

  • integrations
    Type: object

    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": false to reverse this behavior.

Responses
  • 200

    A successful request returns an empty object response.

Request Example for post/batch
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
  }
}'
No Body