For the complete documentation index, see llms.txt. This page is also available as Markdown.

Actions

When making a Browser Request, you can specify a list of actions you want us to perform on the requested web page. These actions conform to the following format:

{
    "type": "", //the type of the action
    //other params follow as key-value pairs
    "key": value //string, number, etc. 
}

Universal Parameters

All actions have the following parameters:

Name
Type
Required
Description

type

string

The type name of the action.

continue_on_fail

boolean

Should execution of further actions continue or throw an error if this action fails. Default: false

custom_id

string

A custom_id to help you find the action in the response. Default: null

Action Execution

Actions are carried out in the order they are submitted. Every action type has a continue_on_fail parameter, which defaults to false.This means that if any action fails, the execution of the browser request ends, and an error will be returned. Setting continue_on_fail to true ensures that all actions are carried out, regardless of the previous action's results, and an error will not be returned.

Custom Id

As shown above, you can submit a custom_id with each action you submit to the API. We'll include this ID in the outputs from the browser request so you can find a certain action's output and/or status easily in the response.

Response Format

When a browser request has completed, information on an action's execution

Choosing an action

I want to…

Use

Not

Send page content to an LLM

capture_dom — too big and too noisy

Find selectors on a page I don't know

generate_markdown — it drops the structure you need

Work out why a selector isn't matching

generate_simplified_dom — it may have removed what you're looking for

Turn one HTML table into rows

parse_json — you'd pay credits for something free, and it wouldn’t be deterministic

Pull structured data out of prose, a PDF, or a messy layout

parse_table — it only reads <table> markup

Get the contents of one element I know about

capture_dom — it returns the whole page

Show what a page looked like

generate_markdown — no visual record

Keep a copy of a page I can look at again later

capture_screenshot — you can't search an image

Turn a page into a PDF

capture_snapshot — that gives you HTML

Get a file the browser has open

print — it re-renders the page instead of taking the file

Capture several pages of results in one request

Sending one request per page — you'd pay the page load each time |

Supported Actions

The Gaffa API supports the following actions, detailed below. Click the "read more" buttons to read more information about each type.

Actions without outputs

Type

block_dom_removals

Description

Prevents the page from removing elements from the DOM.

Type

click

Description

Click on a given element

Read More
Type

scroll

Description

Scroll to a particular point on the page or, in the case of pages with infinite scrolling, scroll until a given time has elapsed.

Read More
Type

select

Description

Select one or more options in a dropdown or multi-select field

Read More
Type

type

Description

Type the provided text into a given element

Read More
Type

wait

Description

Wait for a given time to elapse or an element to appear on page before proceeding to the next action.

Read More

Actions with outputs

Type

capture_cookies

Description

Save a JSON object of cookies for the current page

Type

capture_dom

Description

Export the raw DOM page data

Read More
Type

capture_screenshot

Description

Capture a screenshot of the web page

Read More
Type

capture_element

Description

Export the contents of a single element on the page

Type

capture_snapshot

Description

Create a completely static version of the web page which can be accessed offline

Read More
Type

download_file

Description

Download an online file using Gaffa

Read More
Type

generate_markdown

Description

Convert the page into markdown

Read More
Type

generate_simplified_dom

Description

Generate a simplified version of the DOM

Type

parse_json

Description

Parse online data to a defined JSON schema

Read More
Type

parse_table

Description

Convert an HTML table into JSON rows

Read More
Type

print

Description

Print the web page to a PDF

Read More

Flow Actions

Type

loop

Description

Runs nested actions repeatedly until it reaches a limit, times out, or an action fails.

Read more
Tips
  • Actions run in the order you list them, so put your capture actions last.

  • Set continue_on_fail: true on anything optional, like closing a cookie banner. Otherwise, a single failure halts the entire request.

  • Set a custom_id on each action so you can find its output in the response.

  • You don't need a wait before click, capture_element or parse_table. They already wait for their own selector.

  • Add a selector to generate_markdown or parse_json to reduce what you capture and what you pay for.

  • If you're not sure an action worked, add a capture_screenshot after it.

  • Use loop when you need more than one page from a single request, rather than sending a request per page.

  • Inside a loop, put capture actions before the action that navigates. Anything after a failing action is skipped for that pass.


FAQs

In what order do Gaffa actions run?

Actions run one after another, in the order you list them in the actions array.

How do I capture multiple pages in a single request?

Use the loop action. It repeats a nested list of actions, so one request can page through search results or a numbered list. Loops can't be nested inside each other.

What happens when a Gaffa action fails?

The browser request stops and returns an error, and the remaining actions are skipped. Set continue_on_fail: true on that action if you want the rest to run anyway. Inside a loop, a failure skips the rest of that iteration rather than ending the request, and the loop's stop_on_fail decides whether it exits or starts the next pass.

How do I find the output of a specific action in the response?

Give the action a custom_id when you send it. Gaffa returns that ID in the response, so you can look up the action's output without counting through the array.

Can I use the same action twice in one request?

Yes. Add it at each point where you need it — for example, a before-and-after screenshot of a click. Give each one a different custom_id so you can tell them apart.

Which Gaffa actions cost extra credits?

parse_json is the only one. It's billed on the tokens sent to and returned by the AI model. Keep costs down with selector, input_token_cap and max_pages.

Last updated