# Quickstart

Flashbox gives your agent a Linux sandbox for thin commands: fetching pages and APIs, reading and searching files, small edits and short scripts. You pay per command, idle sandboxes cost nothing, and every command ends in a checkpoint you can roll back to.

## 1. Get an API key

[Sign in with GitHub](/app/) and create a key in the dashboard. Keys start with `fbx_` and are shown once.

```sh
export FLASHBOX_API_KEY=fbx_...
export FLASHBOX_API_URL=https://flashbox.app
```

## 2. Create a sandbox and run a command

With curl:

```sh
curl -s -X POST $FLASHBOX_API_URL/v1/sandboxes \
  -H "Authorization: Bearer $FLASHBOX_API_KEY" -H "content-type: application/json" -d '{}'
# {"id":"sbx_...","state":"running","head":"ck_...", ...}

curl -s -X POST $FLASHBOX_API_URL/v1/sandboxes/sbx_.../commands \
  -H "Authorization: Bearer $FLASHBOX_API_KEY" -H "content-type: application/json" \
  -d '{"command":"curl -s https://example.com | grep -o \"<title>.*</title>\""}'
# {"exitCode":0,"stdout":"<title>Example Domain</title>\n", "checkpoint":{"id":"ck_...","kind":"files"}, ...}
```

With the TypeScript SDK (one file, no dependencies: [download it](/sdk/flashbox.ts)):

```ts
import { Flashbox } from "./flashbox.ts";

const fb = new Flashbox(); // reads FLASHBOX_API_KEY and FLASHBOX_API_URL
const sb = await fb.create();
const r = await sb.run("python3 -c 'print(sum(range(100)))'");
console.log(r.stdout, r.checkpoint.id, r.cost.usd);
```

## 3. Undo and branch

Every command returns a checkpoint id. Roll the sandbox back to one, or fork it into new sandboxes:

```ts
const before = await sb.run("echo draft > notes.md");
await sb.run("rm notes.md");
await sb.rollback(before.checkpoint.id);   // notes.md is back
const [a, b] = await fb.fork(before.checkpoint.id, 2);
```

## 4. Give it to your agent

Point any MCP client at the hosted endpoint, `https://flashbox.app/mcp`, with your key as a bearer token. See [MCP](/docs/mcp/).

## What to read next

- [Commands](/docs/commands/): timeouts, the CPU budget, what counts as heavy
- [Checkpoints](/docs/checkpoints/): files and memory, rollback, fork, retention
- [Billing](/docs/billing/): what a command costs and what is free
