Skip to Content
HTTP APIWorkspace

Open a tab of instruments

Build your request

Change the values and the command follows. The token is never typed here: the command reads it from the SPECTRE_LOCAL_API_TOKEN environment variable. Run it in your own terminal.

Command
curl -X POST 'http://127.0.0.1:48180/v1/workspace/tabs' \
  -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "items": [
    {
      "instrument": "binance:futures:BTCUSDT",
      "chart": true
    },
    {
      "instrument": "bybit:futures:ETHUSDT",
      "connection_id": 31
    }
  ],
  "name": "Majors",
  "target": "new_tab",
  "window_id": 1,
  "activate": true
}'
POST
/workspace/tabs

Opens a tab with one column for each element of items, in the order of the list. Without name the tab takes the symbol of the first instrument, plus the number of the others if there are any: BTCUSDT +1. The side and the share of a chart come from the multiview settings.

Authorization

bearerToken workspace:write
headerAuthorizationBearer <token>

The Local API token: spt_ and 64 hex characters. Copy it from Settings App → General → Local API. It is accepted only in the Authorization header. The names listed with an operation are the scopes it requires. The token of the terminal carries all of them.

Scope: workspace:write

Request Body

application/json
  1. body
items*array<>
Items1 <= items <= 50
name?string
Lengthlength <= 64
target?WorkspaceTarget

new_tab opens a tab in the window window_id, or in the focused window without it. new_window opens a new window.

Default"new_tab"
Value in"new_tab""new_window"
window_id?integer
Formatint64
Range0 <= value
activate?boolean
Defaulttrue

Response Body

Where the tab opened. stacks and charts are the widgets of the new tab, in the order of columns.

application/json
  1. response

What a workspace command opened or touched. The numbers it concerns are filled in. The rest is null or empty.

window_id*|
Formatint64
tab_id*|
Formatint64
stacks*array<>
charts*array<>
Example Request
curl -X POST 'http://127.0.0.1:48180/v1/workspace/tabs' \  -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN" \  -H 'Content-Type: application/json' \  -d '{  "items": [    {      "instrument": "binance:futures:BTCUSDT",      "chart": true    },    {      "instrument": "bybit:futures:ETHUSDT",      "connection_id": 31    }  ],  "name": "Majors",  "target": "new_tab",  "window_id": 1,  "activate": true}'
Example Response
{  "window_id": 1,  "tab_id": 2,  "stacks": [    14,    16  ],  "charts": [    15  ]}