> 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 recurring sub orders

GET https://www.okx.com/api/v5/tradingBot/recurring/sub-orders

Retrieve the individual sub-orders executed by a recurring buy order.

Reference: https://okx-demo.ferndocs.com/api/api-reference/grid-trading/get-recurring-sub-orders

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

- `algoId` (string, required) — Algo ID
- `ordId` (string, optional) — Sub order ID
- `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 ApiV5TradingBotRecurringSubOrdersGetResponsesContentApplicationJsonSchemaDataItems, optional)

## Types

### ApiV5TradingBotRecurringSubOrdersGetResponsesContentApplicationJsonSchemaDataItems

- `algoId` (string, optional) — Algo ID
- `instType` (string, optional) — Instrument type
- `instId` (string, optional) — Instrument ID
- `algoOrdType` (string, optional) — Algo order type `recurring`: recurring buy
- `ordId` (string, optional) — Sub order ID
- `cTime` (string, optional) — Sub order created time, Unix timestamp format in milliseconds, e.g. `1597026383085`
- `uTime` (string, optional) — Sub order updated time, Unix timestamp format in milliseconds, e.g. `1597026383085`
- `tdMode` (string, optional) — Sub order trade mode Margin mode : `cross` Non-Margin mode : `cash`
- `ordType` (string, optional) — Sub order type `market`: Market order `manual_add_order`: Manual add investment order
- `sz` (string, optional) — Sub order quantity to buy or sell
- `state` (string, optional) — Sub order state `canceled` `live` `partially_filled` `filled` `cancelling`
- `side` (string, optional) — Sub order side `buy` `sell`
- `px` (string, optional) — Sub order limit price If it is a market order, "-1" will be return
- `fee` (string, optional) — Sub order fee
- `feeCcy` (string, optional) — Sub order fee currency
- `avgPx` (string, optional) — Sub order average filled price
- `accFillSz` (string, optional) — Sub order accumulated fill quantity
- `tag` (string, optional) — Order tag

## Examples

**Response**

```json
{
  "code": "0",
  "msg": "",
  "data": [
    {
      "algoId": "560516615079727104",
      "instType": "SPOT",
      "instId": "ETH-USDC",
      "algoOrdType": "recurring",
      "ordId": "560523524230717440",
      "cTime": "1679911222200",
      "uTime": "1679911222207",
      "tdMode": "",
      "ordType": "market",
      "sz": "80",
      "state": "filled",
      "side": "buy",
      "px": "-1",
      "fee": "-0.0000317205",
      "feeCcy": "ETH",
      "avgPx": "1765.4",
      "accFillSz": "0.045315",
      "tag": "",
      "algoClOrdId": ""
    },
    {
      "algoId": "560516615079727104",
      "instType": "SPOT",
      "instId": "BTC-USDC",
      "algoOrdType": "recurring",
      "ordId": "560523524184580096",
      "cTime": "1679911222189",
      "uTime": "1679911222194",
      "tdMode": "",
      "ordType": "market",
      "sz": "20",
      "state": "filled",
      "side": "buy",
      "px": "-1",
      "fee": "-0.000000500682",
      "feeCcy": "BTC",
      "avgPx": "27961.6",
      "accFillSz": "0.00071526",
      "tag": "",
      "algoClOrdId": ""
    }
  ]
}
```

**SDK Code**

```python gridTrading_getRecurringSubOrders_example
import requests

url = "https://www.okx.com/api/v5/tradingBot/recurring/sub-orders"

querystring = {"algoId":"560472804960100352"}

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

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

print(response.json())
```

```javascript gridTrading_getRecurringSubOrders_example
const url = 'https://www.okx.com/api/v5/tradingBot/recurring/sub-orders?algoId=560472804960100352';
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 gridTrading_getRecurringSubOrders_example
package main

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

func main() {

	url := "https://www.okx.com/api/v5/tradingBot/recurring/sub-orders?algoId=560472804960100352"

	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 gridTrading_getRecurringSubOrders_example
require 'uri'
require 'net/http'

url = URI("https://www.okx.com/api/v5/tradingBot/recurring/sub-orders?algoId=560472804960100352")

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 gridTrading_getRecurringSubOrders_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://www.okx.com/api/v5/tradingBot/recurring/sub-orders?algoId=560472804960100352")
  .header("OK-ACCESS-KEY", "<apiKey>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://www.okx.com/api/v5/tradingBot/recurring/sub-orders?algoId=560472804960100352', [
  'headers' => [
    'OK-ACCESS-KEY' => '<apiKey>',
  ],
]);

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

```csharp gridTrading_getRecurringSubOrders_example
using RestSharp;

var client = new RestClient("https://www.okx.com/api/v5/tradingBot/recurring/sub-orders?algoId=560472804960100352");
var request = new RestRequest(Method.GET);
request.AddHeader("OK-ACCESS-KEY", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift gridTrading_getRecurringSubOrders_example
import Foundation

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

let request = NSMutableURLRequest(url: NSURL(string: "https://www.okx.com/api/v5/tradingBot/recurring/sub-orders?algoId=560472804960100352")! 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()
```