tools

Drive a browser across several calls, keeping the page, its cookies and its login in between. The loop is: open a session on a URL, snapshot it to list the interactive elements as refs (@e1, @e2 ...), act on those refs, read the content (the whole page by default, onlyMainContent: true for the main article block alone), close. Because the page stays open you can look before each step instead of committing to a whole chain up front, so a wrong selector costs one call rather than all of them. Not for a page that renders without interaction (scrape), and not for an interaction you can write out in advance — that is one scrape_with_actions call.

post/tools/browser_session

Request

  • Base URL: https://www.crawlforge.dev/api/v1
  • URL: https://www.crawlforge.dev/api/v1/tools/browser_session
  • Auth: API key in header X-API-Key

Request body

operation'open' | 'snapshot' | 'act' | 'read' | 'screenshot' | 'close' | 'list' required

What this call does to the session. Every operation but open and list needs session_id. Priced per operation, not per call: open 3, read 2, snapshot / act / screenshot / close / list 1 each.

session_idstring

The id operation "open" returned. Required by snapshot, act, read, screenshot and close.

urlstring

open: the URL to load the session on

stealthboolean

open: run the session in the stealth browser instead of the standard pool

ttlnumber

open: seconds the session may live from the moment it opens (30-3600, default 600)

activity_ttlnumber

open: seconds the session may sit idle between calls (10-3600, default 300). The session dies at whichever of the two clocks runs out first.

timeoutnumber

Per-action timeout in ms (10000-120000). The REST call itself waits up to ~50s, so a timeout above that cannot be reached here.

respect_robotsboolean

Respect the target site's robots.txt. Omitted, the compliant default (true) applies: a URL disallowed for CrawlForge is refused before the browser opens and no credits are charged, and every navigate action inside the session is checked the same way. It applies to the call it is sent on and is never remembered by the session, so an override has to be repeated on each call that navigates. Setting this to false is honoured, returns a warning in the response, and is recorded against your API key.

interactive_onlyboolean

snapshot: give refs to interactive elements only. Set false to list headings and landmarks too; only interactive elements are ever given a ref.

max_nodesnumber

snapshot: cap on how many nodes the tree lists (1-1000). The result reports truncated: true when the cap stopped the walk.

continue_on_errorboolean

act: keep going past a failed action instead of stopping the call

onlyMainContentboolean

read: false (default) returns the whole page as markdown/text (markdown leaves out nav, footer and aside elements, as scrape's does; text leaves out nothing); true keeps only the main article block via Readability, which drops navigation and footers but can also drop list items on listing and app pages. The result's extractionMethod says which ran ("full_page" for the whole page).

full_pageboolean

screenshot: capture the full scrollable page

format'png' | 'jpeg'

screenshot: image format

qualitynumber

screenshot: JPEG quality (0-100)

selectorstring

screenshot: capture just this element (a @e ref works)

max_inline_charsnumber

Largest result returned inline, in characters of its JSON (1000-10000000; env CRAWLFORGE_MAX_INLINE_CHARS sets the default). Over it, the result is stored for 1 hour and the response carries a preview, a result_handle, total_chars and truncated: true; read the rest with read_result (1 credit).

Response

The tool's result; 3 credits charged (see x-credits-note and x-extra for add-ons).

successtrue required
dataobject required

The tool's result. Its shape is tool-specific and documented on the tool's docs page (x-docs-url on the operation).

credits_usedinteger required

Credits charged for this call: the operation's x-credits, plus any add-on x-credits-note or x-extra describes.

credits_remaininginteger required

The account's credit balance after this call.

processing_timeinteger required

Server-side processing time in milliseconds.

warningsstring[]

Non-fatal notes: a robots.txt override that was recorded, a format that could not be produced, a redaction that changed the payload.

Changes

No recorded changes to this operation across all 1 revision of this API.