# GET All Orders

Retrieve orders across all accounts in a single request. By default, only active (working) orders are returned. Pass `?activeOnly=false` to include historical orders.

This is a convenience endpoint that eliminates the need to iterate through accounts individually when you need a cross-account view of order state.

## Get all orders across all accounts

<mark style="color:green;">`GET`</mark> `/v1/api/orders`

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Query Parameters**

| Name           | Type    | Required | Description                                                                                                                |
| -------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------- |
| `activeOnly`   | boolean | Optional | Filter to only active (non-terminal) orders. Default: `true`                                                               |
| `lookbackTime` | integer | Optional | When `activeOnly=false`, limits historical orders to this many seconds in the past. Example: `86400` for the last 24 hours |

**Code Examples**

{% tabs %}
{% tab title="Python" %}

```python
import requests

token = 'my-secret-token'
url = "https://app.crosstrade.io/v1/api/orders"
headers = {
    "Authorization": f"Bearer {token}",
    "Content-Type": "application/json"
}

# Get all active orders across all accounts
params = {"activeOnly": "true"}

try:
    response = requests.get(url, headers=headers, params=params)
    print(f"Response Code: {response.status_code}, Response Text: {response.text}")
except Exception as e:
    print(f"An error occurred: {e}")
```

{% endtab %}
{% endtabs %}

***

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "orders": [
    {
      "id": "ecf2746031ca44dca70f8ac81227b52f",
      "type": "NinjaTrader.Cbi.Order",
      "time": "2026-03-18T13:58:43.9037681",
      "epoch": 1773867523903,
      "name": "",
      "ocoId": "",
      "onBehalfOf": "",
      "clientId": -1,
      "account": "Sim101",
      "instrument": "NQ 06-26",
      "instrumentType": "Future",
      "orderType": "Limit",
      "orderState": "Working",
      "orderAction": "Buy",
      "quantity": 1,
      "quantityChanged": 1,
      "limitPrice": 24603.25,
      "limitPriceChanged": 24603.25,
      "stopPrice": 0.0,
      "stopPriceChanged": 0.0,
      "averageFillPrice": 0.0,
      "filled": 0,
      "timeInForce": "Day",
      "gtd": "2099-12-01T00:00:00.0000000",
      "fromEntrySignal": null,
      "hasOverfill": false,
      "isBacktestOrder": false,
      "isLimit": true,
      "isLiveUntilCancelled": false,
      "isLong": true,
      "isMarket": false,
      "isMarketIfTouched": false,
      "isShort": false,
      "isSimulatedStop": false,
      "isStopLimit": false,
      "isStopMarket": false,
      "isTrackingConfigured": false,
      "isTrackingEnabled": false,
      "userData": "<NinjaTrader />",
      "ownerStrategy": {
        "id": null,
        "name": null,
        "displayName": null
      }
    }
  ],
  "count": 1,
  "success": true
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}

#### WebSocket API

This request can also be made over the WebSocket API. Query parameters are passed inside `args`.

```json
{
  "action": "rpc",
  "id": "my-request-id",
  "api": "GetAllOrders",
  "args": {
    "activeOnly": true
  }
}
```

To include historical orders with a time filter:

```json
{
  "action": "rpc",
  "id": "my-request-id",
  "api": "GetAllOrders",
  "args": {
    "activeOnly": false,
    "lookbackTime": 86400
  }
}
```
