---
title: "Update PTY session"
method: PUT
path: "/api/pty/{ptyID}"
tags: ["pty"]
---

# Update PTY session

`PUT /api/pty/{ptyID}`

## 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}`
- Auth: none required

Update the title or viewport size of one PTY session.

## Path parameters

- `ptyID` string, required

## Query parameters

- `location` object, nullable
  - `directory` string, nullable

## Request body

- object
  - `title` string
  - `size` object
    - `rows` integer, required
    - `cols` integer, required

## Response `200`

Success

- object
  - `location` LocationPublicRef, required
    - `directory` string, required
  - `data` Pty, required
    - `id` string, required
    - `title` string, required
    - `command` string, required
    - `args` string[], required
    - `cwd` string, required
    - `status` 'running' | 'exited', required
    - `pid` integer, required
    - `exitCode` integer

## Other responses

- `400`: InvalidRequestError
- `401`: UnauthorizedError
- `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)
