fetch_http
Fetch a URL with a plain HTTP request through Zyte API: any HTTP method, optional request body, custom headers. Returns the page as Markdown by default; see 'format'. Fast and cheap; never executes JavaScript or renders the page. Use for static pages, form posts, and — with 'format': 'raw' — JSON/GraphQL/XHR API endpoints. For JavaScript-rendered pages, browser actions, or screenshots use fetch_page; for structured data (products, articles, jobs) use extract_from_http, or extract_from_browser when the page needs rendering. Returns a JSON metadata block (final URL, target HTTP status, optional headers/cookies) followed by the content in the chosen format.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Absolute http(s) URL to fetch (max 8192 chars). The host must be a domain name, not an IP address. | |
| tags | No | Arbitrary key/value pairs (string values or null) attached to the request for filtering in the Zyte Stats API. | |
| device | No | Device type to emulate. Default desktop. | |
| format | No | How to return the response: 'markdown' (default; the main content as Markdown, without navigation, headers, footers and sidebars), 'fullPageMarkdown' (the whole page as Markdown) or 'raw' (the response body as received — text, or an image block for images). In the Markdown formats, JSON and other non-HTML text come back in a code block, and a PDF, image or other binary response as a short note; use 'raw' for API endpoints, images, or when the exact bytes matter. HEAD requests always use 'raw'. | markdown |
| ipType | No | Type of IP address to send the request from. Default: Zyte API picks the type that avoids bans for the target site. | |
| method | No | HTTP method. Default GET. | |
| headers | No | Custom HTTP request headers (max 200). The Cookie header is not allowed — use requestCookies. Zyte API sends some headers automatically for ban avoidance and may override or drop custom ones. | |
| bodyText | No | UTF-8 text to send as the request body (max 400000 chars), e.g. a JSON or GraphQL payload. Mutually exclusive with bodyBase64. | |
| sessionId | No | Client-managed session ID — a version 4 UUID you generate. Requests with the same ID reuse the same session (IP, cookies). Sessions expire 15 minutes after creation, after 2 idle minutes, or after 3 bans. | |
| bodyBase64 | No | Base64-encoded bytes to send as the request body (max 400000 chars encoded), for binary or non-UTF-8 content. Mutually exclusive with bodyText. | |
| geolocation | No | ISO 3166-1 alpha-2 country code to route the request from (e.g. 'US', 'DE'). Default: Zyte API picks a geolocation that avoids bans and locale surprises for the target site. | |
| followRedirect | No | Whether to follow HTTP redirects. Default true. | |
| organizationId | Yes | Required. The Zyte organization to attribute this call to (max 100 characters, printable ASCII without spaces). If you do not already have an id, call the user_info tool: it lists the organizations your credential belongs to. IMPORTANT: if it lists more than one, ask the user which to use and wait for their answer — this call is billed to whichever organization you name here, so it is the user's choice to make, not yours. Never guess an id, and never fall back to a default. Once the user has chosen, reuse that id across the session unless they ask for a different organization. | |
| requestCookies | No | Cookies to send with the request (max 100). The responseCookies output of a previous call can be passed here verbatim. | |
| sessionContext | No | Server-managed session context: up to 10 name/value pairs. Zyte API reuses or creates a session per distinct context. Sessions expire after 4 hours or 3 bans. | |
| enableZeroTrace | No | Keep the URL and other potentially sensitive request data out of Zyte API's request logs, metrics and stats records for this request. Default false. Use it for sensitive targets; it also leaves Zyte support less to go on when investigating the request. | |
| responseCookies | No | Return the cookies set during the request in the metadata block. Prefer this over Set-Cookie response headers — it reflects the final cookie state. | |
| cookieManagement | No | How cookies are handled: 'auto' (default) uses requestCookies if given, otherwise Zyte API's automatic cookies; 'discard' uses requestCookies if given, otherwise no cookies. | |
| verifyCertificate | No | Validate the target site's TLS certificate and return an error instead of the page when validation fails. Default false — certificates are not validated. Browser fetches always validate them, so fetch_page has no such argument. | |
| sessionContextActions | No | Browser actions run once to initialize a server-managed session for the given sessionContext (e.g. login steps). Each action takes the parameters documented in the Zyte API actions reference (https://docs.zyte.com/zyte-api/usage/reference.html), e.g. selector {type: css|xpath, value}, timeout, source, url, keyword. Parameters are validated against the Zyte API contract. | |
| includeResponseHeaders | No | Include the target response's HTTP headers in the metadata block. |