Pacifica
  • Getting Started
    • Closed Alpha Guide
      • Link To Guide PDF
    • Closed Alpha Trading Competition
  • Trading on Pacifica
    • Overview
    • Contract Specifications
      • Oracle Price & Mark Price
      • Settlement Mechanism
    • Order Types
      • Market Order
      • Limit Order
      • Order Rules & Constraints
    • Margin & Leverage
    • Funding Rates
    • Liquidations
  • API Documentation
    • API
      • REST API
        • Markets
          • Get market info
          • Get prices
          • Get kline (candle) data
          • Get recent trades
        • Account
          • Get account info
          • Get account settings
          • Update leverage
          • Update margin mode
          • Get positions
          • Get trade history
          • Get funding history
          • Get account equity history
          • Request withdrawal
        • Subaccounts
          • Create subaccount
          • Subaccount fund transfer
        • Orders
          • Get open orders
          • Get order history
          • Get order history by ID
          • Create order
          • Create stop order
          • Create position TP/SL
          • Cancel order
          • Cancel all orders
          • Cancel stop order
          • Batch order
      • Websocket
        • Subscriptions
          • Prices
          • Orderbook
          • Trades
          • Candle
          • Order updates
          • Account balance
          • Account margin
          • Account leverage
          • Account positions
          • Account orders
          • Account order updates
          • Account trades
        • Trading operations
          • Create order
          • Cancel order
          • Cancel all orders
      • Signing
        • Implementation
        • Operation Types
        • Error Handling
      • Rate limits
      • Tick and lot size
    • Specification
  • Other
    • Audits
    • Brand Assets
    • Contact Us
    • Glossary of Terms
Powered by GitBook
On this page
  1. API Documentation
  2. API
  3. REST API
  4. Orders

Batch order

This endpoint allows users to submit multiple order operations in a single request. Batched orders are executed in the order they are batched in, and will not be split up by other users' orders.

PreviousCancel stop orderNextWebsocket

Last updated 15 hours ago

The provides a comprehensive example on using this endpoint

POST /api/v1/orders/batch

Request Body

Field
Type
Need
Description
Example

"actions"

array

required

List of order actions to perform Each action has an "type" field and action-specific "data"

See next three rows

"type"

string

required

Specifies type of action. This is DIFFERENT to the "type" used in signature headers

"Create" "Cancel"

(case sensitive)

"data"

object

required

Contains signed request payloads of individual "Create" or "Cancel" actions

{
   "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":"Cancel",
         "data":{
            "account":"42trU9A5...",
            "signature":"4NDFHyTG...",
            "timestamp":1749190500355,
            "expiry_window":5000,
            "symbol":"BTC",
            "order_id":42069
         }
      }
   ]
}

Response

  • Status 200: Batch operations processed successfully

{
  "success": true,
  "data": {
    "results": [
      {
        "success": true,
        "order_id": 470506,
        "error": null
      },
      {
        "success": true,
      }
    ]
  },
    "error": null,
    "code": null
}
  • Status 400: Bad request

  {
    "error": "Invalid batch operation parameters",
    "code": 400
  }
  • Status 500: Internal server error

Code Example (Python)

import requests

payload = {
    "account": "42trU9A5...",
    "signature": "5j1Vy9Uq...",
    "timestamp": 1716200000000,
    "operations": [
        {
            "op": "create",
            "symbol": "BTC",
            "price": "50000",
            "amount": "0.1",
            "side": "bid",
            "tif": "GTC",
            "reduce_only": False,
            "client_order_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
        },
        {
            "op": "cancel",
            "symbol": "ETH",
            "order_id": 456
        }
    ]
}

response = requests.post(
    "/api/v1/orders/batch",
    json=payload,
    headers={"Content-Type": "application/json"}
)

data = response.json()

See code block below. Messages and corresponding fields are identical to and requests.

Pacifica Python SDK
create
cancel