Skip to content

Create a window

POST
/api/sessions/{session_id}/windows
Code sample: Shell / cURL
curl --request POST \
--url http://127.0.0.1:8004/api/sessions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/windows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "cwd": "example", "select": true, "command": { "exec": [ "example" ] }, "env": {}, "keep_open": true }'
session_id
required
string format: uuid

Session ID

Media typeapplication/json
object
name
string | null
cwd
string | null
select

Make it the active window.

boolean | null
default: true
command
One of:

Run this instead of the shell, starting now rather than once a client shows the pane. The pane closes when it exits, unless keep_open.

One of:

A program and its arguments.

object
exec
required

A program and its arguments.

Array<string>
env
object
keep_open

Keep the pane, with its output, after its program exits.

boolean

The new window’s first pane

Media typeapplication/json
object
session_id
required
string format: uuid
pane_id
required
string format: uuid
pane
One of:

The new pane as GET /api/panes lists it, as it was created.

object
session_id
required
string format: uuid
session_name
required
string
window_id
required
string format: uuid
window_index
required
integer
window_name
required
string
window_active
required
boolean
window_zoomed_flag
required
boolean
pane_id
required
string format: uuid
pane_index
required

Layout order, as prefix + q numbers panes.

integer
pane_active
required
boolean
pane_current_path
string | null
pane_title
string | null
pane_dead
required

Its program exited; only a pane created with keep_open stays.

boolean
pane_dead_status

The program’s exit status, 128 + N if signal N ended it.

integer | null format: int32

Example generated

{
"session_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"pane_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"pane": {
"session_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"session_name": "example",
"window_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"window_index": 1,
"window_name": "example",
"window_active": true,
"window_zoomed_flag": true,
"pane_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"pane_index": 1,
"pane_active": true,
"pane_current_path": "example",
"pane_title": "example",
"pane_dead": true,
"pane_dead_status": 1
}
}

An empty command, env without one, or with a command a cwd that isn’t a directory; or a malformed ID or JSON body

Media typetext/plain
string

Missing or wrong access token

Media typetext/plain
string

The request’s Host or Origin isn’t allowed, or the caller can’t use this route (a guest token, or btmux connect)

No such session

A body over the size limit

Media typetext/plain
string

No Content-Type: application/json

Media typetext/plain
string

The command can’t start; or a body that doesn’t match its schema

Media typetext/plain
string