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.
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.
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.
{
"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" }
]
}
]
}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.
# 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.
| Step | Description |
|---|---|
scrape | Fetching and extracting documentation content |
analyze | AI analysis of API structure and patterns |
generate | Code generation for handlers and tests |
validate | Running test suite against generated code |
deploy | Publishing 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.
| Aspect | Static | Generated |
|---|---|---|
| Accuracy | Hand-verified, highest fidelity | AI-verified, high fidelity for common patterns |
| Coverage | Curated set of popular endpoints | All documented endpoints (or 501 for edge cases) |
| Availability | Immediate | 2-5 minutes after request |
| Runtime | Same engine | Same 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.