Skip to Content

actions

actions is a list of things to do on the page before we read it: wait, scroll, wait for an element, hover, click, type text into a field and pick an option in a dropdown. use it to open a “load more” list, close a popup, reach content further down, follow a “next” link, or fill in and send a form, such as a search box. every output shows the page as the actions left it: markdown, cleaned_html, raw_html, links, images, elements, the screenshot and the pdf.

actions works on POST /api/scrape and POST /api/scrape/async. the mcp servers take the actions that read a page (wait, scroll, wait_for, hover and click); to fill in a form, call the api.

{ "url": "https://shop.example.com/books/", "actions": [ { "type": "click", "selector": "button.load-more" }, { "type": "wait_for", "selector": "article.book:nth-of-type(40)" }, { "type": "scroll", "to": "bottom" } ], "extract": { "markdown": false, "metadata": false, "elements": { "titles": { "selector": "article.book h3", "all": true } } } }
curl -X POST https://api.crawlbrulee.com/api/scrape \ -H "Authorization: Bearer $CRAWLBRULEE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://shop.example.com/books/", "actions": [ { "type": "click", "selector": "button.load-more" }, { "type": "wait_for", "selector": "article.book:nth-of-type(40)" }, { "type": "scroll", "to": "bottom" } ], "extract": { "markdown": false, "metadata": false, "elements": { "titles": { "selector": "article.book h3", "all": true } } } }'

response (condensed)

{ "url": "https://shop.example.com/books/", "requested_url": "https://shop.example.com/books/", "page_status_code": 200, "content_type": "text/html", "elements": { "titles": ["The Night Garden", "Paper Boats", "..."] }, "actions": [ { "type": "click", "status": "ok" }, { "type": "wait_for", "status": "ok" }, { "type": "scroll", "status": "ok" } ], "response_meta": { "usage": { "total_credit_cost": 3, "engine_credit_cost": 3, "proxy_multiplier": 1, "screenshot_slicing_credit_cost": 0, "zero_data_retention_credit_cost": 0, "engine": "browser", "proxy": "basic" } } }

the action types

the actions run in the order you list them. every action also takes optional (see when an action fails).

typefieldswhat it does
waitmswaits for that many milliseconds
scrollpixels or to, and optional duration_msscrolls down by pixels (negative scrolls up), or to the top, bottom, left or right of the page, or to an element
wait_forselectorwaits until the element is on the page and visible, for up to 10 seconds
hoverselector, or x and ymoves the mouse over the element, or to a point in the window. desktop only
clickselectorclicks the element (a tap on a mobile device)
typeselector, text, and optional cleartypes the text into the field, up to 200 characters with no line breaks or tabs. clear: true empties the field first
selectselector, and value or labelpicks an option in a dropdown (a <select> field), by its value or by its text as the page shows it
  • selectors are standard css, as a browser reads them. an action uses the first element that matches. click, hover, type, select and a scroll to an element bring it into view first, and wait up to 5 seconds for it to appear. click, type and select find elements on the page itself, not inside a frame.
  • a slow scroll loads more. without duration_ms, a scroll moves at a steady pace and takes up to 5 seconds, so images further down the page have time to load on the way. set duration_ms to choose the time yourself, or 0 to jump at once.
  • hover is for desktop pages. on a mobile page, which has no mouse, it is skipped.

fill in and send a form

to send a form, such as a search box, type into the field, then click its button:

{ "url": "https://shop.example.com/books/", "actions": [ { "type": "type", "selector": "input[name=q]", "text": "night garden" }, { "type": "click", "selector": "form.search button[type=submit]" }, { "type": "wait_for", "selector": "article.book" } ], "extract": { "markdown": false, "metadata": false, "elements": { "titles": { "selector": "article.book h3", "all": true }, "prices": { "selector": "article.book .price", "all": true } } } }
{ "url": "https://shop.example.com/search?q=night+garden", "requested_url": "https://shop.example.com/books/", "page_status_code": 200, "elements": { "titles": ["The Night Garden"], "prices": ["€18.90"] }, "actions": [ { "type": "type", "status": "ok" }, { "type": "click", "status": "ok" }, { "type": "wait_for", "status": "ok" } ] }

to pick an option in a dropdown, such as the sort order, use select with the option’s value or with its label, the text the page shows:

