{
"url": "https://example.com",
"formats": {
"html": true
}
}curl https://api.context.dev/v1/web/scrape \
-H "Authorization: Bearer $CONTEXT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"formats": {
"html": true
}
}'import requests
url = "https://api.context.dev/v1/web/scrape"
payload = {
"url": "https://example.com",
"formats": { "html": True }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://example.com', formats: {html: true}})
};
fetch('https://api.context.dev/v1/web/scrape', 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.context.dev/v1/web/scrape",
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([
'url' => 'https://example.com',
'formats' => [
'html' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.context.dev/v1/web/scrape"
payload := strings.NewReader("{\n \"url\": \"https://example.com\",\n \"formats\": {\n \"html\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.context.dev/v1/web/scrape")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com\",\n \"formats\": {\n \"html\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.context.dev/v1/web/scrape")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com\",\n \"formats\": {\n \"html\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"url": "https://example.com/",
"isPartial": true,
"html": {
"requested": true,
"success": true,
"data": "<h1>Example Domain</h1>"
},
"markdown": {
"requested": true,
"success": true,
"data": "# Example Domain"
},
"screenshot": {
"requested": true,
"success": false,
"data": null
},
"images": {
"requested": false,
"success": null,
"data": null
},
"bytes": {
"requested": false,
"success": null,
"data": null
},
"parsed": {
"requested": false,
"success": null,
"data": null
},
"highlights": {
"requested": false,
"success": null,
"data": null
},
"json": {
"requested": false,
"success": null,
"data": null
},
"product": {
"requested": false,
"success": null,
"data": null
}
}Scrape a URL
Fetch a page once and return HTML, Markdown, screenshots, images, original bytes, CSS-selected fields, highlights, JSON, or product data.
{
"url": "https://example.com",
"formats": {
"html": true
}
}curl https://api.context.dev/v1/web/scrape \
-H "Authorization: Bearer $CONTEXT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"formats": {
"html": true
}
}'import requests
url = "https://api.context.dev/v1/web/scrape"
payload = {
"url": "https://example.com",
"formats": { "html": True }
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://example.com', formats: {html: true}})
};
fetch('https://api.context.dev/v1/web/scrape', 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.context.dev/v1/web/scrape",
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([
'url' => 'https://example.com',
'formats' => [
'html' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.context.dev/v1/web/scrape"
payload := strings.NewReader("{\n \"url\": \"https://example.com\",\n \"formats\": {\n \"html\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.context.dev/v1/web/scrape")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com\",\n \"formats\": {\n \"html\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.context.dev/v1/web/scrape")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com\",\n \"formats\": {\n \"html\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"url": "https://example.com/",
"isPartial": true,
"html": {
"requested": true,
"success": true,
"data": "<h1>Example Domain</h1>"
},
"markdown": {
"requested": true,
"success": true,
"data": "# Example Domain"
},
"screenshot": {
"requested": true,
"success": false,
"data": null
},
"images": {
"requested": false,
"success": null,
"data": null
},
"bytes": {
"requested": false,
"success": null,
"data": null
},
"parsed": {
"requested": false,
"success": null,
"data": null
},
"highlights": {
"requested": false,
"success": null,
"data": null
},
"json": {
"requested": false,
"success": null,
"data": null
},
"product": {
"requested": false,
"success": null,
"data": null
}
}formats to choose outputs. Each output includes requested, success, and data. success is true when retrieved, false when retrieval fails, and null when not requested. Outputs that fail or were not requested return data: null. Successful outputs remain available when another format fails; partial responses set isPartial: true.
The base cost is one credit, including cache hits, or two with browser actions. Highlights, JSON, product extraction, and PDF OCR can add credits; see their schema descriptions for charges. All-failed responses are unbilled except missing pages, which retain the base charge and an additional credit when product was requested.
See Scrape a webpage for content controls, freshness, and dynamic pages, or the format guides for screenshots, images, and bytes.Authorizations
Bearer authentication header of the form Bearer <API_KEY>. Keys have full access by default.
Body
The URL to scrape.
^https?://Outputs to return. Enable at least one; omitted formats are false.
Show child attributes
Show child attributes
Shared browser and content settings. Content filters leave screenshots and original bytes unchanged.
Show child attributes
Show child attributes
Markdown options. Requires formats.markdown: true.
Show child attributes
Show child attributes
Screenshot options. Requires formats.screenshot: true.
Show child attributes
Show child attributes
Image options. Requires formats.images: true.
Show child attributes
Show child attributes
Required when formats.parse is true.
Show child attributes
Show child attributes
Highlight options. Requires formats.highlights: true.
Show child attributes
Show child attributes
Maximum age of each cached output. Defaults to 1 day; 0 fetches fresh and updates the requested outputs. Compatible outputs are shared with the individual scrape endpoints. Image results with hosted files refresh after 23 hours; other outputs retain their own freshness.
0 <= x <= 2592000000Zero data retention. Bypasses caches and uploads; excludes request/response content and tags from logs. Must be enabled for your organization.
enabled, disabled Total deadline, including navigation, actions, waiting, and all outputs. Defaults to 60000 milliseconds with behavior fail. Individual outputs have internal deadlines that reserve time to return completed outputs; timed-out outputs have success: false and data: null under either behavior. The overall request deadline remains enforced: fail returns an error if that deadline is reached. Use return-partial to allow the current page state and available outputs when the page is still loading. Partial responses set isPartial. Failed retrievals and incomplete captures are not cached; valid captured pieces may be cached independently. Fixed waits must fit before a response reserve of up to 5000 milliseconds (at most one quarter of the timeout) when using return-partial.
Show child attributes
Show child attributes
Labels for tracking request usage. Not retained when zdr is enabled.
201 - 50["production", "team-alpha"]
Required when formats.json is true.
Show child attributes
Show child attributes
Product options. Requires formats.product: true.
Show child attributes
Show child attributes
Response
All nine outputs are present. Each output has success: true when retrieved, success: false and data: null when retrieval failed, or requested: false, success: null, and data: null when not requested. A failed output does not discard successful outputs or fail the request.
Final URL after redirects and browser actions.
^https?://Rendered HTML after content filters.
Show child attributes
Show child attributes
Markdown after content filters.
Show child attributes
Show child attributes
An image data URL. Use directly as an image src.
Show child attributes
Show child attributes
Images after content filters. Empty when none are found.
Show child attributes
Show child attributes
Original HTTP response body. Waiting, actions, and content filters never change it.
Show child attributes
Show child attributes
Fields produced by parseParams.rules, after shared content filters.
Show child attributes
Show child attributes
Relevant passages for your question or topic, in page order. A heading in square brackets is included when needed to interpret a passage. Empty when the page has no text.
Show child attributes
Show child attributes
Page details, when available.
Show child attributes
Show child attributes
Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit.
Show child attributes
Show child attributes
Unique id of this API call, also sent in the X-Request-Id response header. Quote it when contacting support about a failed request.
"3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91"
Page data extracted using your schema.
Show child attributes
Show child attributes
Product details found on the page.
Show child attributes
Show child attributes
Present when a requested output fails, capture returns a page that is still loading, images return before processing finishes, or the optional product AI fallback fails or is cut short. Check each output's success field for its result. Valid captured pieces may be cached independently; failed retrievals and incomplete captures are not cached.
Credit usage, included whenever a valid API key is provided.
Show child attributes
Show child attributes
Was this page helpful?