---
title: "Execute a bash command"
method: POST
path: "/code-mode/execute-bash"
tags: ["CodeMode"]
---

# Execute a bash command

`POST /code-mode/execute-bash`

## Headers

- `x-code-mode-session` string, required

## Request body

- ExecuteBashInput
  - `command` string — Bash command to execute

## Response `200`

Bash command executed successfully

- ExecuteBashOutput
  - `exit_code` integer, required — Exit code of the bash command
  - `stderr` string, required — Standard error of executed bash command
  - `stdout` string, required — Standard output of executed bash command

## Other responses

- `404` — Session not found
- `500` — Internal server error

---

[API](https://skmtc.dev/portofcontext/apis/pctx-agent-server-api.md) · [All operations](https://skmtc.dev/portofcontext/apis/pctx-agent-server-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/portofcontext/pctx-agent-server-api/revisions/d1f357cea012/schema)
