const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://example.com', formats: {markdown: true}})
};
fetch('https://api.context.dev/v1/web/scrape', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"url": "https://example.com/",
"html": {
"requested": false,
"success": null,
"data": null
},
"markdown": {
"requested": true,
"success": true,
"data": "# Example Domain"
},
"screenshot": {
"requested": false,
"success": null,
"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
},
"metadata": {
"sourceUrl": "https://example.com",
"finalUrl": "https://example.com/",
"title": "Example Domain"
},
"cache_metadata": {
"status": "miss",
"age_ms": 0
},
"key_metadata": {
"credits_consumed": 1,
"credits_remaining": 999
},
"request_id": "d7aa1c3a-38d2-4fb5-92c8-0f0cac3efa37"
}Scrape Anything
Scrape anything from a URL on the internet. Returns the outputs you enable in formats. Handles PDFs, DOCX, PPT, XLSX, and 40 other file formats.
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://example.com', formats: {markdown: true}})
};
fetch('https://api.context.dev/v1/web/scrape', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"url": "https://example.com/",
"html": {
"requested": false,
"success": null,
"data": null
},
"markdown": {
"requested": true,
"success": true,
"data": "# Example Domain"
},
"screenshot": {
"requested": false,
"success": null,
"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
},
"metadata": {
"sourceUrl": "https://example.com",
"finalUrl": "https://example.com/",
"title": "Example Domain"
},
"cache_metadata": {
"status": "miss",
"age_ms": 0
},
"key_metadata": {
"credits_consumed": 1,
"credits_remaining": 999
},
"request_id": "d7aa1c3a-38d2-4fb5-92c8-0f0cac3efa37"
}Authorizations
Send Authorization: Bearer <API_KEY>. Keys have full access unless restricted to scopes.
Body
Public HTTP or HTTPS URL to scrape.
^https?://Outputs to return. Set at least one to true.
Show child attributes
Show child attributes
Markdown options. Requires formats.markdown.
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
Requires formats.parse: true; required when it is set.
Show child attributes
Show child attributes
Requires formats.highlights: true; required when it is set.
Show child attributes
Show child attributes
Requires formats.json: true; required when it is set.
Show child attributes
Show child attributes
Product options. Requires formats.product: true.
Show child attributes
Show child attributes
Browser and content settings shared by all outputs.
Show child attributes
Show child attributes
Maximum age of a cached output, in milliseconds. 0 fetches fresh. Defaults to 3 days (259200000 ms). Maximum: 1 year (31536000000 ms).
0 <= x <= 31536000000enabled turns on zero data retention. Your organization must have ZDR enabled.
enabled, disabled Deadline for the whole request. Defaults to 90000 ms with fail. Fixed waits must end before it.
Show child attributes
Show child attributes
Labels for tracking request usage. Not retained when zdr is enabled.
201 - 50["production", "team-alpha"]
Response
Every output key is present; check each output's success. Failed outputs include error_code and message.
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
Screenshot as a base64 image data URL.
Show child attributes
Show child attributes
Images after content filters. [] when none are found.
Show child attributes
Show child attributes
The original HTTP response body, unchanged by waits, actions, and filters.
Show child attributes
Show child attributes
Fields from parseParams.rules, after content filters. Unmatched fields are null ([] for lists).
Show child attributes
Show child attributes
Relevant Markdown excerpts in page order. [Heading] adds context; … marks omitted text.
Show child attributes
Show child attributes
Page metadata. Fields are omitted when not found.
Show child attributes
Show child attributes
Whether this response came from cache.
Show child attributes
Show child attributes
Unique ID of this request, also in X-Request-Id. Include it when contacting support.
"3f1c2a6e-8b4d-4c1e-9f0a-2d7b5e6c8a91"
Object matching jsonParams.schema.
Show child attributes
Show child attributes
Product details found on the page.
Show child attributes
Show child attributes
True when at least one requested output succeeds but the response has failed or incomplete outputs. Absent when all requested outputs fail.
Credits this request used and your remaining balance.
Show child attributes
Show child attributes
Was this page helpful?