---
title: "Execute a snippet on a host"
method: POST
path: "/snippets/execute"
tags: ["Snippets"]
---

# Execute a snippet on a host

`POST /snippets/execute`

Executes a snippet on a specified host.

## Request body

- object
  - `snippetId` integer
  - `hostId` integer
  - `inputValues` object — Optional resolved values for $INPUT_n placeholders in the snippet content, keyed by "INPUT_n". Host variables ($HOST, $USER, $PORT, $NAME) are resolved server-side per target host and do not need to be passed here.

## Response `200`

Snippet executed successfully.

## Other responses

- `400` — Snippet ID and Host ID are required.
- `404` — Snippet or host not found.
- `500` — Failed to execute snippet.

---

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