CLI Usage
Install sandboxes, generate new ones from API docs, and manage your setup -- all from the terminal.
Installation
Install the Ghostbox CLI globally or use it via npx without installing.
npm install -g ghostboxnpx create-ghostbox@latestThe create-ghostbox scaffolder walks you through project setup, API key configuration, and installs your first sandbox.
ghostbox init
Initialize Ghostbox in an existing project. Creates a .ghostboxrc.json config file and prompts for your API key.
ghostbox init
# Interactive prompts:
# ? Enter your Ghostbox API key: sandbox_test_...
# ? Which services do you want to add? (select with space)
# > Stripe
# > Resend
# > PostHog
# > Mailchimp
#
# Created .ghostboxrc.json
# Ready to go!ghostbox add
Add a sandbox to your project. For built-in services, just pass the name. For custom APIs, pass a documentation URL and Ghostbox will generate a sandbox automatically.
# Instantly available -- no generation needed
ghostbox add stripe
ghostbox add resend
ghostbox add posthog
ghostbox add mailchimp# Provide a docs URL to generate a sandbox
ghostbox add hubspot --docs-url https://developers.hubspot.com/docs/api/overview
# Ghostbox analyzes the documentation and generates a
# full sandbox with endpoints, validation, and state.
# Once ready, it's available for all users to discover.ghostbox search
Search the sandbox registry for services other users have already generated.
ghostbox search payment
# Results:
# stripe 28 endpoints Built-in
# square 15 endpoints Community
# paypal 12 endpoints Community
#
# Use 'ghostbox add <name>' to installghostbox list
Show all sandboxes installed in the current project.
ghostbox list
# Installed sandboxes:
# Service Endpoints Base URL
# stripe 28 https://ghostbox.dev/sandbox/stripe
# resend 10 https://ghostbox.dev/sandbox/resend
# posthog 10 https://ghostbox.dev/sandbox/posthogConfiguration
The .ghostboxrc.json file in your project root stores your sandbox configuration. The CLI reads and writes this file automatically.
{
"apiKey": "sandbox_test_abc123...",
"services": {
"stripe": {
"baseUrl": "https://ghostbox.dev/sandbox/stripe",
"version": "1.0.0"
},
"resend": {
"baseUrl": "https://ghostbox.dev/sandbox/resend",
"version": "1.0.0"
},
"hubspot": {
"baseUrl": "https://ghostbox.dev/sandbox/hubspot",
"version": "0.1.0",
"generated": true
}
}
}The generated: true flag indicates a sandbox was automatically generated rather than hand-crafted. Generated sandboxes support CRUD operations but may not cover all edge cases.
Command reference
| Command | Description |
|---|---|
ghostbox init | Initialize Ghostbox in current project |
ghostbox add <service> | Add a built-in or generated sandbox |
ghostbox add <name> --docs-url <url> | Generate a new sandbox from API docs |
ghostbox search <query> | Search the sandbox registry |
ghostbox list | List installed sandboxes |
ghostbox remove <service> | Remove a sandbox from project |
ghostbox status | Check API key validity and quota usage |
ghostbox --help | Show help for all commands |