---
title: "Run shell command"
method: POST
path: "/api/session/{sessionID}/shell"
tags: ["session"]
---

# Run shell command

`POST /api/session/{sessionID}/shell`

## Request

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

Execute one shell command in the session's working directory. Emits a shell.started event before execution and a shell.ended event with the merged output after.

## Path parameters

- `sessionID` string, required

## Request body

- object
  - `id` string
  - `command` string, required

## Response `204`

<No Content>

## Other responses

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