POST v1/browser/request

For more information on browser requests, see here.

The following endpoint creates a browser request and either runs it synchronously or returns immediately with an ID so you can check it status later using this endpoint (TODO).

Create a new browser request

This endpoint loads the required URL in our browser and then performs the selected actions.

POSThttps://api.gaffa.dev/v1/browser/requests
Authorization
Body

Browser request input data

proxy_locationnullable string

The location of the proxy server that your request will be routed through, null means no proxy is used

urlstring

The url you want our browsers to visit on your behalf

asyncboolean

Whether the request should be processed asynchronously, synchronous requests can be maximum 60 seconds long.

max_cache_agenullable integer (int32)

The maximum age of a cached result in seconds. 0 means the cache will never be used

settingsobject

The actions and outputs you want to be executed

Response

The browser request response detailing the state and output of the request

Body
idnullable string

ID of the browser request

urlnullable string

URL of the request

proxy_locationnullable string

The proxy location of the request.

statenullable string

The status of the request

credit_usagenullable integer (int32)

The number of tokens used by the request

errornullable string

Why did this request fail

actual_urlnullable string

The actual URL captured, after any redirects.

http_status_codeenum

The http status code for the request.

100101102103200201202203204205206207208226300300301301302302303303304305306307307308400401402403404405406407408409410411412413414415416417421422422423424426428429431451500501502503504505506507508510511
from_cachenullable boolean

If this request was served from the cached

started_atstring (date-time)

The time in UTC when the request started.

completed_atstring (date-time)

The time in UTC when the request finished.

page_load_timestring (timespan)

How long did the page take to fully render.

actionsnullable array of object

Actions carried out and their results

videonullable string

Video url

Request
const response = await fetch('https://api.gaffa.dev/v1/browser/requests', {
    method: 'POST',
    headers: {
      "Content-Type": "application/json"
    },
    body: JSON.stringify("{\"proxy_location\":null,\"url\":\"https://demo.gaffa.dev/simulate/table?loadTime=3&rowCount=20\",\"async\":false,\"max_cache_age\":0,\"settings\":{\"record_request\":false,\"actions\":[{\"type\":\"wait\",\"selector\":\"table\"},{\"type\":\"print\",\"size\":\"A4\",\"margin\":20}],\"time_limit\":60}}"),
});
const data = await response.json();
Response
{
  "id": "text",
  "url": "text",
  "proxy_location": "text",
  "state": "text",
  "credit_usage": 0,
  "error": "text",
  "actual_url": "text",
  "http_status_code": 100,
  "from_cache": false,
  "started_at": "2025-01-31T01:29:25.441Z",
  "completed_at": "2025-01-31T01:29:25.441Z",
  "page_load_time": "text",
  "actions": [
    {
      "id": "text",
      "type": "text",
      "query": "text",
      "custom_id": "text",
      "timestamp": "2025-01-31T01:29:25.441Z",
      "output": "text",
      "error": "text"
    }
  ],
  "video": "text"
}

Last updated