Execution
Run a command (streaming SSE)
Execute a command inside a running session. The response is a Server-Sent Events stream. Each event carries a line of stdout or stderr, or an exit code event when the command finishes. SSE comment lines (starting with `:`) are sent every 10 seconds as keepalives and should be ignored by the client.
POST
/projects/{projectId}/sessions/{sessionId}/execHTTP client
Set up your HTTP client with the auth header before calling the API. Match the authentication type shown above.
const BASE_URL = 'https://api.mudbase.dev/api/sandboxes';
const HEADERS = {
'x-api-key': 'sk_YOUR_API_KEY',
'Content-Type': 'application/json',
};const BASE_URL = 'https://api.mudbase.dev/api/sandboxes';
const HEADERS = {
'x-api-key': 'sk_YOUR_API_KEY',
'Content-Type': 'application/json',
};Example request
Call this endpoint using the client from SDK setup. Use View HTTP for a raw cURL example.
const res = await fetch('https://api.mudbase.dev/api/sandboxes/projects/YOUR_PROJECT_ID/sessions/YOUR_SESSION_ID/exec', {
method: 'POST',
headers: HEADERS,
body: JSON.stringify({
"cmd": [
"node",
"-e",
"console.log('hello')"
],
"timeoutMs": 39262,
"workingDir": "circuit parse"
}),
});
const data = await res.json();const res = await fetch('https://api.mudbase.dev/api/sandboxes/projects/YOUR_PROJECT_ID/sessions/YOUR_SESSION_ID/exec', {
method: 'POST',
headers: HEADERS,
body: JSON.stringify({
"cmd": [
"node",
"-e",
"console.log('hello')"
],
"timeoutMs": 39262,
"workingDir": "circuit parse"
}),
});
const data = await res.json();Playground
liveTest this endpoint with your own credentials. Your requests will be sent to the live API.
Get your API key from the console
No Request Yet
Send a request to see the full inspector
Authentication
Requires API Key
Note
Include your API key in the
X-API-Key: YOUR_KEY header (server-to-server, SDKs). View authentication guide →Path Parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | - |
sessionId | string | Yes | - |
Request Body
json
{
"cmd": [
"node",
"-e",
"console.log('hello')"
],
"timeoutMs": 39262,
"env": {},
"workingDir": "circuit parse"
}{
"cmd": [
"node",
"-e",
"console.log('hello')"
],
"timeoutMs": 39262,
"env": {},
"workingDir": "circuit parse"
}Responses
200SSE stream.