String API
Fetch

JavaScript rendering

Render pages in a real browser to reach client-side content.

Most pages are served fastest with a request-based fetch. When a target needs a real browser — to run client-side JavaScript or render a single-page app — you can opt into browser-based fetching.

executeJS

Set executeJS: true to render the page in a browser environment before returning it. This selects browser-based fetch methods and can increase the per-request cost.

curl https://request.usestring.ai/v1/fetch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/spa", "executeJS": true }'

Capture the page's API calls

A rendered page often gets its data from a JSON API. Add captureXHR: true to a rendered fetch to also get the XHR and fetch() requests the page made, with their responses, as xhr. You can filter them down to the calls you want, and include the requests of embedded iframes from other sites. See XHR capture.

curl https://request.usestring.ai/v1/fetch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/spa", "executeJS": true, "captureXHR": { "include": [{ "url": "/api/" }] } }'

Wait for the page to load

A rendered page is read once it has loaded and settled. To also wait for a specific state, such as its load event or its network going idle, set waitUntil. See Waiting for page load.

curl https://request.usestring.ai/v1/fetch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/spa", "executeJS": true, "waitUntil": "networkidle2" }'

Read iframes

A rendered page's HTML holds its <iframe> elements but not the documents inside them. Set includeIframes: true to inline each iframe's content into data, or captureIframes: true to list the iframes with their HTML as iframes. See Iframes.

curl https://request.usestring.ai/v1/fetch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com/spa", "executeJS": true, "includeIframes": true }'

requireWSS

Set requireWSS: true to require a browser WebSocket-capable fetch path for the request.

Header restriction

Custom headers are not supported when executeJS or requireWSS is set — these run through a browser path that doesn't forward arbitrary request headers. Sending headers alongside either of them returns a 400. See Custom headers.