Skip to main content

Documentation Index

Fetch the complete documentation index at: https://agent37.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

POST /v1/instances/{id}/exec runs a shell command inside the instance, straight from your backend. It is the escape hatch for anything the API does not wrap as its own call. The command runs inside the instance as the agent’s own user, on the same box the agent works on, so it sees the agent’s files, tools, and connected accounts. Anything you would do in a terminal, you do here without one: install a package, wire up a channel, run a script, or inspect state while debugging.
exec takes your sk_live_ key and runs arbitrary commands as the agent’s user. Keep it server-side, behind your own checks. There is no end-user token for it, unlike an embedded terminal.

Request

command
string
required
The shell command to run inside the instance.

Response

A command that runs but exits nonzero is a normal result: you get 200 with its exit_code, stdout, and stderr. Only an instance that is unreachable or not running returns an error.
exit_code
integer
The command’s exit code. Nonzero is still a 200; read this to branch.
stdout
string
Standard output. Combined stdout and stderr output is capped at 512 KB; see truncated.
stderr
string
Standard error. Shares the 512 KB output cap with stdout.
truncated
boolean
true when output spilled past the 512 KB cap and was cut.
Output is capped at 512 KB, with truncated set when it spills, and a command runs for up to 300 seconds.

Example

curl -X POST https://api.agent37.com/v1/instances/inst_x7/exec \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "command": "openclaw channels add --channel telegram --token 123:ABC" }'

Build on exec

Anything the API does not wrap as its own endpoint, you build on exec. A “Connect Telegram” button, for example, is two commands: add the channel, then approve the pairing code your end user pasted in.
curl
# step two of your "Connect Telegram" button
curl -X POST https://api.agent37.com/v1/instances/inst_x7/exec \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{ "command": "openclaw pairing approve telegram A1B2C3D4" }'
It is also how you install a skill or edit the agent’s config from your backend, with no terminal in the loop.

Next steps

Terminal, desktop & files

Hand an end user a live terminal instead of running commands yourself.

Skills & plugins

Install skills with skills add over exec.