Orders

The Orders API allows you to create, cancel, and manage orders on the Xmarket platform.

Create a order

post
Authorizations
Body
marketIdstringRequiredExample: 123
outcomeIdstringRequiredExample: 123
quantitynumberRequiredExample: 1
pricenumberRequiredExample: 50
sidestring · enumRequiredExample: buyPossible values:
typestring · enumRequiredExample: limitPossible values:
statusstring · enumRequiredExample: openPossible values:
expiredAtstringOptionalExample: 2026-09-30T12:00:00Z
createdBystring · enumOptionalExample: public_apiPossible values:
Responses
201

Order created

application/json
Responseany | nullable
post
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.

Cancel an order

delete
Authorizations
Path parameters
orderIdstringRequiredExample: a1b2c3d4-5678-90ab-cdef-1234567890ab
Responses
200

Order cancelled

application/json
delete
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.

Cancel all orders for a market

delete
Authorizations
Path parameters
marketIdstringRequiredExample: 44a64332-5304-4340-93b4-5ebae21c7b54
Responses
200

All market orders cancelled

application/json
delete
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.

Get my orders (paginated, filterable)

get
Authorizations
Query parameters
pageinteger · min: 1OptionalDefault: 1Example: 1
pageSizeinteger · min: 1 · max: 100OptionalDefault: 20Example: 20
statusstring · enumOptionalExample: openPossible values:
typestring · enumOptionalExample: limitPossible values:
sidestring · enumOptionalExample: buyPossible values:
Responses
200

My orders

application/json
get
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:

Status
Description

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

  1. Order Validation: Always validate order parameters before submission

  2. Error Handling: Implement robust error handling for all API calls

  3. Rate Limiting: Respect API rate limits to avoid being throttled

  4. Order Management: Track your open orders and cancel outdated ones

  5. Price Checks: Verify prices are within valid range (0 < price < 1)

  6. Signature Security: Never expose your private key; sign orders securely

Last updated

Was this helpful?