---
url: https://talkjs.com/docs/REST_API/Batch
---

# Batch

Send multiple REST API operations in a single call.

Ask a question Copy for LLM [View as Markdown](/docs/REST_API/Batch.md)

POST /v1/{appId}/batch

You can use the batch endpoint to perform multiple operations with a single REST call. You can include a maximum of 10 operations in a single batch request.

For batch requests, the [REST API rate limits](/docs/REST_API/Rate_Limits/) support 50 burst requests, 10 maximum queue length, and 1 batch request per second.

Replace `{appId}` in the baseUrl with your own App ID, which you can find under **Settings** in your [TalkJS dashboard](/dashboard).

## Payload

The payload is an array of operations. Each operation has the format:

```typescript
[sequence_number, method, path, payload, options]
```

| Name | Type | Description | Example |
| --- | --- | --- | --- |
| **sequence_number** | `number` | Unique identifier of the operation. Can be any number. | `1` |
| **method** | `string` | Indicates the HTTP method for the operation. | `GET` |
| **path** | `string` | Path of the REST API endpoint for the operation that's appended to the `/v1/{appId}` baseUrl. | `/users/user_01` |
| **payload** (*optional*) | `object` | JSON payload. You can use this for PUT and POST requests to specify the payload associated with the REST API operation. You can also use it with string keys and values to specify query parameters to filter results of a GET request. | `{ name: "Alice" }` |
| **options** (*optional*) | `object` | Mapping containing the key `api_version`, and a string value with the API version. | `{"api_version": "2021-01-01"}` |

POST /v1/{appId}/batch

Payload Structure Example Payload

```typescript
type Operation = [
  sequence_number: number,
  method: string,
  path: string,
  payload?: any,
  options?: {"api_version": string}
]

type Payload = Operation[];
```

The operations may execute in a different order than the one specified in the
request. If you have operations that need to happen in a certain order (for
example, first creating a user and then setting them as a participant to a
conversation), then you need to request those in separate calls.

## Response

The response will be an array of operation responses. Each operation response has the format:

```typescript
[sequence_number, http_status_code, operation_response]
```

| Name | Type | Description | Example |
| --- | --- | --- | --- |
| **sequence_number** | `number` | Unique identifier of the operation. Corresponds to the `sequence_number` in the request. | `1` |
| **http_status_code** | `number` | Numeric HTTP status code for the REST operation. | `200` |
| **operation_response** | `string` | The JSON data returned by the REST operation. | `[{"id": "msg_1821ZuPQL8tqKUWqXp8YDF"}]` |

POST /v1/{appId}/batch

Response Structure Example Response

```typescript
type OperationResponse = [
  sequence_number: number,
  http_status_code: number,
  operation_response: any
]

type Response = OperationResponse[];
```