Interactive actions
Click, type, scroll, and wait on a page before capturing it
Interactive actions
Some pages don't show what you want until you act on them. An age gate sits in front of the content, a "load more" button hides the rest of a list, a search box needs a query before there are any results. Hiding elements won't help here, because the content isn't in the DOM until you interact.
actions is an ordered list of steps run on the live page after it loads (and after ad and cookie blocking) and before the screenshot is taken. Up to 25 steps per capture.
{
"url": "https://example.com",
"actions": [
{ "type": "click", "selector": "button:has-text('Accept')", "optional": true },
{ "type": "type", "selector": "input[name=q]", "text": "screenshot api" },
{ "type": "press", "key": "Enter" },
{ "type": "wait", "selector": ".results" }
]
}Action types
| Type | What it does |
|---|---|
click | Click an element matched by selector |
type | Type text into an input. clear replaces the value (default) or appends when false |
press | Press a key like "Enter". Add a selector to focus an element first |
hover | Hover over an element to reveal a menu or tooltip |
select | Choose an option in a native <select> by its value |
scroll | Scroll an element into view, by y pixels, or to the bottom of the page |
wait | Wait for a selector, a fixed delay (ms), or until the network is idle |
Every step also takes two optional fields: optional to skip it instead of failing the capture, and timeout to bound that step (capped at the request timeout).
For the full field reference, limits, and error codes, see the API reference.
Common patterns
Get past a gate
Age gates and consent dialogs block the content behind them. Mark the click optional so the capture still works when the gate was already dismissed by a cookie.
curl -X POST 'https://api.allscreenshots.com/v1/screenshots' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://www.example.com/r/example/",
"fullPage": true,
"actions": [
{ "type": "click", "selector": "button:has-text(\"Yes, I am over 18\")", "optional": true }
]
}' --output page.pngSearch, then capture the results
Type a query, submit it, and wait for the results to render before the shot.
curl -X POST 'https://api.allscreenshots.com/v1/screenshots' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://example.com",
"actions": [
{ "type": "type", "selector": "input[name=q]", "text": "screenshot api" },
{ "type": "press", "key": "Enter" },
{ "type": "wait", "selector": ".results", "timeout": 8000 }
]
}' --output results.pngExpand lazy content
Click "load more", then scroll to the bottom so a full-page capture picks up everything.
{
"url": "https://example.com/feed",
"fullPage": true,
"actions": [
{ "type": "click", "selector": "button:has-text('Load more')", "optional": true },
{ "type": "wait", "networkIdle": true },
{ "type": "scroll", "toBottom": true }
]
}When a step fails
By default, a step that can't run fails the whole capture with 422 ACTION_FAILED: the target never appeared, or the step timed out. Set optional: true on steps that may not apply on every page so the capture continues without them.
A malformed request (a missing required field, more than 25 actions, a value over a limit) is rejected up front with 400 Bad Request. optional does not suppress that.
Don't put credentials or other secrets in a type action's text. Treat actions as part of a logged request. The typed text is used for the capture, but redacted from stored logs.
Where actions run
Actions work the same on every capture path: standard and stealth mode, and on async, bulk, and scheduled jobs. They're available on every plan.