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

> 41 revisions in range; 11 could not be searched.

- **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)
