---
title: "Execute Command"
method: POST
path: "/apps/{app_name}/machines/{machine_id}/exec"
tags: ["Machines"]
---

# Execute Command

`POST /apps/{app_name}/machines/{machine_id}/exec`

Execute a command on a specific Machine and return the raw command output bytes.

## Path parameters

- `app_name` string, required
- `machine_id` string, required

## Request body

- MachineExecRequest
  - `cmd` string — Deprecated: use Command instead
  - `command` string[]
  - `container` string
  - `stdin` string
  - `timeout` integer

## Response `200`

stdout, stderr, exit code, and exit signal are returned

- Flydv1ExecResponse
  - `exit_code` integer
  - `exit_signal` integer
  - `stderr` string
  - `stdout` string

## Other responses

- `400` — Bad Request

---

[API](https://skmtc.dev/fly/apis/machines-api.md) · [All operations](https://skmtc.dev/fly/apis/machines-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/fly/machines-api/revisions/f5ad396d55d7/schema)
