Scout · Endpoints

Journey

Run a multi-step browser flow in one request — navigate, interact, extract, screenshot, or evaluate — with optional visual debug screenshots per step.

POST/v1/journeyAPI key

Cost: 10 + 2 per step (+15 if any evaluate; +1 per debug screenshot, or +1 reserved when on_error_only).

Concept

A journey keeps one browser context for the whole request: cookies, storage, and navigation state carry across steps. Use it when steps depend on each other (login → click → assert).

JourneyJobs
ShapeOne target flow, many ordered stepsMany independent operations (often many URLs)
Browser stateShared (cookies, session) across stepsEach nested request is isolated
Use whenMulti-step path on the same siteBatch screenshots/extracts across a URL list
EndpointPOST /v1/journeyPOST /v1/jobs

Do not use a journey to “fan out” unrelated URLs — that is what jobs are for.

Request body

NameTypeRequiredDescription
stepsarrayrequiredOrdered steps (1–40).
width / heightnumberoptionalViewport size (overridden by device presets on other endpoints; journey uses width/height/user_agent).
user_agentstringoptionalOverride UA for the journey context.
headersobjectoptionalExtra HTTP headers for navigations.
cookiesarrayoptionalSeed cookies — requires verified domain for sensitive journeys.
dismiss_cookie_bannerbooleanoptionalAfter each navigate/set_content, best-effort known CMP accept (no domain verify).
debugboolean | objectoptionalAttach per-step URL + optional viewport screenshots for authoring.

Step types

NameTypeDescription
navigatestepLoad url. Optional wait_until, timeout_ms.
set_contentstepInject html into the page (isolated content).
interactstepclick / type / fill / scroll / hover / press_key / select_option / wait / wait_for_selector — verified domain.
extractstepInline fields[] like POST /v1/extract.
visibilitystepInline visibility check for selector.
screenshotstepCapture viewport/fullpage into step data.base64.
evaluatestepRun JS expression — Pro / internal only; verified domain.
wait_for_functionstepPoll expression until truthy (timeout_ms).

Interact actions

When type is interact, set action plus the fields for that action:

NameTypeDescription
clickactionRequires selector.
typeactionselector + text; optional clear.
fillactionselector + text (replace value).
scrollactionOptional selector or y offset.
hoveractionRequires selector.
press_keyactionkey (e.g. Enter); optional selector focus.
select_optionactionselector + value.
waitactionms delay.
wait_for_selectoractionselector + optional state / timeout_ms.

Domain verify

Sensitive steps
interact, evaluate, and client cookies require verified ownership for every navigate host. Read-only journeys (navigate + extract / visibility / screenshot / wait) do not. dismiss_cookie_banner is allowed without verify (fixed CMP allowlist only).

Visual debug

Set debug: true (or an options object) while authoring journeys. Each step result gains debug.url and usually debug.screenshot.base64 (viewport JPEG). Decode the base64 to preview what the headless browser saw after that step.

NameTypeRequiredDescription
debugtrueoptionalShorthand: screenshots after every step.
debug.screenshotsbooleanoptionalDefault true. Set false to only attach debug.url.
debug.on_error_onlybooleanoptionalOnly capture a screenshot on the failing step.
debug.formatjpeg | pngoptionalDefault jpeg.
debug.quality1–100optionalJPEG quality (default 72).
json
{
  "debug": { "on_error_only": false, "format": "jpeg", "quality": 72 },
  "steps": [
    { "type": "navigate", "url": "https://example.com" },
    { "type": "interact", "action": "click", "selector": "a.pricing" },
    { "type": "extract", "fields": [{ "name": "h1", "selector": "h1", "type": "text" }] }
  ]
}
bash
# After a debug journey, decode one step shot:
# steps[i].debug.screenshot.base64 → file
echo "$BASE64" | base64 -d > step-2.jpg
Credits & size
Full-step debug screenshots add +1 credit per step and grow the JSON response. Use { "on_error_only": true } once a journey is stable.

Example (login + extract)

bash
curl -X POST https://scout.macrocontent.dev/v1/journey \
  -H "Authorization: Bearer sk_scout_…" \
  -H "Content-Type: application/json" \
  -d @journey.json
json
{
  "steps": [
    { "type": "navigate", "url": "https://example.com/login" },
    { "type": "interact", "action": "fill", "selector": "#email", "text": "demo.user" },
    { "type": "interact", "action": "click", "selector": "button[type=submit]" },
    { "type": "extract", "fields": [{ "name": "welcome", "selector": "h1", "type": "text" }] }
  ]
}

Response shape

json
{
  "status": "success",
  "steps": [
    {
      "index": 0,
      "type": "navigate",
      "ok": true,
      "data": { "url": "https://example.com/" },
      "debug": {
        "url": "https://example.com/",
        "screenshot": { "format": "jpeg", "base64": "…" }
      }
    }
  ],
  "final_url": "https://example.com/",
  "cookies": [],
  "response_time_ms": 1234,
  "debug": {
    "enabled": true,
    "screenshots": true,
    "on_error_only": false,
    "screenshot_count": 1
  },
  "timestamp": "…"
}

HTTP 200 when every step ok; 422 if a step fails (partial steps[] still returned — useful with debug).