# Configuration

Source: https://docs.interop.io/adapters/bloomberg/tapi-bridge/configuration/index.html

## Overview

The TAPI Bridge version of the Bloomberg Adapter can be configured via its [app definition](https://docs.interop.io/desktop/developers/configuration/application/index.md). To provide settings for the TAPI Bridge, use the `"bloombergConnector"` property of the `"customProperties"` top-level key.

Example app definition for the Bloomberg Adapter:

```json
{
    "title": "Bloomberg Adapter",
    "type": "window",
    "name": "BBGAdapter",
    "hidden": false,
    "service": true,
    "runPriority": 1000,
    "allowLogging": true,
    "details": {
        "url": "http://url-to-bbg-adapter/index.html",
        "hidden": true
    },
    "allowMultiple": false,
    "autoStart": true,
    "customProperties": {
        // Bloomberg Adapter configuration.
        "bloombergConnector": {
            "apiKey": "my-api-key",
            "reconnectPeriod": "5000(5), 20000"
        }
    }
}
```

### Configuration Properties

The `"bloombergConnector"` object has the following properties:

| Property | Type | Description |
|----------|------|-------------|
| `"apiKey"` | `string` | This property is required unless `"fetchKeyConfig"` is provided. The API key obtained from Bloomberg to authenticate Terminal Connect requests. |
| `"bloombergReconnectCooldownTime"` | `number` | Interval in milliseconds to wait before attempting another reconnection attempt cycle with the settings specified in `"bloombergReconnectPeriod"`. Prevents excessive reconnection cycles when invoked frequently. Defaults to `15000`. |
| `"bloombergReconnectPeriod"` | `string` | A cycle of intervals and retry attempts for Bloomberg Terminal reconnection. Accepts a string in the format `"<interval>(<retries>), <interval>(<retries>), ..., <interval>"`. The `<interval>` token specifies the interval in milliseconds between reconnection attempts, and the `<retries>` token specifies the number of attempts at that interval. You can specify as many segments as necessary. If the last segment doesn't have a `<retries>` token, the reconnection attempts will repeat indefinitely at the specified interval. Defaults to `"1000(5), 5000(500)"`. |
| `"fetchKeyConfig"` | `object` | This property is required unless `"apiKey"` is provided. Configuration for fetching the API key dynamically at startup instead of providing it statically. |
| `"globalEndpoint"` | `string` | The global Bloomberg Graph API endpoint for user-level operations. Defaults to `"https://graph.bloomberg.com/user"`. |
| `"hostname"` | `string` | The hostname used for auto-discovering the Bloomberg Terminal Connect endpoint. The adapter scans ports 9000–9020 on this host to find an active Terminal Connect instance. Defaults to `"localhost"`. |
| `"localEndpoint"` | `string` | The local Bloomberg Terminal Connect HTTP endpoint used for GraphQL queries and mutations. Auto-discovered at startup by scanning ports 9000–9020 on the configured `"hostname"`. Defaults to `"http://localhost:9000/terminal_connect/v3"`. |
| `"localWebsocket"` | `string` | The local Bloomberg Terminal Connect WebSocket endpoint used for GraphQL subscriptions. Auto-discovered at startup alongside `"localEndpoint"`. Defaults to `"ws://localhost:9000/terminal_connect/v3"`. |
| `"reconnectPeriod"` | `string` | Reconnection schedule for the WebSocket connection to the local Bloomberg Terminal Connect endpoint. Accepts a string in the format `"<interval>(<retries>), <interval>(<retries>), ..., <interval>"`. The `<interval>` token specifies the interval in milliseconds between reconnection attempts, and the `<retries>` token specifies the number of attempts at that interval. You can specify as many segments as necessary. If the last segment doesn't have a `<retries>` token, the reconnection attempts will repeat indefinitely at the specified interval. Defaults to `"5000(5), 20000"`. |

The `"fetchKeyConfig"` object has the following properties:

| Property | Type | Description |
|----------|------|-------------|
| `"fetchOptions"` | `object` | Additional headers (when `"targetType"` is `"url"`) or arguments (when `"targetType"` is `"method"`) to include in the request. |
| `"isJson"` | `boolean` | **Required.** If `true`, the response will be parsed as JSON and the key will be extracted using `"keyPath"`. If `false`, the raw response text will be used directly as the API key. |
| `"keyPath"` | `string` | Dot-notation path to extract the key from the JSON response (e.g., `"data.token"`). Used only when `"isJson"` is `true`. If omitted and `"isJson"` is `true`, the entire JSON response will be converted to a string and used as the key. |
| `"mergeAuthHeader"` | `boolean` | If `true` and `"targetType"` is `"url"`, the Bloomberg Adapter will merge the current **io.Connect Desktop** authorization headers into the fetch request. Defaults to `false`. |
| `"target"` | `string` | **Required.** The URL from which to fetch credentials or the name of the Interop method to use for fetching credentials. |
| `"targetType"` | `"url"` \| `"method"` | **Required.** Specifies the credentials source type (URL or an Interop method). |
| `"throttleMs"` | `number` | Interval in milliseconds between retry attempts if the key fetch fails. Will retry indefinitely until a valid key is obtained. Defaults to `2000`. |
| `"tokenAuthHeaderKey"` | `string` | The HTTP header name under which the authentication token will be placed in the request. Defaults to `"Authorization"`. |
| `"tokenObject"` | `any` | A template value in which the placeholder specified in `"tokenPlaceholder"` will be replaced with the actual io.Connect authentication token before setting the header. Defaults to `"$token"`. |
| `"tokenPlaceholder"` | `string` | The placeholder string in `"tokenObject"` that will be replaced with the actual token. Defaults to `"$token"`. |
