Fetch

Fetch a URL

Fetch one http or https URL and return the destination's response as a JSON envelope, Markdown, or raw bytes. String picks the fetch strategy (direct request or browser, proxy class, captcha solving) automatically. Use it to read a known URL, render JavaScript, run browser actions or take a screenshot, capture a page's XHR calls, or extract fields with a JSON Schema; use searchWeb when you have a query instead of a URL.

post/fetch

Request

  • Base URL: https://request.usestring.ai/v1
  • URL: https://request.usestring.ai/v1/fetch
  • Auth: HTTP bearer

Request body

urlstring uri required

The http or https URL to fetch.

method'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS'

HTTP method. Accepted in any case (get and Post work). Any other method returns a 400. A non-GET method or a body is sent only on fetch paths that deliver it exactly; if none can, the request returns a 400 before anything is sent. A write (POST, PUT, PATCH, DELETE) reaches the destination at most once, so an error on a write does not prove the destination did not act on it.

format'json' | 'raw' | 'markdown'

Response format. json: an envelope with the destination's status, headers, parsed body and final URL. raw: the original bytes, gzip-compressed, with the destination status in x-status-code. markdown: HTML converted to Markdown (text/markdown). See https://portal.usestring.ai/docs/fetch/response-formats

markdownMode'readable' | 'full'

Markdown preservation level. full converts the whole cleaned page, navigation and footers included; readable removes boilerplate for a smaller output. Ignored unless format is markdown.

mainContentOnlyboolean

Remove page chrome before conversion. Ignored unless format is markdown.

jsonSchemaobject

A JSON Schema to extract into with AI. On success the response body is the extracted object itself. Must be a valid JSON Schema object (shorthand such as {"title": "string"} is a 400). Requires format: json. Limits: nesting depth 10, 200 keys, 50 KB serialized. Adds a dynamic extraction fee. See https://portal.usestring.ai/docs/fetch/structured-extraction

executeJSboolean

Render the page in a browser. Incompatible with headers. See https://portal.usestring.ai/docs/fetch/javascript-rendering

requireWSSboolean

Require a browser WebSocket fetch path. Incompatible with headers.

headersobject

Custom HTTP headers to forward (max 50). Direct (request-based) fetch only. Names are case-insensitive and may not repeat in a different case. Values may not contain control characters such as CR, LF or NUL, or characters above U+00FF. Service-managed headers cannot be set: proxy-authorization, proxy-authenticate, proxy-connection, connection, transfer-encoding, content-length, te, upgrade, keep-alive, trailer, host. See https://portal.usestring.ai/docs/fetch/custom-headers

countryCodestring

ISO 3166-1 alpha-2 country for the proxy exit. See https://portal.usestring.ai/docs/fetch/proxies-and-geolocation

solveCaptchaboolean

Solve captcha challenges. false fails on a challenge instead. See https://portal.usestring.ai/docs/fetch/captcha-solving

ignoreCertificateErrorsboolean

Skip TLS certificate verification (the default). Send false to require a valid certificate; a bad certificate then fails with TargetCertificateError. Send false for credentials, payments, or data you will treat as authoritative.

screenshotboolean

Capture a screenshot, returned as base64 in the JSON body. Shorthand for one screenshot action. Mutually exclusive with actions. Billed as a browser session. See https://portal.usestring.ai/docs/screenshots/overview

Response

Successful fetch. The body shape depends on format, jsonSchema, screenshot and actions. The destination's own status is in the JSON statusCode or the x-status-code header; a destination 304 is still an HTTP 200 here.

OR
unknown required

Changes

No recorded changes to this operation across all 1 revision of this API.