Scrape Endpoint
Scrape one URL into clean Markdown, HTML, links, images, screenshots, or structured data.
Getting Started
Send your API key as a bearer token. Start with the smallest request below.
Scrape a Page
Send one URL and request only the outputs your application needs.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"formats": [
"markdown",
"links"
]
}'{
"success": true,
"data": {
"markdown": "# Hacker News\n\n1. Show HN: I built an open-source web scraper with strategy caching\n2. Why Rust is eating the world...",
"links": [
"https://news.ycombinator.com/item?id=39912345",
"https://news.ycombinator.com/item?id=39912346",
"https://news.ycombinator.com/newest"
],
"status": "success",
"quality": {
"markdown_len": 12340,
"word_count": 1847,
"links_count": 42,
"headings_count": 8,
"images_count": 3,
"has_title": true,
"empty_reason": null
},
"metadata": {
"title": "Hacker News",
"description": null,
"language": "en",
"source_url": "https://news.ycombinator.com",
"status_code": 200,
"word_count": 1847,
"reading_time_seconds": 7,
"content_length": 12340
},
"time_taken": 0.48
}
}Output Options
Output Formats
Set formats to return Markdown, HTML, raw HTML, links, images, headings, tables, product data, citations, or screenshots.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/products",
"formats": [
"markdown",
"html",
"links",
"images",
"headings"
]
}'{
"success": true,
"data": {
"markdown": "# Products\n\nBrowse the current catalog.",
"html": "<main><h1>Products</h1></main>",
"links": [
"https://example.com/products/widget"
],
"images": [
{
"src": "https://example.com/widget.jpg",
"alt": "Widget"
}
],
"headings": [
{
"level": 1,
"text": "Products"
}
],
"metadata": {
"source_url": "https://example.com/products",
"status_code": 200
}
}
}Markdown Mode
Set format_options.markdown.mode to reader, raw, or prune.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/article",
"formats": [
"markdown"
],
"format_options": {
"markdown": {
"mode": "reader"
}
}
}'{
"success": true,
"data": {
"markdown": "# Example Article\n\nClean article content.",
"metadata": {
"source_url": "https://example.com/article",
"status_code": 200
}
}
}Screenshot
Request a viewport, full-page, or after-actions PNG screenshot.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"formats": [
"screenshot"
],
"format_options": {
"screenshot": {
"capture": "full_page",
"full_page": true,
"width": 1440,
"height": 900
}
}
}'{
"success": true,
"data": {
"screenshot": "data:image/png;base64,iVBORw0KGgo...",
"metadata": {
"source_url": "https://example.com",
"status_code": 200
}
}
}Content Selection
Main Content Only
Set only_main_content to remove navigation, sidebars, and footers. It defaults to true.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/article",
"formats": [
"markdown"
],
"only_main_content": true
}'{
"success": true,
"data": {
"markdown": "# Article\n\nMain article text.",
"metadata": {
"source_url": "https://example.com/article",
"status_code": 200
}
}
}CSS and XPath Targets
Use one target with css_selector or xpath, or return named targets with selectors.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/products/widget",
"formats": [
"markdown"
],
"selectors": {
"title": {
"css": "h1"
},
"price": {
"xpath": "//*[@data-price]"
}
}
}'{
"success": true,
"data": {
"selector_data": {
"title": "Widget",
"price": "$49.00"
},
"metadata": {
"source_url": "https://example.com/products/widget",
"status_code": 200
}
}
}Include and Exclude Tags
Use include_tags and exclude_tags to control which HTML elements reach extraction.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/article",
"formats": [
"markdown"
],
"include_tags": [
"article",
"table"
],
"exclude_tags": [
"aside",
"footer"
]
}'{
"success": true,
"data": {
"markdown": "# Article\n\nSelected article and table content.",
"metadata": {
"source_url": "https://example.com/article",
"status_code": 200
}
}
}Page Behavior
Wait and Timeout
Set wait_for for delayed content and timeout for the request deadline, both in milliseconds.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/app",
"formats": [
"markdown"
],
"wait_for": 1500,
"timeout": 45000
}'{
"success": true,
"data": {
"markdown": "# Loaded Application",
"metadata": {
"source_url": "https://example.com/app",
"status_code": 200
}
}
}Mobile View
Set mobile and an optional device preset to extract the mobile page state.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"formats": [
"markdown",
"screenshot"
],
"mobile": true,
"mobile_device": "iphone_14"
}'{
"success": true,
"data": {
"markdown": "# Example Mobile",
"screenshot": "data:image/png;base64,iVBORw0KGgo...",
"metadata": {
"source_url": "https://example.com",
"status_code": 200
}
}
}Headers and Cookies
Send authenticated or localized page state with custom headers and cookies.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/account",
"formats": [
"markdown"
],
"headers": {
"Accept-Language": "en-US"
},
"cookies": {
"session": "SESSION_VALUE"
}
}'{
"success": true,
"data": {
"markdown": "# Account",
"metadata": {
"source_url": "https://example.com/account",
"status_code": 200
}
}
}Advanced Workflows
Browser Actions
Run clicks, waits, scrolls, typing, key presses, selections, form fills, hover, navigation, or JavaScript before extraction.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/catalog",
"formats": [
"markdown",
"screenshot"
],
"actions": [
{
"type": "click",
"selector": "button.load-more"
},
{
"type": "wait",
"milliseconds": 1000
},
{
"type": "scroll",
"direction": "down",
"amount": 2
}
]
}'{
"success": true,
"data": {
"markdown": "# Expanded Catalog",
"screenshot": "data:image/png;base64,iVBORw0KGgo...",
"metadata": {
"source_url": "https://example.com/catalog",
"status_code": 200
}
}
}Structured Extraction
Add extract.prompt and an optional JSON Schema to return typed fields with the page result.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/products/widget",
"formats": [
"markdown"
],
"extract": {
"prompt": "Extract the product name and price",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"price": {
"type": "string"
}
}
}
}
}'{
"success": true,
"data": {
"extract": {
"name": "Widget",
"price": "$49.00"
},
"metadata": {
"source_url": "https://example.com/products/widget",
"status_code": 200
}
}
}Network Capture
Set capture_network to include page request and response details.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/app",
"formats": [
"markdown"
],
"capture_network": true
}'{
"success": true,
"data": {
"markdown": "# Application",
"network_data": {
"requests": [],
"responses": []
},
"metadata": {
"source_url": "https://example.com/app",
"status_code": 200
}
}
}Completion
Webhook
Set webhook_url to receive completion or failure events. Set webhook_secret to verify X-DataBlue-Signature.
curl -X POST "https://api.datablue.dev/v1/scrape" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"formats": [
"markdown"
],
"webhook_url": "https://api.example.net/webhooks/datablue",
"webhook_secret": "WEBHOOK_SECRET"
}'{
"success": true,
"data": {
"markdown": "# Example",
"metadata": {
"source_url": "https://example.com",
"status_code": 200
}
},
"job_id": "550e8400-e29b-41d4-a716-446655440001"
}Response
The response includes only requested outputs plus page metadata, quality information, status, and a job ID when available.
Error Handling
Handle 401 for authentication, 422 for invalid input, 429 for limits, and retry only transient failures.
Scrape vs Crawl
Use Scrape for one known page. Use Crawl when you need content from multiple connected pages.
