---
title: "Batch Request"
method: POST
path: "/api/batch"
tags: ["Batch"]
---

# Batch Request

`POST /api/batch`

## Request

- Base URL: `https://api.agentstack.tech` (the document declares no server; this is the origin it was published from)
- URL: `https://api.agentstack.tech/api/batch`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Выполнить батч запросов

Принимает массив запросов и выполняет их параллельно или последовательно
Возвращает результаты с индексами для сопоставления

Args:
    request: Батч запросов
    request_obj: FastAPI Request для доступа к app
    current_user: Текущий пользователь

Returns:
    BatchResponse с результатами всех запросов

## Headers

- `Idempotency-Key` string

## Request body

- BatchRequest: Батч запросов
  - `requests` BatchRequestItem[], required
    - `id` string, required
    - `method` string, required
    - `url` string, required
    - `headers` object, nullable
    - `body` unknown
    - `params` object, nullable
  - `execute_parallel` boolean

## Response `200`

Successful Response

- BatchResponse: Ответ батча
  - `success` boolean, required
  - `results` BatchResponseItem[], required
    - `id` string, required
    - `status` integer, required
    - `data` unknown, required
    - `error` string, nullable
    - `error_details` object[], nullable
    - `latency_ms` number, nullable: Sub-request latency (ms)
  - `total` integer, required
  - `successful` integer, required
  - `failed` integer, required
  - `diagnostics` object, nullable: Aggregate timing / dedup hints (optional)

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `409`: Conflict
- `422`: Validation Error
- `429`: Too Many Requests
- `500`: Internal Server Error

---

[API](https://skmtc.dev/agentstack/apis/agentstack-core-api.md) · [All operations](https://skmtc.dev/agentstack/apis/agentstack-core-api/llms.txt) · [OpenAPI document](https://skmtc.dev/agentstack/apis/agentstack-core-api/revisions/79f4a4dd8813?raw)
