# Order

User order list and order detail (authenticated)

## Get orders

> Get the authenticated user's orders with optional filters. Supports pagination and status filter (numeric or comma-separated, e.g. "1,2,3"). Status 1=pending, 2=filled, 3=canceled, 4=expired, 5=failed.

```json
{"openapi":"3.0.3","info":{"title":"OPINION Prediction Market OpenAPI","version":"1.0.0"},"tags":[{"name":"Order","description":"User order list and order detail (authenticated)"}],"servers":[{"url":"https://openapi.opinion.trade/openapi","description":"Production server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"apikey","description":"API key for authentication"}},"schemas":{"APIBaseResponse":{"type":"object","properties":{"code":{"type":"integer","description":"Response code (0 for success)"},"msg":{"type":"string","description":"Response message"},"result":{"type":"object","description":"Response data"}}},"OrderListResponse":{"type":"object","properties":{"total":{"type":"integer","format":"int64","description":"Total number of orders"},"list":{"type":"array","items":{"$ref":"#/components/schemas/OrderData"},"description":"List of orders"}}},"OrderData":{"type":"object","description":"Order record (list item or detail; detail includes trades)","properties":{"orderId":{"type":"string","description":"Order ID (transaction number)"},"transNo":{"type":"string","description":"Deprecated; use orderId instead"},"status":{"type":"integer","description":"Order status: 1=pending, 2=filled, 3=canceled, 4=expired, 5=failed","enum":[1,2,3,4,5]},"statusEnum":{"type":"string","description":"Human-readable status","enum":["Pending","Finished","Canceled","Expired","Failed"]},"marketId":{"type":"integer","format":"int64","description":"Market ID"},"marketTitle":{"type":"string","description":"Market title"},"rootMarketId":{"type":"integer","format":"int64","description":"Root market ID"},"rootMarketTitle":{"type":"string","description":"Root market title"},"side":{"type":"integer","description":"Side: 1=buy, 2=sell","enum":[1,2]},"sideEnum":{"type":"string","description":"Human-readable side","enum":["Buy","Sell"]},"tradingMethod":{"type":"integer","description":"Trading method: 1=market, 2=limit"},"tradingMethodEnum":{"type":"string","description":"Human-readable trading method","enum":["Market","Limit"]},"outcome":{"type":"string","description":"Outcome label"},"outcomeSide":{"type":"integer","description":"Outcome side: 1=yes, 2=no","enum":[1,2]},"outcomeSideEnum":{"type":"string","description":"Human-readable outcome side","enum":["Yes","No"]},"price":{"type":"string","description":"Price per share (for limit orders)"},"orderShares":{"type":"string","description":"Total shares in order"},"orderAmount":{"type":"string","description":"Total amount in order (quote token)"},"filledShares":{"type":"string","description":"Filled shares"},"filledAmount":{"type":"string","description":"Filled amount (quote token)"},"profit":{"type":"string","description":"Profit/loss"},"quoteToken":{"type":"string","description":"Quote token address"},"createdAt":{"type":"integer","format":"int64","description":"Creation timestamp (milliseconds)"},"expiresAt":{"type":"integer","format":"int64","description":"Expiration timestamp (milliseconds)"},"trades":{"type":"array","items":{"$ref":"#/components/schemas/OrderTradeData"},"description":"Related trades (only present in order detail response)"}}},"OrderTradeData":{"type":"object","description":"Trade record within an order detail","properties":{"orderNo":{"type":"string","description":"Order number"},"tradeNo":{"type":"string","description":"Trade number"},"txHash":{"type":"string","description":"Transaction hash"},"marketId":{"type":"integer","format":"int64"},"marketTitle":{"type":"string"},"rootMarketId":{"type":"integer","format":"int64"},"rootMarketTitle":{"type":"string"},"side":{"type":"string"},"outcome":{"type":"string"},"outcomeSide":{"type":"integer","enum":[1,2]},"outcomeSideEnum":{"type":"string","enum":["Yes","No"]},"price":{"type":"string"},"shares":{"type":"string"},"amount":{"type":"string"},"fee":{"type":"integer","format":"int64","description":"Fee in wei"},"feeFormatted":{"type":"string","description":"Human-readable fee"},"profit":{"type":"string"},"quoteToken":{"type":"string"},"quoteTokenUsdPrice":{"type":"string"},"usdAmount":{"type":"string"},"status":{"type":"integer"},"statusEnum":{"type":"string"},"chainId":{"type":"string"},"createdAt":{"type":"integer","format":"int64"}}}},"responses":{"BadRequestError":{"description":"Bad request - invalid parameters","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/APIBaseResponse"},{"type":"object","properties":{"code":{},"msg":{}}}]}}}}}},"paths":{"/order":{"get":{"tags":["Order"],"summary":"Get orders","description":"Get the authenticated user's orders with optional filters. Supports pagination and status filter (numeric or comma-separated, e.g. \"1,2,3\"). Status 1=pending, 2=filled, 3=canceled, 4=expired, 5=failed.","operationId":"getOrderList","parameters":[{"name":"page","in":"query","description":"Page number","schema":{"type":"integer","default":1,"minimum":1}},{"name":"limit","in":"query","description":"Number of items per page (max 20)","schema":{"type":"integer","default":10,"maximum":20}},{"name":"marketId","in":"query","description":"Market ID filter","schema":{"type":"integer","format":"int64"}},{"name":"chainId","in":"query","description":"Chain ID filter","schema":{"type":"string"}},{"name":"status","in":"query","description":"Order status filter: single value (1-5) or comma-separated (e.g. 1,2,3). 1=pending, 2=filled, 3=canceled, 4=expired, 5=failed","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/APIBaseResponse"},{"type":"object","properties":{"result":{"$ref":"#/components/schemas/OrderListResponse"}}}]}}}},"400":{"$ref":"#/components/responses/BadRequestError"}}}}}}
```

