> This page is for Web API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://ibkrcampus.com/docs/llms.txt.

# Get Account Status: Bulk Request

GET https://localhost:5000/gw/api/v1/accounts/status

Query status of all accounts associated with ‘Client ID'**Scope**: `accounts.read`**Security Policy**: `HTTPS`

Reference: https://ibkrcampus.com/docs/web-api/api-reference/account-management/account-management-accounts/list-accounts-status

## Authentication

- `Authorization` header (bearer token, required) — RS256-signed JWT access token signed with your registered private key.

## Servers

- `https://localhost:5000` (Client Portal Gateway, default)
- `https://api.ibkr.com` (Production)
- `https://qa.interactivebrokers.com` (Sandbox)

## Request

### Query parameters

- `accountStatusRequest` (AccountStatusRequest, required)

## Response

### 200

Query status of all accounts associated with ‘Client ID'

- `accounts` (list of AccountStatusResponse, optional)
- `offset` (long, optional)
- `limit` (long, optional)
- `total` (long, optional)

## Errors

### 400 Bad Request Error

Returns error description representing bad request

- `type` (string, optional)
- `title` (string, optional)
- `status` (long, optional)
- `detail` (string, optional)
- `instance` (string, optional)

### 401 Unauthorized Error

Returns error description representing access issue

- `type` (string, optional)
- `title` (string, optional)
- `status` (long, optional)
- `detail` (string, optional)
- `instance` (string, optional)

### 403 Forbidden Error

Returns error description representing access issue

- `type` (string, optional)
- `title` (string, optional)
- `status` (long, optional)
- `detail` (string, optional)
- `instance` (string, optional)

### 500 Internal Server Error

Returns error description representing internal server error

- `type` (string, optional)
- `title` (string, optional)
- `status` (long, optional)
- `detail` (string, optional)
- `instance` (string, optional)

## Types

### AccountStatusRequest

- `startDate` (date, required)
- `endDate` (date, required)
- `offset` (long, optional)
- `limit` (long, optional)
- `status` (enum, optional)
  - Allowed values: `N`, `O`, `P`, `C`, `A`, `E`, `F`, `I`, `J`, `L`, `M`, `R`, `W`, `Q`

### AccountStatusResponse

- `dateOpened` (datetime, optional)
- `dateStarted` (datetime, optional)
- `dateClosed` (datetime, optional)
- `accountId` (string, optional)
- `status` (string, optional)
- `description` (string, optional)
- `masterAccountId` (string, optional)
- `adminAccountId` (string, optional)
- `state` (string, optional)
- `message` (string, optional)

## Examples

**Request**

```json
{
  "endDate": "2024-04-01",
  "limit": 50,
  "offset": 0,
  "startDate": "2024-01-01",
  "status": "O"
}
```

**Response**

```json
{
  "accounts": [
    {
      "dateOpened": "2023-11-20T14:00:00Z",
      "dateStarted": "2023-11-21T09:30:00Z",
      "dateClosed": null,
      "accountId": "U1234567",
      "status": "O",
      "description": "Individual Margin Account",
      "masterAccountId": "M7654321",
      "adminAccountId": "A9876543",
      "state": "Active",
      "message": "Account in good standing"
    }
  ],
  "offset": 0,
  "limit": 50,
  "total": 1
}
```

**SDK Code**

```python
import requests

url = "https://localhost:5000/gw/api/v1/accounts/status"

querystring = {"accountStatusRequest":"{\"endDate\":\"2023-01-15\",\"startDate\":\"2023-01-15\"}"}

payload = {
    "endDate": "2024-04-01",
    "limit": 50,
    "offset": 0,
    "startDate": "2024-01-01",
    "status": "O"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://localhost:5000/gw/api/v1/accounts/status?accountStatusRequest=%7B%22endDate%22%3A%222023-01-15%22%2C%22startDate%22%3A%222023-01-15%22%7D';
const options = {
  method: 'GET',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"endDate":"2024-04-01","limit":50,"offset":0,"startDate":"2024-01-01","status":"O"}'
};

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

```go
package main

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

func main() {

	url := "https://localhost:5000/gw/api/v1/accounts/status?accountStatusRequest=%7B%22endDate%22%3A%222023-01-15%22%2C%22startDate%22%3A%222023-01-15%22%7D"

	payload := strings.NewReader("{\n  \"endDate\": \"2024-04-01\",\n  \"limit\": 50,\n  \"offset\": 0,\n  \"startDate\": \"2024-01-01\",\n  \"status\": \"O\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

url = URI("https://localhost:5000/gw/api/v1/accounts/status?accountStatusRequest=%7B%22endDate%22%3A%222023-01-15%22%2C%22startDate%22%3A%222023-01-15%22%7D")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"endDate\": \"2024-04-01\",\n  \"limit\": 50,\n  \"offset\": 0,\n  \"startDate\": \"2024-01-01\",\n  \"status\": \"O\"\n}"

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

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

HttpResponse<String> response = Unirest.get("https://localhost:5000/gw/api/v1/accounts/status?accountStatusRequest=%7B%22endDate%22%3A%222023-01-15%22%2C%22startDate%22%3A%222023-01-15%22%7D")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"endDate\": \"2024-04-01\",\n  \"limit\": 50,\n  \"offset\": 0,\n  \"startDate\": \"2024-01-01\",\n  \"status\": \"O\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://localhost:5000/gw/api/v1/accounts/status?accountStatusRequest=%7B%22endDate%22%3A%222023-01-15%22%2C%22startDate%22%3A%222023-01-15%22%7D', [
  'body' => '{
  "endDate": "2024-04-01",
  "limit": 50,
  "offset": 0,
  "startDate": "2024-01-01",
  "status": "O"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://localhost:5000/gw/api/v1/accounts/status?accountStatusRequest=%7B%22endDate%22%3A%222023-01-15%22%2C%22startDate%22%3A%222023-01-15%22%7D");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"endDate\": \"2024-04-01\",\n  \"limit\": 50,\n  \"offset\": 0,\n  \"startDate\": \"2024-01-01\",\n  \"status\": \"O\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "endDate": "2024-04-01",
  "limit": 50,
  "offset": 0,
  "startDate": "2024-01-01",
  "status": "O"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://localhost:5000/gw/api/v1/accounts/status?accountStatusRequest=%7B%22endDate%22%3A%222023-01-15%22%2C%22startDate%22%3A%222023-01-15%22%7D")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```