Fetch API
Get the main content of 1 to 10 web pages from their URLs, as markdown or plain text, in a single API call — so your agent does not have to fetch and parse them itself. PDF and DOCX files are supported too.
Code
Each page is served from the Staan index when it holds a version that is fresh enough for you, and fetched live otherwise. You only pay for the URLs returned with content.
Beta
The Fetch API is in beta and is opened on request: write to support@staan.ai to have it enabled on your account. Parameters and response fields may still change.
Not sure which endpoint to use?
Use Fetch API to read pages whose URLs you already have. To find those URLs from a query, use Web Search API, then fetch only the results you need. If you want the full content of every result by default, use Web Search for AI API.
Quick start
cURL
Python
TypeScript
Authentication
Every request must include an Authorization header:
Code
The key must have access to the Fetch API. Without it, the request gets 403 SCOPE_NOT_GRANTED.
Parameters
Parameters are sent as a JSON body. Only urls is required.
| Parameter | Type | Default | Description |
|---|---|---|---|
urls | string[] | — | URLs to fetch, 1 to 10 per call, http or https. Duplicates are fetched and billed once. |
format | string | markdown | Format of the extracted content: markdown or text. |
include_images | boolean | false | Keeps the images of the main content, as  with absolute URLs. Requires the markdown format. |
include_raw_html | boolean | false | Also returns the raw HTML of the page in raw_html, even when no main content could be extracted from it. |
max_age | number | — | Maximum age, in seconds, of a cached version. 0 always fetches live, -1 never does. See Freshness. |
Body example — at most one hour old, as plain text
Validation
- Unknown parameters are rejected with a
400that names them, instead of being silently ignored — a typo never goes unnoticed. - A URL sent without a scheme (
example.com/page) getshttps://, and is returned that way inurl. Other schemes (mailto:,ftp:…) are rejected. include_imageswithformat: "text"is rejected with a400.
Freshness: cache or live
A page can come from two places:
- the cache — the Staan index (pages already crawled) and the pages fetched live recently;
- a live fetch, made during your request.
max_age sets how old a cached version you accept:
max_age | A cached version exists and is fresh enough | No cached version, or too old |
|---|---|---|
| omitted | Served, whatever its age | Live fetch |
N (seconds) | Served if it is at most N seconds old | Live fetch |
0 | Ignored | Live fetch |
-1 | Served, whatever its age | not_found error — never a live fetch |
- A failed live fetch returns an error for that URL, never an older cached version: when you set
max_age, you know whether you got fresh content. - A page fetched live is then reused for up to 4 hours (1 hour with
include_raw_html) by the requests that use the sameformat,include_imagesandinclude_raw_html. - With
include_raw_htmlorinclude_images, pages are fetched live more often — and are therefore slower — since not every indexed version keeps its HTML and images. - PDF and DOCX files are always fetched live.
In the response, source tells where each page came from (cache or live), and fetched_at when that version was retrieved: this is the date compared to max_age.
Response
Each requested URL appears once, either in results with its content or in errors.
Example response
Response fields
| Field | Type | Always present | Description |
|---|---|---|---|
request_id | string | Yes | Request identifier — include in support tickets. |
results[].url | string | Yes | Requested URL, with https:// added when it was sent without a scheme. |
results[].final_url | string | No | URL of the served content, after redirects. |
results[].title | string | No | Page title. |
results[].content | string | null | Yes | Main content of the page. null when it could not be extracted and the page is returned for its raw_html only. |
results[].content_error | string | No | Why content is null: extraction_failed, or too_short (often a page that requires JavaScript). |
results[].content_format | string | Yes | Format of content actually returned: markdown or text. It can differ from the requested format — see the note below. |
results[].file_type | string | Yes | html for a web page, pdf or docx for a file. |
results[].raw_html | string | No | Raw HTML of the page, with include_raw_html only. |
results[].metadata.description | string | No | Description of the page. |
results[].metadata.language | string | No | Language of the content (ISO 639-1), detected from its text. |
results[].metadata.site_name | string | No | Name of the website. |
results[].metadata.published_at | string | No | Publication date (ISO 8601, to the day), or modification date when it is the only one available. Best effort. |
results[].metadata.image | string | No | Main image of the page. |
results[].fetched_at | string | No | When the served version was retrieved (ISO 8601): crawl date for the index, fetch date for a live fetch. |
results[].source | string | Yes | live: fetched during this request. cache: served from the index or a previous fetch. |
errors[].url | string | Yes | Requested URL. |
errors[].status | string | Yes | Error category — see Errors. |
errors[].message | string | Yes | Human-readable message. |
errors[].http_status | number | No | HTTP status code returned by the website, when it answered (e.g. 404, 403, 503). |
usage.urls_billed | number | Yes | Number of billed URLs — see Billing. |
Requested format vs returned format
content_format is text even when you asked for markdown in two cases: PDF and DOCX files, and some indexed versions that are only stored as plain text. Read content_format rather than assuming the requested format.
PDF and DOCX files
Files are handled without any parameter: the type is detected from the file itself, whatever the URL looks like (with or without .pdf).
- Plain text only, whatever the requested
format(content_format: "text"): no images, no raw HTML, no markdown headings or tables. - The title and creation date of the file are returned in
titleandmetadata.published_at, when the file declares them. - Files are always fetched live.
- Limits: 20 MB per file, no OCR. A scanned, protected or corrupted PDF returns an
error. - Any other binary file (image, archive…) returns
unsupported.
Errors
A URL that could not be served does not fail the whole request: the call returns 200, and the URL is listed in errors with a status.
status | When |
|---|---|
timeout | The live fetch took longer than 20 seconds. |
blocked | The domain cannot be fetched (blocked domain, IP address), or the website denied access (HTTP 401 or 403). |
not_found | The page does not exist (HTTP 404 or 410), or is not in the cache with max_age: -1. |
unsupported | Binary file other than PDF or DOCX, or page with no usable content (less than 50 characters — usually a page that requires JavaScript). |
error | Any other failure: other HTTP error from the website, content that could not be extracted, internal error. |
With include_raw_html, a page with no usable content is not an error: it is returned in results with content: null, a content_error and its raw_html.
Errors on the request itself use HTTP status codes:
| HTTP | Error | Cause |
|---|---|---|
400 | invalid parameter | Unknown parameter, invalid URL, more than 10 URLs, invalid value |
403 | SCOPE_NOT_GRANTED | The key does not have access to the Fetch API |
403 | KEY_DISABLED | The key is disabled |
429 | too many requests | Rate limit exceeded |
Billing
usage.urls_billed is the number of URLs returned in results:
- URLs in
errorsare not billed; - a URL sent twice in the same request is fetched and billed once;
- a page returned only for its
raw_html(content: null) is billed; - a page served from the cache is billed like a page fetched live.
Limits
| Limit | Value |
|---|---|
| URLs per request | 10 |
| Live fetch time | 20 seconds per URL, content extraction included |
| File size | 20 MB (PDF, DOCX) |
| Rate limit | Set per account, separately from search — excess traffic is rejected with a 429 |
Known limitations:
- JavaScript-rendered pages and pages behind a login (YouTube, Facebook, Instagram, TikTok…) are not supported: they return
unsupported. include_raw_htmlmakes responses heavy — several hundred kilobytes for a single news homepage.include_imagesis experimental: some images can be missing, some are decorative (icons, logos), and captions or photo credits can end up in the text.- There is no market or language parameter: live fetches request the English version of a page when the website offers several.