---
title: "Run command in shell session"
method: POST
path: "/shell/exec"
---

# Run command in shell session

`POST /shell/exec`

## Request

- Base URL: `http://localhost:21721`
- URL: `http://localhost:21721/shell/exec`
- Auth: HTTP bearer

Runs a command in an active shell session and waits for it to finish. The exit code and output will be returned in the response.

Note that a variety of different errors can occur when executing the command.
If the command finishes, even with an error code, a normal HTTP 200 response will be returned.
However, if any other error occurs like the shell not responding or exiting unexpectedly, an HTTP 500 response will be returned.

## Request body

- ShellExecRequest
  - `store` string, required: The store uuid
  - `command` string, required: The command to execute

## Response `200`

The operation was successful. The shell command finished.

- ShellExecResponse
  - `exitCode` integer, required: The exit code of the command
  - `stdout` string, required: The stdout output of the command
  - `stderr` string, required: The stderr output of the command

## Other responses

- `400`: Bad request. Please check error message and your parameters.
- `401`: Authorization failed. Please supply a `Bearer` token via the `Authorization` header.
- `403`: Authorization failed. Please supply a valid `Bearer` token via the `Authorization` header.
- `500`: Internal error.

---

[API](https://skmtc.dev/xpipe/apis/xpipe-api-documentation.md) - [All operations](https://skmtc.dev/xpipe/apis/xpipe-api-documentation/llms.txt) - [OpenAPI document](https://skmtc.dev/xpipe/apis/xpipe-api-documentation/revisions/cc0e84caab21?raw)
