Batched operations

Some endpoints of the Audience API allow access to multiple users' data with a single HTTP request. These endpoints follow the same convention, described below.

Note that not all endpoints allow batched operations, please refer to the documentation for each endpoint for eligibility and limits.

Getting data

If an Audience API endpoint allows batched GET requests, add user_ids query string parameter containing a comma-separated list of user IDs:

https://<space_domain>/api/audience/profile?user_ids=<user_id_1>,<user_id_2>, ...

A response to a batched GET request will contain a users array, with each element containing an object with a user_id and corresponding data object:

{
  "message": "OK",
  "users": [
    {
      "user_id": "<user_id>",
      "data": { 
        // Data related to the user 
      }
    },
    ...
  ]
}
Compare the above to a conventional single-record response from the same endpoint:
{
  "message": "OK",  
  "data": { 
    // Data related to the user 
  }
}

Updating data

When making a batched POST or PUT request, the body is expected to contain an array of objects, each related to a single user and containing the user_id attribute:

PUT https://<space_domain>/api/audience/profile
[ 
  { 
    "user_id": "<user_id>" 
    "data": { 
      // Data related to the user 
    }
  },
  ...
]

Last updated