---
title: "openTerminal"
---

> Documentation Index
> Fetch the complete documentation index at: https://agenthold.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# openTerminal

Path: agenthold API › streams

`GET /agents/{agentId}/terminal`

URL: `/api/v1/agents/{agentId}/terminal`

WebSocket upgrade to an interactive shell in the sandbox (operator role).
A sleeping agent is woken. Binary messages carry terminal input and
output. Text messages are JSON: the client sends
`{"type":"resize","cols":N,"rows":N}`; the server sends
`{"type":"status","message":"..."}` while waking,
`{"type":"exit","code":N}` and `{"type":"error","message":"..."}`.

## Authentication

Requires one of the following:

- `session`, apiKey, in cookie
- `token`, http bearer, header `Authorization`

## Path parameters

- `agentId` (`openTerminal.path.agentId`; string, required)

## Query parameters

- `cols` (`openTerminal.query.cols`; integer, optional)
- `rows` (`openTerminal.query.rows`; integer, optional)
- `auth` (`openTerminal.query.auth`; string, optional) — Run this harness login method (agent admin) instead of a shell.

## Code samples

### cURL

```bash
curl --request GET \
  --url '<base-url>/api/v1/agents/<agentId>/terminal' \
  --cookie 'agenthold_session=<agenthold_session>'
```

### TypeScript

```typescript
const url = '<base-url>/api/v1/agents/<agentId>/terminal';
const options = {
  method: 'GET',
  headers: {cookie: 'agenthold_session=<agenthold_session>'}
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/api/v1/agents/<agentId>/terminal"

headers = {"cookie": "agenthold_session=<agenthold_session>"}

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

print(response.text)
```

## Responses

### 101

Switching to WebSocket.

### 403

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`openTerminal.response.403.error`; string, required)

### 404

Error.

#### Example

```json
{
  "error": "string"
}
```

- `error` (`openTerminal.response.404.error`; string, required)


Source: https://agenthold.dev/api/open-terminal/index.md
