Skip to main content

Extraction API

Turn raw scraped content into structured data, and parse documents.

POST /v1/extract/css

Extract structured JSON from a URL using a CSS selector schema — no LLM required, fully deterministic and free.

Request body:

FieldTypeDefaultDescription
urlstringRequired. URL to extract from
schemaobjectRequired. CSS selector schema (see below)
bypass_cloudflarebooleantrueAttempt Cloudflare bypass

Schema format:

{
"name": "products",
"base_selector": ".product-card",
"fields": [
{"name": "title", "selector": "h3", "type": "text"},
{"name": "price", "selector": ".price", "type": "text", "transform": "float"},
{"name": "link", "selector": "a", "type": "attribute", "attribute": "href"},
{"name": "in_stock", "selector": ".stock", "type": "exists"}
]
}

Field type options include text, attribute, exists, html, and transform values like float/int for normalization. When base_selector is set, each matched element yields one record with the fields applied relative to it.

Example:

curl -X POST http://localhost:8005/v1/extract/css \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <key>" \
-d '{
"url": "https://store.com/products",
"schema": {
"name": "products",
"base_selector": ".product-card",
"fields": [
{"name": "title", "selector": "h3", "type": "text"},
{"name": "price", "selector": ".price", "type": "text", "transform": "float"}
]
}
}'

Response (200):

{
"success": true,
"data": {
"products": [
{"title": "Widget", "price": 29.99},
{"title": "Gadget", "price": 49.5}
]
}
}

POST /v1/extract/llm

Extract structured data using an LLM with intelligent chunking. Chunks content by strategy, optionally filters by relevance to a query, then extracts from each chunk.

Request body:

FieldTypeDefaultDescription
urlstringRequired. URL to extract from
instructionstringExtract all key information from this content.Extraction instruction
schemaobjectDesired output JSON schema
chunk_strategystringtopicChunking strategy (topic, sentence, regex, …)
querystringRelevance filter query
top_kinteger5Max chunks to extract from

Example:

curl -X POST http://localhost:8005/v1/extract/llm \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <key>" \
-d '{
"url": "https://store.com/product/123",
"instruction": "Extract the product name, price, and availability",
"schema": {"name": "string", "price": "number", "availability": "string"},
"chunk_strategy": "topic"
}'

Response (200): structured JSON matching the requested schema.

POST /v1/parse

Parse a document (PDF, DOCX, image, CSV, JSON) to text.

Request body (ParseRequest):

FieldTypeDefaultDescription
urlstringRequired. Document URL
timeoutinteger60Timeout in seconds
curl -X POST http://localhost:8005/v1/parse \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <key>" \
-d '{"url": "https://example.com/document.pdf", "timeout": 60}'

Response (200): { "text": "…extracted text…", "format": "pdf" }

Formats supported: PDF, DOCX, images (OCR), CSV, JSON.

Related parsing endpoints:

EndpointPurpose
POST /v1/pdf/extractPDF table extraction (pdf_url, method — default pdfplumber)
POST /v1/ocr/extractImage OCR
POST /v1/schema/extractSchema.org / JSON-LD / microdata extraction
POST /v1/schema/extract-htmlSchema extraction from raw HTML
POST /v1/extract-tableTable extraction

POST /v1/shadow-dom

Scrape a page and extract content from Shadow DOM components. Useful for modern web apps built with Lit, web components, or frameworks that use Shadow DOM encapsulation.

Request body:

FieldTypeDefaultDescription
urlstringRequired. URL with Shadow DOM content
flattenbooleantrueFlatten nested shadow roots
curl -X POST http://localhost:8005/v1/shadow-dom \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <key>" \
-d '{"url": "https://app.example.com", "flatten": true}'

Response (200): extracted text/content from shadow roots, with flatten merging nested roots into one tree.

POST /v1/capture/lazy

Detect and handle lazy-loaded content and infinite-scroll patterns. Optionally auto-scroll to load all content before extraction.

Request body:

FieldTypeDefaultDescription
urlstringRequired. URL
auto_scrollbooleantrueAuto-scroll to trigger lazy load
max_scrollsinteger5Max scroll iterations

POST /v1/capture/network

Extract API calls, GraphQL queries, and network patterns from a page. Useful for understanding how SPAs load data and for finding hidden API endpoints.

Request body: { "url": "https://app.example.com" }

Response (200): list of network requests (URLs, methods, query types).

Other extraction endpoints

EndpointPurpose
POST /v1/extractGeneric extraction with JSON schema + optional AI fallback
POST /v1/extract/fieldsStructured field extraction
POST /v1/suggestAI field suggestion for a URL
POST /v1/emailsEmail address extraction
POST /v1/linksLink analysis
POST /v1/seo/analyzeSEO analysis (title, meta, headings, keywords, readability)

Next steps