curl --request POST \
--url https://api.fetch.tinyfish.ai/ \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"urls": [
"https://example.com",
"https://example.org"
],
"purpose": "Compare pricing tiers across vendors for a procurement report",
"format": "markdown",
"links": false,
"image_links": false,
"iframe_links": false,
"page_metadata": false,
"ttl": 0,
"per_url_timeout_ms": 45000,
"if_none_match": "W/\"abc123\"",
"if_modified_since": "Wed, 21 Oct 2015 07:28:00 GMT",
"include_etag_and_last_modified": true,
"include_selectors": [
"article"
],
"exclude_selectors": [
".comments",
".newsletter-signup"
]
}
'import requests
url = "https://api.fetch.tinyfish.ai/"
payload = {
"urls": ["https://example.com", "https://example.org"],
"purpose": "Compare pricing tiers across vendors for a procurement report",
"format": "markdown",
"links": False,
"image_links": False,
"iframe_links": False,
"page_metadata": False,
"ttl": 0,
"per_url_timeout_ms": 45000,
"if_none_match": "W/\"abc123\"",
"if_modified_since": "Wed, 21 Oct 2015 07:28:00 GMT",
"include_etag_and_last_modified": True,
"include_selectors": ["article"],
"exclude_selectors": [".comments", ".newsletter-signup"]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
urls: ['https://example.com', 'https://example.org'],
purpose: 'Compare pricing tiers across vendors for a procurement report',
format: 'markdown',
links: false,
image_links: false,
iframe_links: false,
page_metadata: false,
ttl: 0,
per_url_timeout_ms: 45000,
if_none_match: 'W/"abc123"',
if_modified_since: 'Wed, 21 Oct 2015 07:28:00 GMT',
include_etag_and_last_modified: true,
include_selectors: ['article'],
exclude_selectors: ['.comments', '.newsletter-signup']
})
};
fetch('https://api.fetch.tinyfish.ai/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fetch.tinyfish.ai/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'urls' => [
'https://example.com',
'https://example.org'
],
'purpose' => 'Compare pricing tiers across vendors for a procurement report',
'format' => 'markdown',
'links' => false,
'image_links' => false,
'iframe_links' => false,
'page_metadata' => false,
'ttl' => 0,
'per_url_timeout_ms' => 45000,
'if_none_match' => 'W/"abc123"',
'if_modified_since' => 'Wed, 21 Oct 2015 07:28:00 GMT',
'include_etag_and_last_modified' => true,
'include_selectors' => [
'article'
],
'exclude_selectors' => [
'.comments',
'.newsletter-signup'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fetch.tinyfish.ai/"
payload := strings.NewReader("{\n \"urls\": [\n \"https://example.com\",\n \"https://example.org\"\n ],\n \"purpose\": \"Compare pricing tiers across vendors for a procurement report\",\n \"format\": \"markdown\",\n \"links\": false,\n \"image_links\": false,\n \"iframe_links\": false,\n \"page_metadata\": false,\n \"ttl\": 0,\n \"per_url_timeout_ms\": 45000,\n \"if_none_match\": \"W/\\\"abc123\\\"\",\n \"if_modified_since\": \"Wed, 21 Oct 2015 07:28:00 GMT\",\n \"include_etag_and_last_modified\": true,\n \"include_selectors\": [\n \"article\"\n ],\n \"exclude_selectors\": [\n \".comments\",\n \".newsletter-signup\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fetch.tinyfish.ai/")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://example.com\",\n \"https://example.org\"\n ],\n \"purpose\": \"Compare pricing tiers across vendors for a procurement report\",\n \"format\": \"markdown\",\n \"links\": false,\n \"image_links\": false,\n \"iframe_links\": false,\n \"page_metadata\": false,\n \"ttl\": 0,\n \"per_url_timeout_ms\": 45000,\n \"if_none_match\": \"W/\\\"abc123\\\"\",\n \"if_modified_since\": \"Wed, 21 Oct 2015 07:28:00 GMT\",\n \"include_etag_and_last_modified\": true,\n \"include_selectors\": [\n \"article\"\n ],\n \"exclude_selectors\": [\n \".comments\",\n \".newsletter-signup\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fetch.tinyfish.ai/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n \"https://example.com\",\n \"https://example.org\"\n ],\n \"purpose\": \"Compare pricing tiers across vendors for a procurement report\",\n \"format\": \"markdown\",\n \"links\": false,\n \"image_links\": false,\n \"iframe_links\": false,\n \"page_metadata\": false,\n \"ttl\": 0,\n \"per_url_timeout_ms\": 45000,\n \"if_none_match\": \"W/\\\"abc123\\\"\",\n \"if_modified_since\": \"Wed, 21 Oct 2015 07:28:00 GMT\",\n \"include_etag_and_last_modified\": true,\n \"include_selectors\": [\n \"article\"\n ],\n \"exclude_selectors\": [\n \".comments\",\n \".newsletter-signup\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"url": "https://example.com",
"final_url": "https://www.example.com",
"title": "Example Domain",
"description": "This domain is for use in illustrative examples.",
"language": "en",
"format": "markdown",
"text": "<string>",
"author": "John Doe",
"published_date": "2024-01-15",
"links": [
"<string>"
],
"image_links": [
"<string>"
],
"iframe_links": [
"<string>"
],
"page_metadata": {
"canonical": "https://example.com",
"robots": "max-image-preview:large",
"og": {
"title": "Example Domain",
"image": [
"https://example.com/og.png"
]
},
"twitter": {
"card": "summary_large_image"
}
},
"latency_ms": 1183.4,
"not_modified": true,
"etag": "W/\"abc123\"",
"last_modified": "Wed, 21 Oct 2015 07:28:00 GMT",
"unmatched_selectors": [
"aside.related"
]
}
],
"errors": [
{
"url": "https://invalid.example.com",
"error": "target_http_error",
"status": 404,
"unmatched_selectors": [
"article",
"#content"
],
"candidate_selectors": [
"main",
"nav",
"#content"
]
}
],
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}Fetch and extract content from URLs
Fetches web pages, renders JavaScript-heavy pages when needed, and returns clean extracted content in your preferred format. Submit up to 10 URLs, get back structured content. Per-URL failures appear in errors[] and do not fail the entire request.
Per-URL error codes (in errors[].error):
target_http_error— target server returned a non-2xx HTTP status other than 404/410; the raw status code is inerrors[].statuspage_not_found— target URL returned HTTP 404 or 410; the raw status code is inerrors[].statustarget_unreachable— connection refused, TLS failure, DNS failure, or other network errortimeout— request timed outproxy_error— proxy tunnel failurebot_blocked— bot-challenge page detected (Cloudflare, etc.)empty_content— page loaded but no extractable text was foundlogin_required— the target redirected to a login or account wall; retrying without credentials will not helpcontent_too_large— the document exceeds the 20MB size limit for generic documents (PDF and CSV have their own 50MB budgets); not retried in the browserinvalid_url— malformed URL or SSRF-blocked addressinvalid_redirect_url— redirect target rejected before fetchconditional_unsupported— conditional requests (if_none_match/if_modified_since) are supported on the fast path only; this URL requires browser renderingselector_not_matched— no elements matching anyinclude_selectorsentry remained afterexclude_selectorswas applied; the error carriesunmatched_selectorspluscandidate_selectorsretry hints (a partial miss is not an error — it’s reported on the result’sunmatched_selectors)selector_unsupported—include_selectors/exclude_selectorssent for a URL that resolves to a direct PDF/CSV download (no HTML to scope)
curl --request POST \
--url https://api.fetch.tinyfish.ai/ \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"urls": [
"https://example.com",
"https://example.org"
],
"purpose": "Compare pricing tiers across vendors for a procurement report",
"format": "markdown",
"links": false,
"image_links": false,
"iframe_links": false,
"page_metadata": false,
"ttl": 0,
"per_url_timeout_ms": 45000,
"if_none_match": "W/\"abc123\"",
"if_modified_since": "Wed, 21 Oct 2015 07:28:00 GMT",
"include_etag_and_last_modified": true,
"include_selectors": [
"article"
],
"exclude_selectors": [
".comments",
".newsletter-signup"
]
}
'import requests
url = "https://api.fetch.tinyfish.ai/"
payload = {
"urls": ["https://example.com", "https://example.org"],
"purpose": "Compare pricing tiers across vendors for a procurement report",
"format": "markdown",
"links": False,
"image_links": False,
"iframe_links": False,
"page_metadata": False,
"ttl": 0,
"per_url_timeout_ms": 45000,
"if_none_match": "W/\"abc123\"",
"if_modified_since": "Wed, 21 Oct 2015 07:28:00 GMT",
"include_etag_and_last_modified": True,
"include_selectors": ["article"],
"exclude_selectors": [".comments", ".newsletter-signup"]
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
urls: ['https://example.com', 'https://example.org'],
purpose: 'Compare pricing tiers across vendors for a procurement report',
format: 'markdown',
links: false,
image_links: false,
iframe_links: false,
page_metadata: false,
ttl: 0,
per_url_timeout_ms: 45000,
if_none_match: 'W/"abc123"',
if_modified_since: 'Wed, 21 Oct 2015 07:28:00 GMT',
include_etag_and_last_modified: true,
include_selectors: ['article'],
exclude_selectors: ['.comments', '.newsletter-signup']
})
};
fetch('https://api.fetch.tinyfish.ai/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.fetch.tinyfish.ai/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'urls' => [
'https://example.com',
'https://example.org'
],
'purpose' => 'Compare pricing tiers across vendors for a procurement report',
'format' => 'markdown',
'links' => false,
'image_links' => false,
'iframe_links' => false,
'page_metadata' => false,
'ttl' => 0,
'per_url_timeout_ms' => 45000,
'if_none_match' => 'W/"abc123"',
'if_modified_since' => 'Wed, 21 Oct 2015 07:28:00 GMT',
'include_etag_and_last_modified' => true,
'include_selectors' => [
'article'
],
'exclude_selectors' => [
'.comments',
'.newsletter-signup'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fetch.tinyfish.ai/"
payload := strings.NewReader("{\n \"urls\": [\n \"https://example.com\",\n \"https://example.org\"\n ],\n \"purpose\": \"Compare pricing tiers across vendors for a procurement report\",\n \"format\": \"markdown\",\n \"links\": false,\n \"image_links\": false,\n \"iframe_links\": false,\n \"page_metadata\": false,\n \"ttl\": 0,\n \"per_url_timeout_ms\": 45000,\n \"if_none_match\": \"W/\\\"abc123\\\"\",\n \"if_modified_since\": \"Wed, 21 Oct 2015 07:28:00 GMT\",\n \"include_etag_and_last_modified\": true,\n \"include_selectors\": [\n \"article\"\n ],\n \"exclude_selectors\": [\n \".comments\",\n \".newsletter-signup\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.fetch.tinyfish.ai/")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"urls\": [\n \"https://example.com\",\n \"https://example.org\"\n ],\n \"purpose\": \"Compare pricing tiers across vendors for a procurement report\",\n \"format\": \"markdown\",\n \"links\": false,\n \"image_links\": false,\n \"iframe_links\": false,\n \"page_metadata\": false,\n \"ttl\": 0,\n \"per_url_timeout_ms\": 45000,\n \"if_none_match\": \"W/\\\"abc123\\\"\",\n \"if_modified_since\": \"Wed, 21 Oct 2015 07:28:00 GMT\",\n \"include_etag_and_last_modified\": true,\n \"include_selectors\": [\n \"article\"\n ],\n \"exclude_selectors\": [\n \".comments\",\n \".newsletter-signup\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fetch.tinyfish.ai/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"urls\": [\n \"https://example.com\",\n \"https://example.org\"\n ],\n \"purpose\": \"Compare pricing tiers across vendors for a procurement report\",\n \"format\": \"markdown\",\n \"links\": false,\n \"image_links\": false,\n \"iframe_links\": false,\n \"page_metadata\": false,\n \"ttl\": 0,\n \"per_url_timeout_ms\": 45000,\n \"if_none_match\": \"W/\\\"abc123\\\"\",\n \"if_modified_since\": \"Wed, 21 Oct 2015 07:28:00 GMT\",\n \"include_etag_and_last_modified\": true,\n \"include_selectors\": [\n \"article\"\n ],\n \"exclude_selectors\": [\n \".comments\",\n \".newsletter-signup\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"url": "https://example.com",
"final_url": "https://www.example.com",
"title": "Example Domain",
"description": "This domain is for use in illustrative examples.",
"language": "en",
"format": "markdown",
"text": "<string>",
"author": "John Doe",
"published_date": "2024-01-15",
"links": [
"<string>"
],
"image_links": [
"<string>"
],
"iframe_links": [
"<string>"
],
"page_metadata": {
"canonical": "https://example.com",
"robots": "max-image-preview:large",
"og": {
"title": "Example Domain",
"image": [
"https://example.com/og.png"
]
},
"twitter": {
"card": "summary_large_image"
}
},
"latency_ms": 1183.4,
"not_modified": true,
"etag": "W/\"abc123\"",
"last_modified": "Wed, 21 Oct 2015 07:28:00 GMT",
"unmatched_selectors": [
"aside.related"
]
}
],
"errors": [
{
"url": "https://invalid.example.com",
"error": "target_http_error",
"status": 404,
"unmatched_selectors": [
"article",
"#content"
],
"candidate_selectors": [
"main",
"nav",
"#content"
]
}
],
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}{
"error": {
"code": "INVALID_INPUT",
"message": "Field \"url\" is required and must be a string",
"details": "<unknown>"
},
"request_id": "8f9dba20-e37b-4749-a919-2269e28b4a2c"
}Authorizations
Body
URLs to fetch and extraction options
Array of URLs to fetch (1-10). All URLs are fetched in parallel. Each URL is processed independently — if one fails, others still return successfully. Errors are reported per-URL in the errors array.
1 - 10 elements[
"https://example.com",
"https://example.org"
]
Extract the src URLs of elements on each page. Useful when a page embeds its main content in a frame (job boards, booking widgets, document viewers): fetch the returned URL to read the embedded content. Iframe links are returned as absolute, deduplicated URLs in the iframe_links array of each result. Script-injected iframes are only present when the page was rendered in a browser.
false
Return page-head metadata for each page in the page_metadata object of each result: canonical URL, favicon, robots directive, generator, viewport, keywords, all Open Graph (og), Twitter card (twitter), and article tags, and remaining named meta tags under other. Useful for SEO/technical audits and link-preview generation.
false
Caller freshness tolerance in seconds for the cached entry. Omit (default) for unlimited tolerance — any cached entry is acceptable. Set to 0 to prefer a live fetch; a cached entry is still served if the origin's Cache-Control: max-age covers its age, or the host is in the small allowlist of operator-pinned never-expire domains. Set to N > 0 to accept a cached entry whose age is below N; the upstream Cache-Control: max-age and the never-expire allowlist may extend (never shorten) this tolerance.
x >= 00
ETag validator from a prior fetch of this URL, forwarded verbatim as the If-None-Match header on the origin request. Only valid with a single URL — combining with a batch of URLs returns a 400. tf-fetch does not persist validators; the caller owns replaying them.
1"W/\"abc123\""
Last-Modified validator from a prior fetch of this URL, forwarded verbatim as the If-Modified-Since header on the origin request. Only valid with a single URL — combining with a batch of URLs returns a 400. tf-fetch does not persist validators; the caller owns replaying them.
1"Wed, 21 Oct 2015 07:28:00 GMT"
Array of CSS selectors (1-20 entries, each 1-1000 characters) that scope extracted content (text, links, image_links) to elements matching ANY entry, concatenated in document order. Tag selectors cover semantic sections (main, article, nav); entries may themselves use CSS comma-grouping. Selected content is returned verbatim in the requested format (scripts/styles stripped) — automatic boilerplate removal is bypassed. Page-level metadata (title, description, language, author, published_date) still comes from the full document. When some entries match and others do not, the URL still succeeds and the misses are reported in the result's unmatched_selectors. When no entry matches anything, that URL fails with the per-URL error code selector_not_matched (carrying unmatched_selectors and candidate_selectors retry hints) — never a silent full-page fallback. URLs that resolve to direct PDF/CSV downloads fail with selector_unsupported. Invalid CSS selector syntax is rejected with a 422. Applied post-fetch: caching and routing are unchanged.
1 - 20 elements1 - 1000["article"]
Array of CSS selectors (1-20 entries, each 1-1000 characters) for elements to remove before extraction — applied before include_selectors scopes what remains, so it also prunes inside selected regions. Entries may themselves use CSS comma-grouping. Entries that match nothing are a no-op, never an error, but URLs that resolve to direct PDF/CSV downloads fail with selector_unsupported. Invalid CSS selector syntax is rejected with a 422. Applied post-fetch: caching and routing are unchanged.
1 - 20 elements1 - 1000[".comments", ".newsletter-signup"]
Response
Fetch completed. Check errors[] for any per-URL failures.
Fetch response with results and errors
Was this page helpful?