{ "type": "select", "selector": "select[name=sort]", "label": "price: low to high" }
  • type needs a field you can type into. on anything else it fails, and it fails on a password field too.
  • a dropdown the page builds itself, from other elements rather than a <select>, is used with two clicks: one to open it, one on the option.
  • a form that sends itself, such as a dropdown that reloads the page when you pick an option, is followed like a click: see a click that loads a new page.
  • a request with a type action has a lower rate limit: 10 a minute on the free plan, 60 on paid plans. a request with only a select doesn’t count toward it. see rate limits.
  • when the results page has its own url, such as /search?q=night+garden, scrape that url directly instead of filling in the form. it is faster, needs no typing, and can come from the cache.

limits

  • up to 12 actions in one request.
  • 60 seconds for the whole list. if the waits, scroll durations and typing you set add up to more, the request is a 400. an action still running when the 60 seconds are up fails, and the rest of the list doesn’t run.
  • a selector is at most 500 characters, and a type text at most 200.

a list with long waits can take up to a minute, so send it with the async endpoint.

a list that breaks a rule, such as a scroll with both pixels and to, or a selector that isn’t valid css, is refused with a 400 validation_error that says what is wrong. nothing is fetched, so it costs nothing.

cleanup runs first

the page loads, then cleanup runs once, then the actions run. with cleanup.ads_and_popups on (the default), ads, cookie banners and popups are already gone when the first action starts, and so is everything in your cleanup.exclude_selectors. so an action can’t use an element that cleanup removed: a click on it fails.

a popup that opens later, after cleanup, can still cover the element you want to click, and the click then fails. close the popup first, and mark that click optional in case it doesn’t show up:

{ "url": "https://shop.example.com/books/", "actions": [ { "type": "wait", "ms": 2000 }, { "type": "click", "selector": ".newsletter-popup .close", "optional": true }, { "type": "click", "selector": "button.load-more" } ] }

a click that loads a new page

when a click loads a new page, such as a “next” link, we wait for that page to load, clean it up, and run the rest of the list there. the same goes for a type or a select when the page sends the form by itself. the response is that page: its url, its page_status_code and its content. requested_url still says where you started.

{ "url": "https://shop.example.com/books/", "actions": [{ "type": "click", "selector": "a.next" }] }
{ "url": "https://shop.example.com/books/?page=2", "requested_url": "https://shop.example.com/books/", "page_status_code": 200, "markdown": "# books\n\npage 2 of 12 ...", "actions": [{ "type": "click", "status": "ok" }] }

a click that opens a new tab or window is ignored: the response stays on the page you were on.

when you know the new page’s url, such as ?page=2, scrape that url directly instead of clicking to it. the page loads once, not twice, so you get it faster and more reliably. it can come from the cache, and it may not need a browser, so it can cost fewer credits.

the actions report

the response carries actions: one entry for each action you sent, in the same order, with its type and its status.

statusmeaning
okit was done
failedit could not be done, for example its element was not found or was covered by something else, or the page a click loaded failed to load
skippedit could not be done, but it was optional, so the list went on. a hover on a mobile page is always skipped
not_runthe list never got to it

when any action is failed or not_run, warnings has actions_incomplete. a skipped action gives no warning.

in rare cases a page can’t be loaded in a browser. we then fetch it without one and return its content, the actions are not_run, and warnings has actions_incomplete.

when an action fails

an action that fails stops the list: the actions after it are not_run. you still get the page, as it was at that moment, with the actions_incomplete warning. it is billed like any scrape that returns a page.

{ "url": "https://shop.example.com/books/", "page_status_code": 200, "markdown": "# books\n\n...", "actions": [ { "type": "click", "status": "failed" }, { "type": "scroll", "status": "not_run" } ], "warnings": ["actions_incomplete"] }

set "optional": true on an action that may not work every time, like closing a popup that doesn’t always open. when it fails, it is skipped and the list goes on.

retries run the actions again

if a try fails and we try again, the actions run again from the start, on a fresh page. so a click can happen more than once, and a form can be sent more than once. don’t use actions for anything that must happen only once, such as placing an order.

credits and caching

  • the actions cost no extra credits. a request with actions runs in a browser, so it is billed as a browser scrape, or at the screenshot base when it also asks for a screenshot or a pdf. see credits & pricing.
  • a request with actions never reads from or writes to the cache. what the page shows depends on the actions, so it is always fetched fresh. see caching.
  • a list of only zero-value actions (a wait of 0, a scroll of 0 pixels) does nothing on the page: it doesn’t need a browser and doesn’t change caching.

the old name: extract.screenshot.actions_before

before actions, waits and scrolls went in extract.screenshot.actions_before. that name still works and takes the same list, until it is removed on 2027-02-01. when you call the api directly or use an mcp server, send actions. the sdks and the cli send actions_before until their next update.

send the list in actions or in extract.screenshot.actions_before, not in both. a request with a list in both is a 400.