Cancel order

This endpoint allows users to cancel an existing order.

The Pacifica Python SDK provides a comprehensive example on using this endpoint.

POST /api/v1/orders/cancel

Operation Type (for signing)

Header Field
Type
Content

"type"

string

"cancel_order"

Request Body

Field
Type
Need
Description
Example

"account"

string

required

User's wallet address

42trU9A5...

"signature"

string

required

Cryptographic signature

5j1Vy9Uq...

"timestamp"

integer

required

Current timestamp in milliseconds

1716200000000

"symbol"

string

required

Trading pair symbol

BTC

"order_id"

integer

required (if no CLOID)

Exchange-assigned order ID

123

"client_order_id"

Full UUID string

required (if no OID)

Client-defined order ID

f47ac10b-58cc-4372-a567-0e02b2c3d479

"agent_wallet"

string

optional

Agent wallet address

69trU9A5...

"expiry_window"

integer

optional

Signature expiry in milliseconds

30000

{
  "account": "42trU9A5...",
  "signature": "5j1Vy9Uq...",
  "timestamp": 1716200000000,
  "symbol": "BTC",
  "order_id": 123,
  "agent_wallet": "69trU9A5...",
  "expiry_window": 30000
}

Response

  • Status 200: Order cancelled successfully

  {
    "success": true
  }
  • Status 400: Bad request

  {
    "error": "Order not found",
    "code": 400
  }
  • Status 500: Internal server error

Code Example (Python)

import requests

payload = {
    "account": "42trU9A5...",
    "signature": "5j1Vy9Uq...",
    "timestamp": 1716200000000,
    "symbol": "BTC",
    "order_id": 123
}

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

data = response.json()

Last updated