Skip to main content

Automation API

Drive a real browser programmatically: login flows, form filling, data extraction after JavaScript, screenshots — with persistent sessions.

POST /v1/automate

Execute a sequence of browser automation steps. Sessions persist across calls, so you can log in once and keep working.

Request body (AutomateRequest):

FieldTypeDefaultDescription
session_idstringReuse an existing browser session
stepsarray<AutomateStep>Required. Ordered list of steps
headlessbooleantrueRun headless
viewportobjectViewport override {width, height}

Step schema (AutomateStep):

FieldTypeDefaultDescription
actionstringRequired. Step action (see below)
selectorstringCSS selector for the target element
valuestringValue to type/set
urlstringURL for navigate
timeoutinteger30000Step timeout (ms)
wait_untilstringnetworkidleWait condition

Actions include navigate, click, type, extract, and more (wait, screenshot, scroll, submit, …).

Example — login flow:

curl -X POST http://localhost:8005/v1/automate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <key>" \
-d '{
"steps": [
{"action": "navigate", "url": "https://login.example.com"},
{"action": "type", "selector": "#username", "value": "user"},
{"action": "type", "selector": "#password", "value": "pass"},
{"action": "click", "selector": "#login-btn"},
{"action": "extract", "selectors": {"title": "h1"}}
]
}'

Response (200): the extracted data from the final step, e.g. { "title": "Welcome, user" }.

Sessions

Sessions let you keep cookies, storage, and login state between requests.

EndpointPurpose
POST /v1/session/createCreate a persistent browser session (?persist=true to persist to disk)
GET /v1/sessionsList all persisted sessions
POST /v1/session/saveSave current session state (cookies, storage) to disk
POST /v1/session/restoreRestore a saved session into a browser context
POST /v1/session/destroyDestroy a session (save_state optionally saves first)

Example — create and reuse:

# Create
curl -X POST "http://localhost:8005/v1/session/create?persist=true" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <key>" \
-d '{}'

# → { "session_id": "sess_abc123" }

# Reuse in automation
curl -X POST http://localhost:8005/v1/automate \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <key>" \
-d '{
"session_id": "sess_abc123",
"steps": [{"action": "navigate", "url": "https://example.com"}]
}'

Saved sessions are stored in the sessions volume (/app/sessions in Docker, ~/.pry/sessions on bare metal) and survive restarts.

Screenshots

EndpointPurpose
POST /v1/screenshotTake a screenshot of a URL
POST /v1/ssCLI alias (pry ss <url> -o shot.png)

Example:

curl -X POST http://localhost:8005/v1/screenshot \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <key>" \
-d '{"url": "https://example.com", "fullPage": true}'

TLS impersonation

The anti-detection stack includes TLS fingerprint randomization (tls_fingerprint.py) — per-request unique TLS fingerprints so the transport layer doesn't give the bot away. Combined with the stealth engine and browser pool, this makes the browser look like a genuine client at the network level.

Camoufox (Firefox anti-detection)

For the highest-fidelity stealth, Pry integrates Camoufox — a patched Firefox build that evades fingerprinting more effectively than Playwright/Puppeteer. It's a drop-in Playwright alternative focused on stealth:

  • Patches Firefox at the source level to bypass fingerprinting
  • Ships multiple default configurations (e.g. chrome_windows) for a convincing browser profile
  • Falls back gracefully when camoufox is not installed

Camoufox is part of the BSL-licensed stealth module — free for non-production use (see Pricing & Monetization).

Anti-detection in automation

Automated browsers automatically inherit the stealth stack:

  • 6 injected stealth scripts (webdriver hiding, canvas/WebGL/audio noise, human mouse/typing behavior)
  • Cookie warming and behavioral biometrics for session realism
  • Random human-like delays between steps (PRY_MIN_DELAY_MS / PRY_MAX_DELAY_MS)

See Stealth & Anti-detection for the full picture.

Other automation endpoints

EndpointPurpose
POST /v1/record/startAction recorder — record real browser actions
POST /v1/auth/captchaCAPTCHA solving (6 providers with auto-fallback)
POST /v1/auth/credentialsEncrypted credential vault
POST /v1/auth/ssoSSO login script generation
POST /v1/auth/session/healthSession health check
GET /v1/cookies/sessionsList cookie sessions

Next steps