Patch Market Status
Description
Transition a spot market between listed, halted, and delisted states.
Admin only. Requires the ADMIN_API_KEY environment variable to be set on the server and passed as X-API-Key in the request header.
Critical — delist behavior: Setting
status="delisted"first drains the order book (cancels every resting order with refund) via acancel_marketengine call, and only then flips the status in the database. This ensures all locked balances are returned to users before the market is marked terminal. After delist, any new order placement is rejected with410 MARKET_DELISTED. This operation is irreversible — there is no transition back fromdelisted.
See Market Status enum for the full state table.
HTTP Request
PATCH /admin/spot/markets/:id/status (X-API-Key: ADMIN_API_KEY)
:id is the market identifier (e.g. DFUSDT). Case-sensitive.
Weight
0 — admin endpoints have no weight limit. Each market mutation pings the engine with a ReloadMarket command so the in-memory MarketCache picks up the change without restart.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
status | ENUM | YES | Target market status. Must be one of listed, halted, delisted. See Market Status. |
Response Example
200 OK
{
"ok": true,
"id": "DFUSDT",
"status": "halted"
}
| Field | Notes |
|---|---|
ok | Always true on success. |
id | The market id that was updated, echoed back. |
status | The new market status as applied. |
Error Responses
| HTTP | error | When |
|---|---|---|
400 | INVALID_STATUS | status is not one of listed, halted, delisted. |
500 | DB_ERROR | Unexpected Postgres error during the update. Investigate server logs. |
Full list: Error Codes.
Code Examples
cURL
ADMIN_API_KEY="your_admin_api_key"
MARKET_ID="DFUSDT"
# Halt a market (pause trading, resting orders stay on the book)
curl -s -X PATCH "https://api-sepolia.p99.world/api/v1/admin/spot/markets/${MARKET_ID}/status" \
-H "X-API-Key: ${ADMIN_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"status": "halted"}'
# Delist a market (drains the book first, then marks terminal)
curl -s -X PATCH "https://api-sepolia.p99.world/api/v1/admin/spot/markets/${MARKET_ID}/status" \
-H "X-API-Key: ${ADMIN_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"status": "delisted"}'
Python
import requests
ADMIN_API_KEY = "your_admin_api_key"
BASE_URL = "https://api-sepolia.p99.world/api/v1"
def set_market_status(market_id: str, status: str) -> dict:
r = requests.patch(
f"{BASE_URL}/admin/spot/markets/{market_id}/status",
json={"status": status},
headers={"X-API-Key": ADMIN_API_KEY, "Content-Type": "application/json"},
timeout=10, # delist may take longer due to book drain
)
r.raise_for_status()
return r.json()
# Halt trading
result = set_market_status("DFUSDT", "halted")
print(result["ok"], result["id"], result["status"])
# Delist (irreversible — drains book first)
result = set_market_status("DFUSDT", "delisted")
print(result["ok"], result["id"], result["status"])