Browse Documentation

Reference / sandboxes / generated

POST/v1/sandboxes/{id}/exec

Run a command in an existing sandbox.

Runs a command without replacing the sandbox, preserving its filesystem and state.

Operation IDrunSandboxCommand
Success200
AuthenticationBearer key

Path parameters

runSandboxCommand path parameters
NameTypeRequirementMeaning
idstringRequiredOpaque, project-scoped Wildflower sandbox ID returned by create. The provider namespace is visible, but the random payload does not encode the provider-native ID.

Optional provider context

These headers are inline overrides. Connected project profiles keep the same fields outside individual requests.

runSandboxCommand header parameters
NameTypeRequirementMeaning
X-Provider-WorkspacestringOptionalOptional inline provider workspace override. Required with an inline Blaxel credential and omitted when using a connected profile.

Request and response

Request bodyRunCommandInput

HTTP example

This credential-safe request and its representative success response are generated with the operation contract. Replace placeholder IDs and read secrets from your environment.

Request

terminal
curl --fail-with-body --request POST \  "$WILDFLOWER_URL/v1/sandboxes/wf_e2b_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/exec" \  -H "Authorization: Bearer $WILDFLOWER_API_KEY" \  -H "Content-Type: application/json" \  --data '{"command":"echo hello","cwd":"/workspace"}'

Response / 200

200.json
{  "sandboxId": "wf_e2b_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",  "stdout": "hello\n",  "stderr": "",  "exitCode": 0}

SDK examples

Use the same operation through any generated client. Each snippet comes from the SDK generator rather than a hand-copied website example.

TypeScriptexample.ts
example.ts
import { Wildflower } from "@wildflowercomputer/sdk";const client = new Wildflower({  wildflowerApiKey: process.env.WILDFLOWER_API_KEY,});const handle = client.sandboxes.attach("wf_e2b_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");const result = await handle.runCommand({  command: "echo hello",  cwd: "/workspace",});console.log(result.stdout, result.stderr, result.exitCode);
Pythonexample.py
example.py
import osfrom wildflower import (    E2bCreateSandboxInput,    ReadFileInput,    RunCommandInput,    WriteFileInput,    Wildflower,)client = Wildflower(    wildflower_api_key=os.environ.get("WILDFLOWER_API_KEY"),)handle = client.sandboxes.attach("wf_e2b_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")result = handle.run_command(    RunCommandInput(command="echo hello", cwd="/workspace"))print(result.stdout, result.stderr, result.exit_code)
Rustexample.rs
example.rs
use wildflower::{    CreateSandboxInput, FileEncoding, ListSandboxesOptions, ReadFileInput,    RunCommandInput, WriteFileInput,    Wildflower,};let client = Wildflower::new(std::env::var("WILDFLOWER_API_KEY")?)?;let handle = client.sandboxes().attach("wf_e2b_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")?;let result = handle.run_command(&RunCommandInput {    command: "echo hello".to_owned(),    cwd: Some("/workspace".to_owned()),    env: None,}).await?;println!("{} {} {}", result.stdout, result.stderr, result.exit_code);
Goexample.go
example.go
client, err := wildflower.NewClient(os.Getenv("WILDFLOWER_API_KEY"))if err != nil {    return err}handle, err := client.Sandboxes.Attach("wf_e2b_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")if err != nil {    return err}cwd := "/workspace"result, err := handle.RunCommand(ctx, wildflower.RunCommandInput{    Command: "echo hello",    Cwd: &cwd,})if err != nil {    return err}fmt.Println(result.Stdout, result.Stderr, result.ExitCode)
Zigexample.zig
example.zig
var client = try Wildflower.init(    allocator,    wildflower_api_key,    transport,);defer client.deinit();var handle = client.attach("wf_e2b_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");var result = try handle.runCommand(.{    .command = "echo hello",    .cwd = "/workspace",});defer result.deinit();std.debug.print("{s} {d}\n", .{ result.value.stdout, result.value.exit_code });

Generated SDK methods

Every name below comes from the generator mapping for this operation, so a language-specific rename creates website drift.