Quickstart

Provision your first sandbox in under 2 minutes
View as MarkdownOpen in Claude

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 dashboardSettings → 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

1import { ModboxClient } from "modbox-sdk";
2
3const client = new ModboxClient({ token: "YOUR_API_TOKEN" });
4
5// Provision a sandbox
6const { sandboxId } = await client.provisionSandbox({
7 taskId: "my-first-sandbox",
8});
9
10// Wait until it's running
11const sandbox = await client.waitForSandbox({ taskId: "my-first-sandbox" });
12
13console.log("Sandbox is live at:", sandbox.sandboxUrl);
14// → 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.

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

5. Destroy the sandbox

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

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

Next steps