Skip to main content

Cancel All Orders

Description

Cancel every open or partially-filled order belonging to the caller, optionally scoped to a single market. Only the caller's own orders are affected — other users' resting orders on the same market are untouched.

HTTP Request

DELETE /spot/orders (JWT or API Key)

Weight

0 — order endpoints are not subject to per-IP weight limits. A per-engine mpsc backlog is enforced; on overflow the response is 503 ENGINE_BUSY.

Request Parameters

NameTypeRequiredDescription
symbolSTRINGNOMarket id (e.g. DFUSDT). Omit to cancel across all markets the caller has open orders on. Case-sensitive.

Response Example

200 OK

{
"canceled": [
{
"id": "9f2a1c4e-5b67-4d8a-bf93-2e1f4a6c8d10",
"symbol": "DFUSDT",
"side": "buy",
"type": "limit",
"tif": "gtc",
"price": "0.5000",
"quantity": "100",
"quote_quantity": null,
"filled_qty": "0",
"avg_fill_price": "0",
"status": "canceled",
"reject_reason": null,
"created_at": 1778400000,
"updated_at": 1778400300
},
{
"id": "a1b2c3d4-1234-5678-abcd-ef0123456789",
"symbol": "DFUSDT",
"side": "sell",
"type": "limit",
"tif": "gtc",
"price": "0.6000",
"quantity": "200",
"quote_quantity": null,
"filled_qty": "50",
"avg_fill_price": "0.6000",
"status": "canceled",
"reject_reason": null,
"created_at": 1778400060,
"updated_at": 1778400300
}
]
}
FieldNotes
canceledArray of every order that was transitioned to canceled by this request. Orders already in a terminal state (filled / canceled / rejected) are silently skipped and not included.
statusAlways canceled for every item in the array. See Order Status.
filled_qtyAmount filled before the cancel; may be non-zero for partially-filled orders.
created_at, updated_atUnix seconds. updated_at reflects the cancellation time.

Note: An empty canceled array ({"canceled": []}) is a valid successful response if the caller has no open or partially-filled orders (or none matching the given symbol).

Error Responses

HTTPerrorWhen
503ENGINE_BUSY, ENGINE_RESTARTING, spot trading disabledTransient; retry with backoff.

Full list: Error Codes.

Code Examples

cURL (JWT)

JWT="your_jwt_token"

# Cancel all open orders across all markets
curl -s -X DELETE "https://api-sepolia.p99.world/api/v1/spot/orders" \
-H "Authorization: Bearer ${JWT}"

# Cancel only DFUSDT orders
curl -s -X DELETE "https://api-sepolia.p99.world/api/v1/spot/orders?symbol=DFUSDT" \
-H "Authorization: Bearer ${JWT}"

cURL (HMAC API Key)

API_KEY="your_api_key"
API_SECRET="your_api_secret"
TIMESTAMP=$(date +%s%3N)
QUERY="symbol=DFUSDT&timestamp=${TIMESTAMP}"
SIGNATURE=$(echo -n "${QUERY}" | openssl dgst -sha256 -hmac "${API_SECRET}" | awk '{print $2}')

curl -s -X DELETE \
-H "X-MBX-APIKEY: ${API_KEY}" \
"https://api-sepolia.p99.world/api/v1/spot/orders?${QUERY}&signature=${SIGNATURE}"

Python

import time, hmac, hashlib, requests
from urllib.parse import urlencode

API_KEY = "your_api_key"
API_SECRET = "your_api_secret"
BASE_URL = "https://api-sepolia.p99.world/api/v1"

def signed_delete(path: str, params: dict = None) -> dict:
ts = int(time.time() * 1000)
qs_params = {**(params or {}), "timestamp": ts}
qs = urlencode(qs_params)
sig = hmac.new(API_SECRET.encode(), qs.encode(), hashlib.sha256).hexdigest()
r = requests.delete(
f"{BASE_URL}{path}?{qs}&signature={sig}",
headers={"X-MBX-APIKEY": API_KEY},
timeout=10,
)
r.raise_for_status()
return r.json()

# Cancel all open orders scoped to DFUSDT
result = signed_delete("/spot/orders", {"symbol": "DFUSDT"})
print(f"Canceled {len(result['canceled'])} orders")
for o in result["canceled"]:
print(f" {o['id']} {o['side']:4} {o['quantity']} @ {o['price']} filled={o['filled_qty']}")