## Get order detail

> Get order detail by order ID for the authenticated user, including related trades.

```json
{"openapi":"3.0.3","info":{"title":"OPINION Prediction Market OpenAPI","version":"1.0.0"},"tags":[{"name":"Order","description":"User order list and order detail (authenticated)"}],"servers":[{"url":"https://openapi.opinion.trade/openapi","description":"Production server"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"apikey","description":"API key for authentication"}},"schemas":{"APIBaseResponse":{"type":"object","properties":{"code":{"type":"integer","description":"Response code (0 for success)"},"msg":{"type":"string","description":"Response message"},"result":{"type":"object","description":"Response data"}}},"OrderDetailResponse":{"type":"object","description":"Order detail response (includes orderData with trades)","properties":{"orderData":{"$ref":"#/components/schemas/OrderData"}}},"OrderData":{"type":"object","description":"Order record (list item or detail; detail includes trades)","properties":{"orderId":{"type":"string","description":"Order ID (transaction number)"},"transNo":{"type":"string","description":"Deprecated; use orderId instead"},"status":{"type":"integer","description":"Order status: 1=pending, 2=filled, 3=canceled, 4=expired, 5=failed","enum":[1,2,3,4,5]},"statusEnum":{"type":"string","description":"Human-readable status","enum":["Pending","Finished","Canceled","Expired","Failed"]},"marketId":{"type":"integer","format":"int64","description":"Market ID"},"marketTitle":{"type":"string","description":"Market title"},"rootMarketId":{"type":"integer","format":"int64","description":"Root market ID"},"rootMarketTitle":{"type":"string","description":"Root market title"},"side":{"type":"integer","description":"Side: 1=buy, 2=sell","enum":[1,2]},"sideEnum":{"type":"string","description":"Human-readable side","enum":["Buy","Sell"]},"tradingMethod":{"type":"integer","description":"Trading method: 1=market, 2=limit"},"tradingMethodEnum":{"type":"string","description":"Human-readable trading method","enum":["Market","Limit"]},"outcome":{"type":"string","description":"Outcome label"},"outcomeSide":{"type":"integer","description":"Outcome side: 1=yes, 2=no","enum":[1,2]},"outcomeSideEnum":{"type":"string","description":"Human-readable outcome side","enum":["Yes","No"]},"price":{"type":"string","description":"Price per share (for limit orders)"},"orderShares":{"type":"string","description":"Total shares in order"},"orderAmount":{"type":"string","description":"Total amount in order (quote token)"},"filledShares":{"type":"string","description":"Filled shares"},"filledAmount":{"type":"string","description":"Filled amount (quote token)"},"profit":{"type":"string","description":"Profit/loss"},"quoteToken":{"type":"string","description":"Quote token address"},"createdAt":{"type":"integer","format":"int64","description":"Creation timestamp (milliseconds)"},"expiresAt":{"type":"integer","format":"int64","description":"Expiration timestamp (milliseconds)"},"trades":{"type":"array","items":{"$ref":"#/components/schemas/OrderTradeData"},"description":"Related trades (only present in order detail response)"}}},"OrderTradeData":{"type":"object","description":"Trade record within an order detail","properties":{"orderNo":{"type":"string","description":"Order number"},"tradeNo":{"type":"string","description":"Trade number"},"txHash":{"type":"string","description":"Transaction hash"},"marketId":{"type":"integer","format":"int64"},"marketTitle":{"type":"string"},"rootMarketId":{"type":"integer","format":"int64"},"rootMarketTitle":{"type":"string"},"side":{"type":"string"},"outcome":{"type":"string"},"outcomeSide":{"type":"integer","enum":[1,2]},"outcomeSideEnum":{"type":"string","enum":["Yes","No"]},"price":{"type":"string"},"shares":{"type":"string"},"amount":{"type":"string"},"fee":{"type":"integer","format":"int64","description":"Fee in wei"},"feeFormatted":{"type":"string","description":"Human-readable fee"},"profit":{"type":"string"},"quoteToken":{"type":"string"},"quoteTokenUsdPrice":{"type":"string"},"usdAmount":{"type":"string"},"status":{"type":"integer"},"statusEnum":{"type":"string"},"chainId":{"type":"string"},"createdAt":{"type":"integer","format":"int64"}}}},"responses":{"BadRequestError":{"description":"Bad request - invalid parameters","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/APIBaseResponse"},{"type":"object","properties":{"code":{},"msg":{}}}]}}}}}},"paths":{"/order/{orderId}":{"get":{"tags":["Order"],"summary":"Get order detail","description":"Get order detail by order ID for the authenticated user, including related trades.","operationId":"getOrderDetail","parameters":[{"name":"orderId","in":"path","required":true,"description":"Order ID (transaction number)","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/APIBaseResponse"},{"type":"object","properties":{"result":{"$ref":"#/components/schemas/OrderDetailResponse"}}}]}}}},"400":{"$ref":"#/components/responses/BadRequestError"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.opinion.trade/developer-guide/opinion-open-api/order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
