Advanced

Generation Pipeline

How Ghostbox turns API documentation into fully functional, stateful sandboxes -- no manual coding required.

How it works

Ghostbox uses a three-step AI pipeline to generate sandbox implementations from API documentation. The entire process is automated -- you provide a docs URL, and the pipeline produces a deployable sandbox.

1

Scrape

The pipeline fetches and extracts text content from the API's documentation URL. It handles rendered JavaScript, pagination across doc pages, and strips navigation chrome to produce clean, structured text.

2

Analyze

An AI model reads the scraped documentation and produces a structured analysis: resources, endpoints, authentication scheme, pagination style, error format, ID formats, and relationships between resources.

Example analysis output (abbreviated)json
{
  "name": "acme-api",
  "auth": { "type": "bearer" },
  "pagination": { "style": "cursor", "defaultLimit": 20 },
  "resources": [
    {
      "name": "widgets",
      "endpoints": [
        { "method": "GET",  "path": "/v1/widgets" },
        { "method": "POST", "path": "/v1/widgets" },
        { "method": "GET",  "path": "/v1/widgets/:id" }
      ]
    }
  ]
}
3

Generate & Deploy

Using the analysis, the pipeline generates deterministic handler code, test suites, and sandbox configuration. The generated code is validated against the test suite before being deployed. If tests fail, the pipeline self-corrects and retries.

How to request a new sandbox

You can request a new API sandbox from the dashboard. Provide the API's documentation URL and a name, and the generation pipeline handles the rest.

Via CLIbash
# Request a new sandbox via the Ghostbox CLI
ghostbox generate --name "acme-api" \
  --docs-url "https://docs.acme.com/api/reference"

Generation typically takes 2-5 minutes depending on API complexity. You can track progress in the dashboard or via the CLI with ghostbox status acme-api.

Pipeline status tracking

Each generation job progresses through tracked steps. You can monitor the current step, view logs, and see error details if a step fails.

StepDescription
scrapeFetching and extracting documentation content
analyzeAI analysis of API structure and patterns
generateCode generation for handlers and tests
validateRunning test suite against generated code
deployPublishing the sandbox to the runtime

If a step fails, the job status is set to failed with a detailed error message. Failed jobs can be retried from the dashboard or CLI.

Generated vs. static sandboxes

Ghostbox ships with hand-crafted static sandboxes for popular APIs (Stripe, PostHog, Resend, Mailchimp). Generated sandboxes use the same runtime engine but are built automatically from documentation.

AspectStaticGenerated
AccuracyHand-verified, highest fidelityAI-verified, high fidelity for common patterns
CoverageCurated set of popular endpointsAll documented endpoints (or 501 for edge cases)
AvailabilityImmediate2-5 minutes after request
RuntimeSame engineSame engine

Both types support the same features: stateful storage, error injection via X-Sandbox-Error, latency simulation, session isolation, and authentication.

Next steps

Try generating a sandbox or explore the existing API simulations.