# Batch order

The [Pacifica Python SDK](https://github.com/pacifica-fi/python-sdk/blob/f2385d42e9ae5276ba2ba85505d51db2eefd2715/rest/batch_orders.py) provides a comprehensive example on using this endpoint

### Request

```json
{
  "id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
  "params": {
    "batch_orders": {
      "actions": [
        {
          "type": "Create",
          "data": {
            "account": "42trU9A5...",
            "signature": "5UpRZ14Q...",
            "timestamp": 1749190500355,
            "expiry_window": 5000,
            "symbol": "BTC",
            "price": "100000",
            "reduce_only": false,
            "amount": "0.1",
            "side": "bid",
            "tif": "GTC",
            "client_order_id": "57a5efb1-bb96-49a5-8bfd-f25d5f22bc7e"
          }
        },
        {
          "type": "CreateMarket",
          "data": {
            "account": "42trU9A5...",
            "signature": "3KxMn7pQ...",
            "timestamp": 1749190500355,
            "expiry_window": 5000,
            "symbol": "ETH",
            "amount": "1.0",
            "side": "ask",
            "slippage_percent": "0.5",
            "reduce_only": false
          }
        },
        {
          "type": "Cancel",
          "data": {
            "account": "42trU9A5...",
            "signature": "4NDFHyTG...",
            "timestamp": 1749190500355,
            "expiry_window": 5000,
            "symbol": "SOL",
            "order_id": 42069
          }
        }
      ]
    }
  }
}
```

<table><thead><tr><th width="118">Field</th><th width="98">Type</th><th width="95">Need</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><code>"id"</code></td><td>Full UUID string</td><td>required</td><td>Client-defined request ID</td><td>660065de-8f32-46ad-ba1e-83c93d3e3966</td></tr><tr><td><code>"actions"</code></td><td>array</td><td>required</td><td>List of order actions to perform<br><br>Each action has an "type" field and action-specific "data"</td><td>See next two rows</td></tr><tr><td><code>"type"</code></td><td>string</td><td>required</td><td>Specifies type of action. This is DIFFERENT to the "type" used in signature headers</td><td><p><code>"Create"</code><br><code>"CreateMarket"</code><br><code>"Cancel"</code><br><code>"Edit"</code><br><code>"SetPositionTpsl"</code><br><code>"CancelStopOrder"</code></p><p><br>(case sensitive)</p></td></tr><tr><td><code>"data"</code></td><td>object</td><td>required</td><td>Contains signed request payloads of individual actions. Fields are identical to the corresponding standalone endpoints: create limit order, create market order, cancel order, edit order, create position TP/SL, and cancel stop order.</td><td>See code block below. Messages and corresponding fields are identical to <a href="/pages/E8AlCQTQEITCtG70REDL">create</a> and <a href="/pages/6jizOorckUX6CO02Lmh0">cancel</a> requests.</td></tr></tbody></table>

#### Response

* Status 200: Batch operations processed successfully

```json
{
  "code": 200,
  "data": {
    "results": [
      {
        "success": true,
        "order_id": 645953,
        "client_order_id": "57a5efb1-bb96-49a5-8bfd-f25d5f22bc7e",
        "symbol": "BTC"
      },
      {
        "success": true,
        "order_id": 645954,
        "symbol": "ETH"
      }
    ]
  },
  "id": "660065de-8f32-46ad-ba1e-83c93d3e3966",
  "t": 1749223025962,
  "type": "batch_orders"
}
```

* Status 400: Bad request

```json
  {
    "error": "Invalid batch operation parameters",
    "code": 400
  }
```

* Status 500: Internal server error

### Notes on Batch Ordering:

#### Speed Bump (Latency Protection)

Batch orders are subject to a conditional randomized 50-100ms delay to protect liquidity providers from adverse selection:\
\
Speed bump is applied if the batch contains:

* Market orders (CreateMarket)
* Limit orders with TIF = GTC or IOC

Speed bump is NOT applied if the batch only contains:

* Add Liquidity Only orders (TIF = ALO)
* Top of Book orders (TIF = TOB)
* Cancel operations
* TP/SL operations

#### Signature Requirements

* Each action in the batch must be individually signed
* All signatures must be valid for the batch to process

#### Execution Behavior and Limits

* Maximum 10 actions per batch request
* Actions are executed atomically in the order provided
* If one action fails, subsequent actions are still attempted


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pacifica.gitbook.io/docs/api-documentation/api/websocket/trading-operations/batch-order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
