---
title: "Batch multiple API endpoints into one request."
method: POST
path: "/v1/batch"
---

# Batch multiple API endpoints into one request.

`POST /v1/batch`

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

## Request body

- BatchContext
  - `operations` BatchOperation[], required — Array of requests to Agent endpoints, batched into one request
    - `method` 'GET' | 'POST' — The REST request method
    - `url` string — The base and endpoint components of the API request's path
    - `operationID` string — Index of the request in the batch
    - `body` object — The body for the request as JSON
    - `parameters` object — The parameters for the request as JSON
    - `headers` object — The headers for the request as JSON

## Response `200`

responses for each endpoint called in the batch request

- BatchResponse
  - `startedAt` string
  - `endedAt` string
  - `errorCount` integer
  - `response` BatchResponseItem[]
    - `status` 200 | 400
    - `requestID` string
    - `operationID` string
    - `method` 'GET' | 'POST'
    - `url` string
    - `body` union
      - object[]
      - object
    - `startedAt` string
    - `endedAt` string

## Other responses

- `400` — Bad request, invalid parameters.
- `422` — Unprocessable Entity, too many operations

## Changes

- **2023-05-22** `b03cfe30eb69` — 9 breaking, 3 info
  - the request's body type/format changed from ``/`` to `object`/``
  - added `#/components/schemas/Method, subschema #2` to the `operations/items/method` request property `allOf` list
  - removed the enum value `GET` of the request property `operations/items/method`
  - removed the enum value `POST` of the request property `operations/items/method`
  - …8 more
- **2020-10-09** `6fa4abcfe406` — 1 breaking
  - response property `response/items/body` list-of-types was widened by adding types `array` to media type `application/json` of response `200`
- **2020-09-21** `f3aa04ce6d4a` — 1 info
  - endpoint added
- **2019-08-29** `6933bf16666a` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/optimizely/apis/optimizely-agent-api/changes/v1/batch/post.md)

---

[API](https://skmtc.dev/optimizely/apis/optimizely-agent-api.md) · [All operations](https://skmtc.dev/optimizely/apis/optimizely-agent-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/optimizely/optimizely-agent-api/revisions/8aa6750d4b77/schema)
