Skip to main content
Test a small program against a package without running it on the caller’s machine. The endpoint creates an isolated Upstash Box, installs the listed packages, writes your files, runs the entry file, and returns structured stdout/stderr. The response includes a sessionId you can pass on the next call to reuse the same box. The box is paused between runs so it has no hard TTL.

Endpoint

Base URL:
Pass config and secrets through optional env as { name, value?, secret? }. Each item needs a value or a secret. Logs store env names only. The sandbox allows outbound network so live vendor API calls can run. JavaScript and TypeScript (runtime: node) use the Bun runtime to add packages and run files. Pass sessionId from a previous result to reuse the same sandbox. The box is paused between runs and has no hard TTL.

Request body

Query parameter format is json (default) or toon, same as the other tools endpoints.

Example request

Response

A failed snippet is still HTTP 200 with ok: false. HTTP 422 is invalid input. HTTP 503 means the sandbox provider is unavailable. HTTP 429 is the dedicated 5 requests/minute limiter.

Typical workflow

  1. Call GET /tools/search.
  2. Call GET /tools/context/:slug for install and usage context.
  3. Write a small program from that context.
  4. Call POST /tools/test with runtime, packages, and files.