> For the complete documentation index, see [llms.txt](https://docs.opinion.trade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.opinion.trade/developer-guide/opinion-open-api/order.md).

# Order

User order list and order detail (authenticated). `OrderData` includes optional `postOnly` for limit orders.

## 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). `OrderData` includes optional `postOnly` for limit orders."}],"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"]},"tradingUnit":{"type":"integer","description":"Trading unit: 1=quote, 2=shares. Indicates which side was user-specified when the order was placed.","enum":[1,2]},"tradingUnitEnum":{"type":"string","description":"Human-readable trading unit. `quote` means the user specified quote-token amount; `shares` means the user specified shares quantity.","enum":["quote","shares"]},"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 (base token). Always expressed in shares regardless of tradingUnit."},"orderAmount":{"type":"string","description":"Total amount in order (quote token). Always expressed in quote-token amount regardless of tradingUnit."},"filledShares":{"type":"string","description":"Filled shares (base token)"},"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)"},"postOnly":{"type":"boolean","description":"Optional. Post-only mode for limit orders (default false). When true on place-order, the order must rest as maker; if it would cross the spread it is cancelled (comment: post-only order would cross the spread). Market orders with postOnly=true are rejected with code 10610."},"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). `OrderData` includes optional `postOnly` for limit orders."}],"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"]},"tradingUnit":{"type":"integer","description":"Trading unit: 1=quote, 2=shares. Indicates which side was user-specified when the order was placed.","enum":[1,2]},"tradingUnitEnum":{"type":"string","description":"Human-readable trading unit. `quote` means the user specified quote-token amount; `shares` means the user specified shares quantity.","enum":["quote","shares"]},"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 (base token). Always expressed in shares regardless of tradingUnit."},"orderAmount":{"type":"string","description":"Total amount in order (quote token). Always expressed in quote-token amount regardless of tradingUnit."},"filledShares":{"type":"string","description":"Filled shares (base token)"},"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)"},"postOnly":{"type":"boolean","description":"Optional. Post-only mode for limit orders (default false). When true on place-order, the order must rest as maker; if it would cross the spread it is cancelled (comment: post-only order would cross the spread). Market orders with postOnly=true are rejected with code 10610."},"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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
