Quickstart

Provision your first sandbox in under 2 minutes
View as Markdown

This guide takes you from zero to a running sandbox using the Modbox SDK or REST API.

1. Get your API token

Go to the Modbox dashboard → Settings → API Tokens and create a new token.

Keep your token safe. It grants full access to your workspaces and sandboxes.

2. Install the SDK

npm install modbox-sdk

3. Provision a sandbox

import { ModboxClient } from "modbox-sdk";
const client = new ModboxClient({ token: "YOUR_API_TOKEN" });
// Provision a sandbox
const { sandboxId } = await client.provisionSandbox({
taskId: "my-first-sandbox",
});
// Wait until it's running
const sandbox = await client.waitForSandbox({ taskId: "my-first-sandbox" });
console.log("Sandbox is live at:", sandbox.sandboxUrl);
// → https://my-first-sandbox.sandbox.modbox.run

4. Interact with the sandbox

Once status is running, the sandbox_url field contains a live HTTPS endpoint. What you can do depends on the image — a browser sandbox exposes CDP, a code execution sandbox exposes an HTTP API, etc.

// Example: call a REST endpoint inside the sandbox
const response = await fetch(`${sandbox.sandboxUrl}/execute`, {
method: "POST",
body: JSON.stringify({ code: "print('hello world')", language: "python" }),
});

5. Destroy the sandbox

Always clean up after you’re done, or set a TTL so it’s automatic.

await client.destroySandbox({ taskId: "my-first-sandbox" });

Next steps