Quickstart
Create a sandbox, run a command, and delete it when the work finishes.
Get an API key
Create a key at id.tangle.tools and add credit to your account.
Set TANGLE_API_KEY in your environment.
Keep this key on your server.
See Authentication for key setup.
Install
npm install @tangle-network/sandbox
npm install --save-dev tsxTypeScript and JavaScript use the Sandbox SDK. Python uses the HTTP API through HTTPX.
Run a command
Save TypeScript as example.ts and run npx tsx example.ts with Node.js 22 or later.
For JavaScript, use example.mjs and node example.mjs.
For Python, use example.py and python example.py.
import { Sandbox } from '@tangle-network/sandbox';
const apiKey = process.env.TANGLE_API_KEY;
if (!apiKey) throw new Error('Set TANGLE_API_KEY');
const tangle = new Sandbox({
apiKey,
baseUrl: 'https://sandbox.tangle.tools',
});
const box = await tangle.create({
maxLifetimeSeconds: 900,
});
await box.waitFor('running');
const result = await box.exec('node --version');
console.log(result.stdout);
await box.delete();