> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://okx-demo.ferndocs.com/api/api-reference/trade/get-order-list/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://okx-demo.ferndocs.com/_mcp/server. # Get order list GET https://www.okx.com/api/v5/trade/orders-pending Retrieve all incomplete orders under the current account. Reference: https://okx-demo.ferndocs.com/api/api-reference/trade/get-order-list ## Authentication - `OK-ACCESS-KEY` header (required) — Your API key. - `OK-ACCESS-SIGN` header (required) — Base64-encoded HMAC-SHA256 signature of the prehash string. - `OK-ACCESS-TIMESTAMP` header (required) — ISO 8601 UTC timestamp, e.g. 2020-12-08T09:08:57.715Z. - `OK-ACCESS-PASSPHRASE` header (required) — The passphrase you set when creating the API key. ## Request ### Query parameters - `instType` (enum, optional) — Instrument type `SPOT` `MARGIN` `SWAP` `FUTURES` `OPTION` `EVENTS` - Allowed values: `SPOT`, `MARGIN`, `SWAP`, `FUTURES`, `OPTION` - `uly` (string, optional) — Underlying, e.g. BTC-USD. Applicable to FUTURES/SWAP/OPTION. - `instFamily` (string, optional) — Instrument family Applicable to `FUTURES`/`SWAP`/`OPTION` - `instId` (string, optional) — Instrument ID, e.g. `BTC-USD-200927` - `ordType` (string, optional) — Order type `market`: Market order `limit`: Limit order `post_only`: Post-only order `fok`: Fill-or-kill order `ioc`: Immediate-or-cancel order `optimal_limit_ioc`: Market order with immediate-or-cancel order `mmp`: Market Maker Protection (only applicable to Option in Portfolio Margin mode) `mmp_and_post_only`: Market Maker Protection and Post-only order(only applicable to Option in Portfolio Margin mode) `op_fok`: Simple options (fok) `rpi`: Retail Price Improvement order `elp`: Enhanced Liquidity Program order (Deprecated; use `rpi`. Accepted until October 31, 2026.) - `state` (enum, optional) — State `live` `partially_filled` - Allowed values: `live`, `partially_filled` - `after` (string, optional) — Pagination of data to return records earlier than the requested `ordId` - `before` (string, optional) — Pagination of data to return records newer than the requested `ordId` - `limit` (string, optional) — Number of results per request. The maximum is `100`; The default is `100` ## Response ### 200 Successful response - `code` (string, optional) — Result code. `0` means success; any other value is an error code. - `msg` (string, optional) — Error message. Empty on success. - `data` (list of ApiV5TradeOrdersPendingGetResponsesContentApplicationJsonSchemaDataItems, optional) ## Types ### ApiV5TradeOrdersPendingGetResponsesContentApplicationJsonSchemaDataItems - `instType` (string, optional) — Instrument type `SPOT` `MARGIN` `SWAP` `FUTURES` `OPTION` `EVENTS` - `instId` (string, optional) — Instrument ID - `ordId` (string, optional) — Order ID - `clOrdId` (string, optional) — Client Order ID as assigned by the client - `px` (string, optional) — Price For options, use coin as unit (e.g. BTC, ETH) - `sz` (string, optional) — Quantity to buy or sell - `ordType` (string, optional) — Order type `market`: Market order `limit`: Limit order `post_only`: Post-only order `fok`: Fill-or-kill order `ioc`: Immediate-or-cancel order `optimal_limit_ioc`: Market order with immediate-or-cancel order `mmp`: Market Maker Protection (only applicable to Option in Portfolio Margin mode) `mmp_and_post_only`: Market Maker Protection and Post-only order(only applicable to Option in Portfolio Margin mode) `op_fok`: Simple options (fok) `rpi`: Retail Price Improvement order `elp`: Enhanced Liquidity Program order (Deprecated; use `rpi`. Accepted until October 31, 2026.) - `side` (string, optional) — Order side - `posSide` (string, optional) — Position side - `tdMode` (string, optional) — Trade mode - `accFillSz` (string, optional) — Accumulated fill quantity - `avgPx` (string, optional) — Average filled price. If none is filled, it will return "". - `state` (string, optional) — State `live` `partially_filled` - `lever` (string, optional) — Leverage, from `0.01` to `125`. Only applicable to `MARGIN/FUTURES/SWAP` - `uTime` (string, optional) — Update time, Unix timestamp format in milliseconds, e.g. `1597026383085` - `cTime` (string, optional) — Creation time, Unix timestamp format in milliseconds, e.g. `1597026383085` ## Examples **Response** ```json { "code": "0", "msg": "", "data": [ { "instType": "SPOT", "instId": "BTC-USDT", "ordId": "1752588852617379840", "clOrdId": "", "px": "13013.5", "sz": "0.001", "ordType": "post_only", "side": "buy", "posSide": "net", "tdMode": "cash", "accFillSz": "0", "avgPx": "", "state": "live", "lever": "", "uTime": "1724733617998", "cTime": "1724733617998", "algoClOrdId": "", "algoId": "", "attachAlgoClOrdId": "", "attachAlgoOrds": [], "cancelSource": "", "cancelSourceReason": "", "category": "normal", "ccy": "", "fee": "0", "feeCcy": "BTC", "fillPx": "", "fillSz": "0", "fillTime": "", "isTpLimit": "false", "linkedAlgoOrd": { "algoId": "" }, "pnl": "0", "pxType": "", "pxUsd": "", "pxVol": "", "quickMgnType": "", "rebate": "0", "rebateCcy": "USDT", "reduceOnly": "false", "slOrdPx": "", "slTriggerPx": "", "slTriggerPxType": "", "source": "", "stpId": "", "stpMode": "cancel_maker", "tag": "", "tgtCcy": "", "tpOrdPx": "", "tpTriggerPx": "", "tpTriggerPxType": "", "tradeId": "", "tradeQuoteCcy": "USDT" } ] } ``` **SDK Code** ```python trade_getOrderList_example import requests url = "https://www.okx.com/api/v5/trade/orders-pending" headers = {"OK-ACCESS-KEY": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript trade_getOrderList_example const url = 'https://www.okx.com/api/v5/trade/orders-pending'; const options = {method: 'GET', headers: {'OK-ACCESS-KEY': ''}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go trade_getOrderList_example package main import ( "fmt" "net/http" "io" ) func main() { url := "https://www.okx.com/api/v5/trade/orders-pending" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("OK-ACCESS-KEY", "") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby trade_getOrderList_example require 'uri' require 'net/http' url = URI("https://www.okx.com/api/v5/trade/orders-pending") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["OK-ACCESS-KEY"] = '' response = http.request(request) puts response.read_body ``` ```java trade_getOrderList_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://www.okx.com/api/v5/trade/orders-pending") .header("OK-ACCESS-KEY", "") .asString(); ``` ```php trade_getOrderList_example request('GET', 'https://www.okx.com/api/v5/trade/orders-pending', [ 'headers' => [ 'OK-ACCESS-KEY' => '', ], ]); echo $response->getBody(); ``` ```csharp trade_getOrderList_example using RestSharp; var client = new RestClient("https://www.okx.com/api/v5/trade/orders-pending"); var request = new RestRequest(Method.GET); request.AddHeader("OK-ACCESS-KEY", ""); IRestResponse response = client.Execute(request); ``` ```swift trade_getOrderList_example import Foundation let headers = ["OK-ACCESS-KEY": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://www.okx.com/api/v5/trade/orders-pending")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```