---
title: "Run a command inside a machine. Pass command as a shell string (\"ls -la\") or argv array ([\"ls\",\"-la\"]). Machine must be ready before calling."
method: POST
path: "/smolmachines/v1/machines/{id}/exec"
tags: ["Smol Machines"]
---

# Run a command inside a machine. Pass command as a shell string ("ls -la") or argv array (\["ls","-la"\]). Machine must be ready before calling.

`POST /smolmachines/v1/machines/{id}/exec`

## Request

- Base URL: `https://api.orthogonal.com/mpp`
- URL: `https://api.orthogonal.com/mpp/smolmachines/v1/machines/{id}/exec`
- Auth: none declared
- TypeScript: <https://skmtc.dev/orthogonal/apis/orthogonal-api-marketplace/docs/smolmachines/v1/machines/:id/exec/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `id` string, required

## Request body

- object
  - `command` string, required: Shell command string (e.g. "echo hello") or argv array (e.g. ["echo","hello"])
  - `cwd` string: Working directory for the command
  - `env` object: Environment variables as key-value pairs
  - `stdin` string: String to pass as stdin to the command
  - `stream` boolean: If true, stream output as server-sent events
  - `timeoutSeconds` number: Max execution time in seconds

## Response `200`

Successful response

## Changes

- **2026-11-08** `857e915717f4`: 2 breaking
  - added the new path request parameter `id`
  - added required request body
- **2026-08-21** `bf5b6f84d6e0`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/orthogonal/apis/orthogonal-api-marketplace/changes/smolmachines/v1/machines/:id/exec/post.md)

---

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