---
title: "Connect to PTY session"
method: GET
path: "/api/pty/{ptyID}/connect"
tags: ["pty"]
---

# Connect to PTY session

`GET /api/pty/{ptyID}/connect`

## Request

- Base URL: `https://opencode.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://opencode.ai/api/pty/{ptyID}/connect`
- Auth: none required

Establish a WebSocket connection streaming PTY output and accepting terminal input.

## Path parameters

- `ptyID` string, required

## Query parameters

- `location[directory]` string
- `cursor` string
- `ticket` string

## Response `200`

Success

- boolean

## Other responses

- `400`: InvalidRequestError
- `401`: UnauthorizedError
- `403`: ForbiddenError
- `404`: PtyNotFoundError | LocationNotFoundError

---

[API](https://skmtc.dev/kaaass/apis/opencode.md) - [All operations](https://skmtc.dev/kaaass/apis/opencode/llms.txt) - [OpenAPI document](https://skmtc.dev/kaaass/apis/opencode/revisions/4e083d954707?raw)
