Orders
The Orders API allows you to create, cancel, and manage orders on the Xmarket platform.
123
123
1
50
buy
Possible values: limit
Possible values: open
Possible values: 2026-09-30T12:00:00Z
public_api
Possible values: Order created
Bad request
Not found
Internal server error
POST /openapi/v1/order HTTP/1.1
Host:
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 164
{
"marketId": "123",
"outcomeId": "123",
"quantity": 1,
"price": 50,
"side": "buy",
"type": "limit",
"status": "open",
"expiredAt": "2026-09-30T12:00:00Z",
"createdBy": "public_api"
}
No content
Authentication
All order operations require authentication using your API key in the x-api-key header:
x-api-key: YOUR_API_KEY
Cancel Order
Cancel an existing open order.
a1b2c3d4-5678-90ab-cdef-1234567890ab
Order cancelled
Bad request
Order not found
Internal server error
DELETE /openapi/v1/order/{orderId} HTTP/1.1
Host:
x-api-key: YOUR_API_KEY
Accept: */*
{
"success": true,
"message": "text",
"order": null
}
Cancel All Orders
Cancel all open orders for a specific market.
44a64332-5304-4340-93b4-5ebae21c7b54
All market orders cancelled
Bad request
No open orders found
Internal server error
DELETE /openapi/v1/order/cancel-all/{marketId} HTTP/1.1
Host:
x-api-key: YOUR_API_KEY
Accept: */*
{
"success": true,
"message": "text",
"count": 1
}
Get My Orders
Retrieve your orders with pagination and filtering options.
1
Example: 1
20
Example: 20
open
Possible values: limit
Possible values: buy
Possible values: My orders
Bad request
Internal server error
GET /openapi/v1/order/my-orders HTTP/1.1
Host:
x-api-key: YOUR_API_KEY
Accept: */*
{
"data": [
{
"id": "text",
"marketId": "text",
"outcomeId": "text",
"quantity": "text",
"filledQuantity": "text",
"price": "text",
"side": "buy",
"type": "market",
"status": "text",
"expiredAt": "text",
"createdAt": "text",
"updatedAt": "text"
}
],
"page": 1,
"pageSize": 1,
"total": 1,
"totalPages": 1
}
Order Types
Limit Orders
Execute at a specific price or better
May not fill immediately
Provide liquidity to the market
Market Orders
Execute immediately at best available price
Guaranteed to fill (if liquidity exists)
Take liquidity from the market
Order Status
Orders can have the following statuses:
open
Order is active and waiting to be filled
partially_filled
Some quantity has been filled
filled
Order completely executed
cancelled
Order cancelled by user
expired
Order expired based on expiredAt time
Best Practices
Order Validation: Always validate order parameters before submission
Error Handling: Implement robust error handling for all API calls
Rate Limiting: Respect API rate limits to avoid being throttled
Order Management: Track your open orders and cancel outdated ones
Price Checks: Verify prices are within valid range (0 < price < 1)
Signature Security: Never expose your private key; sign orders securely
Related Documentation
Quick Start - Get started with the API
Last updated
Was this helpful?