Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Meza-dev/Ghostly/llms.txt

Use this file to discover all available pages before exploring further.

The POST /v1/run endpoint accepts a structured browser automation plan and launches it as a background job. The server responds with HTTP 202 and a { ok, id, status } envelope as soon as the run is registered — execution continues asynchronously. Use GET /v1/runs/:id to poll the final result or GET /v1/runs/:id/events/stream for live Server-Sent Events.

Authentication

Pass either an API key via the X-Api-Key header or a JWT via the Authorization: Bearer <token> header. Every request also requires Content-Type: application/json.

Request Body

project
string
required
Slug of an existing project that belongs to your account. The run is associated with this project for filtering and grouping.
baseUrl
string (URL)
required
The root URL of the application under test (e.g. https://app.example.com). All goto step URLs must share the same origin as baseUrl.
steps
Step[]
required
Ordered list of browser actions to execute. At least one step is required for non-assisted runs. Maximum 25 steps by default.
headless
boolean
default:"true"
Run the Chromium browser in headless mode. Set to false only for local debugging.
captureScreenshotAfterEachStep
boolean
default:"false"
Save a PNG screenshot after every step. Paths are returned in each StepOutcome.screenshotPath.
captureA11yAfterEachStep
boolean
default:"false"
Capture the full accessibility tree after each step and attach it to the corresponding StepOutcome.a11y field.
recordVideoOnFailure
boolean
default:"false"
Record a WebM video of the session and persist it when the run ends in fail status. The path is returned as RunRecord.videoPath.
artifactsDir
string
default:"artifacts"
Local directory (relative to the runner process) where screenshots and videos are written.
defaultTimeoutMs
number
default:"30000"
Per-step timeout in milliseconds. Must not exceed 120 000 ms. Individual waitForSelector steps may override this via their own timeoutMs field.
contextId
string
Arbitrary string that links this run to an external context, such as a Git commit SHA or CI build ID.
assisted
object
Metadata produced by the Ghostly AI planner (v1). Present when the run was generated by POST /v1/plan.
assist
object
Enables AI-assisted v2 mode — the engine drives the browser autonomously toward a goal using horizon-based planning and self-healing. Cannot be combined with a manually authored steps array as the primary plan.
codeHints
object
Static context about the application’s component library, forms, routes, and selectors. Helps the AI planner produce more accurate selectors.
plan
object
An alternative envelope for passing run configuration, used by the Ghostly MCP submit_plan tool. Top-level fields take precedence over any matching keys inside plan.

Guardrails

The server enforces the following hard limits regardless of what you pass:
GuardrailDefault
maxSteps25
maxTimeoutMs120 000 ms
enforceSameOrigintrue — all goto URLs must share the origin of baseUrl

Responses

ok
true
Always true on a successful 202 response.
id
string (UUID)
Unique identifier for the newly created run. Use it with GET /v1/runs/:id, POST /v1/runs/:id/cancel, and the SSE stream endpoint.
status
"running"
Always "running" in the 202 response — the run has been accepted and is executing in the background.

Error Responses

StatusBody
400{ ok: false, error: "validación", details: object } — Zod validation failure
400{ ok: false, error: "project requerido" } — missing or blank project field
400{ ok: false, error: "project inválido" } — project not found for your account
400{ ok: false, error: "codeHints inválido", details: object }
400{ ok: false, error: "assisted inválido", details: object }
400{ ok: false, error: "assist inválido", details: object }assist object failed validation
409{ ok: false, error: "assist v2 deshabilitado" } — v2 not enabled on this server
500{ ok: false, error: "no se pudo crear run", message: string }

Examples

curl -X POST https://api.ghostly.dev/v1/run \
  -H "X-Api-Key: gly_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "project": "my-app",
    "baseUrl": "https://staging.example.com",
    "steps": [
      { "action": "goto", "url": "https://staging.example.com/login" },
      { "action": "fill", "selector": "#email", "value": "user@example.com" },
      { "action": "fill", "selector": "#password", "value": "s3cr3t" },
      { "action": "click", "selector": "button[type=submit]" },
      { "action": "waitForSelector", "selector": ".dashboard", "timeoutMs": 10000 }
    ],
    "captureScreenshotAfterEachStep": true,
    "recordVideoOnFailure": true
  }'
The run executes in the background — the 202 response is returned before the browser flow completes. Use GET /v1/runs/:id to poll the final result, or subscribe to GET /v1/runs/:id/events/stream for real-time progress events.

Build docs developers (and LLMs) love