v1

latestOpenAPI 3.1.0Apache 2.02026-07-17113629.5 KB

Batch multiple API endpoints into one request.

You can use the Batch endpoint to do things like

  1. Make activate decisions for a batch of users in a short timeframe for testing purposes
  2. Gather responses from a bunch of activate calls into one response for comparison or analysis
post/v1/batch

Request body

Example request

{
  "operations": [
    {
      "method": "POST",
      "url": "/v1/activate",
      "operationID": "1",
      "body": {
        "userId": "user1"
      },
      "parameters": {
        "type": "feature",
        "experimentKey": "ab_test_experiment"
      },
      "headers": {
        "X-Optimizely-SDK-Key": "<sdk_key>",
        "Content-Type": "application/json"
      }
    }
  ]
}

Response

responses for each endpoint called in the batch request

startedAtstring
endedAtstring
errorCountinteger

Example response

{
  "response": [
    {
      "status": 200,
      "requestID": "abee6bdf-6d14-4fac-8357-769f5fd07e7c",
      "operationID": "1",
      "method": "POST",
      "url": "/v1/activate",
      "body": [
        {
          "enabled": true,
          "experimentKey": "new_feature_test",
          "featureKey": "new_feature",
          "type": "feature",
          "userId": "user1",
          "variables": {
            "bool_var": true,
            "double_var": 5.6,
            "int_var": 1
          },
          "variationKey": "variation_2"
        },
        {
          "enabled": false,
          "experimentKey": "flag_test_2",
          "featureKey": "test_feature",
          "type": "feature",
          "userId": "user1",
          "variables": {
            "double": 0,
            "json_key": {}
          },
          "variationKey": ""
        }
      ],
      "startedAt": "2020-09-10T10:50:37.466121-07:00",
      "endedAt": "2020-09-10T10:50:37.466192-07:00"
    }
  ]
}