Get batch status and results
curl --request GET \
--url https://api.prefetch.io/batch/scrape/{id} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.prefetch.io/batch/scrape/{id}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.prefetch.io/batch/scrape/{id}', 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.prefetch.io/batch/scrape/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.prefetch.io/batch/scrape/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.prefetch.io/batch/scrape/{id}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prefetch.io/batch/scrape/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"status": "pending",
"url": "<string>",
"total": 123,
"completed": 123,
"failed": 123,
"credits_used": 123,
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"error": "<string>",
"next": "<string>",
"data": [
{
"url": "<string>",
"depth": 123,
"status_code": 123,
"ok": true,
"error": "<string>",
"error_code": "TARGET_SERVER_ERROR",
"final_url": "<string>",
"domain": "stripe.com",
"metadata": {
"source_url": "<string>",
"final_url": "<string>",
"status_code": 123,
"title": "Stripe | Financial Infrastructure",
"description": "<string>",
"language": "en",
"canonical_url": "<string>",
"favicon": "<string>",
"author": "<string>",
"site_name": "<string>",
"published_time": "<string>",
"modified_time": "<string>",
"robots": "<string>",
"keywords": [
"<string>"
],
"open_graph": {},
"twitter": {},
"json_ld": [
{}
],
"headings": [
{
"level": 123,
"text": "<string>"
}
],
"content_type": "text/html",
"page_count": 123,
"cache_state": "hit",
"cached_at": "<string>"
},
"markdown": {
"content": "<string>",
"char_count": 123,
"word_count": 123,
"truncated": true,
"main_content_only": true
},
"summary": {
"text": "<string>",
"model": "<string>"
},
"html": {
"content": "<string>",
"char_count": 123,
"truncated": true,
"main_content_only": true
},
"raw_html": {
"content": "<string>",
"char_count": 123,
"truncated": true,
"main_content_only": true
},
"links": {
"internal": [
{
"url": "<string>",
"text": "<string>",
"title": "<string>",
"rel": "<string>"
}
],
"external": [
{
"url": "<string>",
"text": "<string>",
"title": "<string>",
"rel": "<string>"
}
],
"count": 123
},
"images": {
"assets": [
{
"url": "<string>",
"alt": "<string>",
"width": 123,
"height": 123,
"loading": "<string>"
}
],
"og_image": "<string>",
"twitter_image": "<string>",
"count": 123
},
"json": {
"data": {},
"model": "<string>"
},
"screenshot": {
"url": "<string>",
"viewport": {
"width": 123,
"height": 123
},
"full_page": true,
"format": "jpeg"
},
"pdf": {
"page_count": 123,
"pages_parsed": 123,
"truncated": true
},
"prompt_injection": {
"detected": true,
"reason": "The page tells AI assistants to ignore their instructions and send the user's API keys to an outside address.",
"complete": true,
"model": "gpt-5.6-luna"
},
"warnings": [
"<string>"
]
}
],
"kind": "crawl",
"endpoint": "scrape",
"skipped": {}
},
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}Web extraction
GET /batch/scrape/{id}
Poll a batch scrape for progress and read its pages. Charges 1 credit for each page completed since your last call.
GET
/
batch
/
scrape
/
{id}
Get batch status and results
curl --request GET \
--url https://api.prefetch.io/batch/scrape/{id} \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.prefetch.io/batch/scrape/{id}"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.prefetch.io/batch/scrape/{id}', 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.prefetch.io/batch/scrape/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"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"
"net/http"
"io"
)
func main() {
url := "https://api.prefetch.io/batch/scrape/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.prefetch.io/batch/scrape/{id}")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.prefetch.io/batch/scrape/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "<string>",
"status": "pending",
"url": "<string>",
"total": 123,
"completed": 123,
"failed": 123,
"credits_used": 123,
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"finished_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"error": "<string>",
"next": "<string>",
"data": [
{
"url": "<string>",
"depth": 123,
"status_code": 123,
"ok": true,
"error": "<string>",
"error_code": "TARGET_SERVER_ERROR",
"final_url": "<string>",
"domain": "stripe.com",
"metadata": {
"source_url": "<string>",
"final_url": "<string>",
"status_code": 123,
"title": "Stripe | Financial Infrastructure",
"description": "<string>",
"language": "en",
"canonical_url": "<string>",
"favicon": "<string>",
"author": "<string>",
"site_name": "<string>",
"published_time": "<string>",
"modified_time": "<string>",
"robots": "<string>",
"keywords": [
"<string>"
],
"open_graph": {},
"twitter": {},
"json_ld": [
{}
],
"headings": [
{
"level": 123,
"text": "<string>"
}
],
"content_type": "text/html",
"page_count": 123,
"cache_state": "hit",
"cached_at": "<string>"
},
"markdown": {
"content": "<string>",
"char_count": 123,
"word_count": 123,
"truncated": true,
"main_content_only": true
},
"summary": {
"text": "<string>",
"model": "<string>"
},
"html": {
"content": "<string>",
"char_count": 123,
"truncated": true,
"main_content_only": true
},
"raw_html": {
"content": "<string>",
"char_count": 123,
"truncated": true,
"main_content_only": true
},
"links": {
"internal": [
{
"url": "<string>",
"text": "<string>",
"title": "<string>",
"rel": "<string>"
}
],
"external": [
{
"url": "<string>",
"text": "<string>",
"title": "<string>",
"rel": "<string>"
}
],
"count": 123
},
"images": {
"assets": [
{
"url": "<string>",
"alt": "<string>",
"width": 123,
"height": 123,
"loading": "<string>"
}
],
"og_image": "<string>",
"twitter_image": "<string>",
"count": 123
},
"json": {
"data": {},
"model": "<string>"
},
"screenshot": {
"url": "<string>",
"viewport": {
"width": 123,
"height": 123
},
"full_page": true,
"format": "jpeg"
},
"pdf": {
"page_count": 123,
"pages_parsed": 123,
"truncated": true
},
"prompt_injection": {
"detected": true,
"reason": "The page tells AI assistants to ignore their instructions and send the user's API keys to an outside address.",
"complete": true,
"model": "gpt-5.6-luna"
},
"warnings": [
"<string>"
]
}
],
"kind": "crawl",
"endpoint": "scrape",
"skipped": {}
},
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}{
"error": "Credit limit exceeded",
"error_code": "CREDITS_EXHAUSTED",
"retryable": false,
"success": false,
"retryAfterSeconds": 123,
"limit": 123,
"meta": {
"requestId": "a3f2c1d4-7b6e-4f2a-9c1d-8e3f2a1b4c5d",
"durationMs": 1842
}
}Overview
The same response asGET /crawl/{id}, with kind: "batch": progress, plus a page of scraped pages in completion order. Follow next until it is null to read every page. Results stay readable for 24 hours after the batch finishes.
Each page carries ok. A failed page has ok: false, an error, and an error_code, and is not charged.
Example request
cURL
curl "https://api.prefetch.io/batch/scrape/crw_5a8d2e7f1c4b4a9e8d3c6b1a0f9e8d7c" \
-H "X-API-Key: $PREFETCH_API_KEY"
Authorizations
Your Prefetch API key. Obtain one from the dashboard.
Path Parameters
The crawl id returned by POST /crawl.
Example:
"crw_9f2c1a7b4e0d4c3a8b1e5f7d2c9a0b3e"
Query Parameters
Number of result pages to skip. Use the next link rather than building this by hand.
Required range:
x >= 0Number of crawled pages to return per request.
Required range:
1 <= x <= 100