> This page is for API Reference.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://okx-demo.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://okx-demo.ferndocs.com/_mcp/server.

# Get pending algo orders

GET https://www.okx.com/api/v5/trade/orders-algo-pending

Retrieve a list of untriggered Algo orders under the current account.

Reference: https://okx-demo.ferndocs.com/api/api-reference/trade/get-algo-pending

## 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

- `ordType` (enum, required) — Order type `conditional`: One-way stop order `oco`: One-cancels-the-other order `chase`: chase order, only applicable to FUTURES and SWAP `trigger`: Trigger order `move_order_stop`: Trailing order `iceberg`: Iceberg order `twap`: TWAP order `smart_iceberg`: Iceberg order For every request, unlike other ordType which only can use one type, `conditional` and `oco` both can be used and separated with comma.
  - Allowed values: `conditional`, `oco`, `trigger`, `move_order_stop`, `iceberg`, `twap`, `chase`
- `algoId` (string, optional) — Algo ID
- `instType` (enum, optional) — Instrument type `SPOT` `SWAP` `FUTURES` `MARGIN`
  - Allowed values: `SPOT`, `MARGIN`, `SWAP`, `FUTURES`
- `instId` (string, optional) — Instrument ID, e.g. `BTC-USDT`
- `after` (string, optional) — Pagination of data to return records earlier than the requested `algoId`.
- `before` (string, optional) — Pagination of data to return records newer than the requested `algoId`.
- `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 ApiV5TradeOrdersAlgoPendingGetResponsesContentApplicationJsonSchemaDataItems, optional)

## Types

### ApiV5TradeOrdersAlgoPendingGetResponsesContentApplicationJsonSchemaDataItems

- `algoId` (string, optional) — Algo ID
- `algoClOrdId` (string, optional) — Client-supplied Algo ID
- `instType` (string, optional) — Instrument type
- `instId` (string, optional) — Instrument ID
- `ordType` (string, optional) — Order type
- `side` (string, optional) — Order side
- `posSide` (string, optional) — Position side
- `sz` (string, optional) — Quantity to buy or sell
- `state` (string, optional) — State `live` `pause`
- `triggerPx` (string, optional) — Trigger price
- `tpTriggerPx` (string, optional) — Take-profit trigger price
- `slTriggerPx` (string, optional) — Stop-loss trigger price
- `cTime` (string, optional) — Creation time Unix timestamp format in milliseconds, e.g. `1597026383085`

## Examples

**Response**

```json
{
  "code": "0",
  "msg": "",
  "data": [
    {
      "algoId": "1753184812254216192",
      "algoClOrdId": "",
      "instType": "SPOT",
      "instId": "BTC-USDT",
      "ordType": "conditional",
      "side": "buy",
      "posSide": "net",
      "sz": "10",
      "state": "live",
      "triggerPx": "",
      "tpTriggerPx": "10000",
      "slTriggerPx": "",
      "cTime": "1724751378980",
      "activePx": "",
      "actualPx": "",
      "actualSide": "",
      "actualSz": "0",
      "amendPxOnTriggerType": "0",
      "attachAlgoOrds": [],
      "callbackRatio": "",
      "callbackSpread": "",
      "ccy": "",
      "chaseType": "",
      "chaseVal": "",
      "clOrdId": "",
      "closeFraction": "",
      "failCode": "0",
      "isTradeBorrowMode": "",
      "last": "62916.5",
      "lever": "",
      "linkedOrd": {
        "ordId": ""
      },
      "maxChaseType": "",
      "maxChaseVal": "",
      "moveTriggerPx": "",
      "ordId": "",
      "ordIdList": [],
      "ordPx": "",
      "pxLimit": "",
      "pxSpread": "",
      "pxVar": "",
      "quickMgnType": "",
      "reduceOnly": "false",
      "slOrdPx": "",
      "slTriggerPxType": "",
      "szLimit": "",
      "tag": "",
      "tdMode": "cash",
      "tgtCcy": "quote_ccy",
      "timeInterval": "",
      "tpOrdPx": "-1",
      "tpTriggerPxType": "last",
      "tradeQuoteCcy": "USDT",
      "triggerPxType": "",
      "triggerTime": "",
      "uTime": "1724751378980"
    }
  ]
}
```

**SDK Code**

```python trade_getAlgoPending_example
import requests

url = "https://www.okx.com/api/v5/trade/orders-algo-pending"

querystring = {"ordType":"conditional"}

headers = {"OK-ACCESS-KEY": "<apiKey>"}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript trade_getAlgoPending_example
const url = 'https://www.okx.com/api/v5/trade/orders-algo-pending?ordType=conditional';
const options = {method: 'GET', headers: {'OK-ACCESS-KEY': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go trade_getAlgoPending_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://www.okx.com/api/v5/trade/orders-algo-pending?ordType=conditional"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("OK-ACCESS-KEY", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby trade_getAlgoPending_example
require 'uri'
require 'net/http'

url = URI("https://www.okx.com/api/v5/trade/orders-algo-pending?ordType=conditional")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["OK-ACCESS-KEY"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java trade_getAlgoPending_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://www.okx.com/api/v5/trade/orders-algo-pending?ordType=conditional")
  .header("OK-ACCESS-KEY", "<apiKey>")
  .asString();
```

```php trade_getAlgoPending_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://www.okx.com/api/v5/trade/orders-algo-pending?ordType=conditional', [
  'headers' => [
    'OK-ACCESS-KEY' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp trade_getAlgoPending_example
using RestSharp;

var client = new RestClient("https://www.okx.com/api/v5/trade/orders-algo-pending?ordType=conditional");
var request = new RestRequest(Method.GET);
request.AddHeader("OK-ACCESS-KEY", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift trade_getAlgoPending_example
import Foundation

let headers = ["OK-ACCESS-KEY": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://www.okx.com/api/v5/trade/orders-algo-pending?ordType=conditional")! 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()
```