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

GET https://localhost:5000/gw/api/v1/forms

Get forms**Scope**: `accounts.read` OR `forms.read`**Security Policy**: `HTTPS`

Reference: https://ibkrcampus.com/docs/web-api/api-reference/account-management/account-management-utilities/list-forms

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

- `formNo` (list of long, optional)
- `getDocs` (string, optional)
- `fromDate` (string, optional)
- `toDate` (string, optional)
- `language` (string, optional)
- `projection` (enum, optional, default: NONE)
  - Allowed values: `PAYLOAD`, `DOCS`, `NONE`

## Response

### 200

Get forms

- `error` (ErrorResponse, optional)
- `hasError` (boolean, optional)
- `errorDescription` (string, optional)
- `fileData` (FileData, optional)
- `formDetails` (list of FormDetails, optional)
- `timestamp` (datetime, 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

### ErrorResponse

- `status` (long, optional)
- `error` (string, optional)
- `message` (string, optional)

### FileData

- `data` (FileDataData, optional)
- `name` (string, optional)

### FormDetails

- `formNumber` (long, optional)
- `sha1Checksum` (string, optional)
- `dateModified` (datetime, optional)
- `fileName` (string, optional)
- `language` (string, optional)
- `formName` (string, optional)
- `payload` (FormPayload, optional)
- `apiSupportedTask` (boolean, optional)
- `type` (string, optional)
- `action` (string, optional)
- `acceptableDocs` (list of string, optional)
- `questionnaire` (list of QuestionnaireResponse, optional)
- `error` (ErrorResponse, optional)
- `hasError` (boolean, optional)
- `errorDescription` (string, optional)
- `fileLength` (long, optional)

### FileDataData

### FormPayload

- `mimeType` (string, optional)
- `data` (string, optional)

### QuestionnaireResponse

- `questionId` (long, optional)
- `question` (string, optional)
- `isMandatoryToAnswer` (boolean, optional)
- `questionType` (string, optional)
- `answers` (list of AnswerResponse, optional)

### AnswerResponse

- `answerId` (long, optional)
- `answer` (string, optional)
- `dependentQuestionId` (long, optional)
- `dependentAnswerId` (long, optional)
- `multiAnswerDetail` (list of string, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "error": {
    "status": 404,
    "error": "Not Found",
    "message": "No forms available for the given criteria"
  },
  "hasError": true,
  "errorDescription": "No forms found matching the query parameters",
  "fileData": {
    "data": {},
    "name": "user_agreement.pdf"
  },
  "formDetails": [
    {
      "formNumber": 1050,
      "sha1Checksum": "3a7bd3e2360a3d5f8b9c1e2f4a5d6b7c8d9e0f1a",
      "dateModified": "2024-01-15T09:30:00Z",
      "fileName": "W9_Form_2024.pdf",
      "language": "en",
      "formName": "W-9 Tax Form",
      "payload": {
        "mimeType": "application/pdf",
        "data": "SGVsbG8gV29ybGQ="
      },
      "apiSupportedTask": true,
      "type": "tax",
      "action": "submit",
      "acceptableDocs": [
        "pdf",
        "jpg"
      ],
      "questionnaire": [
        {
          "questionId": 101,
          "question": "Are you a US citizen?",
          "isMandatoryToAnswer": true,
          "questionType": "boolean",
          "answers": [
            {
              "answerId": 1,
              "answer": "Yes",
              "dependentQuestionId": 102,
              "dependentAnswerId": 2,
              "multiAnswerDetail": [
                "N/A"
              ]
            },
            {
              "answerId": 2,
              "answer": "No",
              "dependentQuestionId": 103,
              "dependentAnswerId": 3,
              "multiAnswerDetail": []
            }
          ]
        }
      ],
      "error": {
        "status": 0,
        "error": "",
        "message": ""
      },
      "hasError": false,
      "errorDescription": "",
      "fileLength": 24576
    }
  ],
  "timestamp": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://localhost:5000/gw/api/v1/forms"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://localhost:5000/gw/api/v1/forms';
const options = {
  method: 'GET',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{}'
};

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/forms"

	payload := strings.NewReader("{}")

	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/forms")

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 = "{}"

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/forms")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://localhost:5000/gw/api/v1/forms', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://localhost:5000/gw/api/v1/forms");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://localhost:5000/gw/api/v1/forms")! 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()
```