Product
Extract web content as markdown, HTML, screenshots, and more
fetch is the primary interface for extracting data from the web. It turns any URL into a structured response containing exactly the formats you need.
It works out of the box without any configuration—JavaScript rendering, residential proxies, and bot protection are handled automatically for every request.
Send a POST request to https://api.expand.ai/v1/fetch with the target URL and your desired data selection.
import Expand from 'expandai'
const client = new Expand({
apiKey: '{{API_KEY}}'
})
const result =
from expandai import Expand
client = Expand(api_key="{{API_KEY}}")
result = client.fetch(
url="https://example.com",
select={
"markdown": True,
"meta": True
}
)curl -X POST https://api.expand.ai/v1/fetch \
-H "x-expand-api-key: {{API_KEY}}" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"select": {
"markdown": true,
"meta": true
}
}'The API returns a structured object with your requested data:
{
"data": {
"response": {
"originStatusCode": 200,
"url": "https://example.com"
},
"meta": {
"title":
The select object controls which data formats are returned. You can mix and match any combination of options. For full type definitions, see the API Reference.
| Property | Description |
|---|---|
markdown | LLM-optimized markdown representation of the page. |
meta | Page metadata including title, description, and social tags. |
html | Raw HTML content of the page. |
screenshot | Visual capture of the page (viewport or full-page). |
When summary is enabled, the API generates a high-level overview of the page content. You can pass a custom prompt to focus the summary on specific information.
const result = await client.fetch({
url: 'https://example.com',
select: {
summary: {
prompt: 'Extract the key features and pricing information'
}
}
})
console.log(result.data.summary)result = client.fetch(
url="https://example.com",
select={
"summary"
{
"data": {
"summary": "This page provides an overview of the Expand API, covering its main features such as web scraping, AI-powered extraction, and residential proxy support."
}
}Snippets allow you to perform RAG (Retrieval-Augmented Generation) directly on a single page. Instead of processing the whole document, you can extract only the parts relevant to your query.
const result = await client.fetch({
url: 'https://example.com',
select: {
snippets: {
query: 'How do I authenticate with the API?'
}
}
})
console.log(result.data.snippets)result = client.fetch(
url="https://example.com",
select={
"snippets": {
{
"data": {
"snippets": [
{
"text": "To authenticate with the API, include your API key in the 'x-expand-api-key' header of your requests.",
"score": 0.92,
"index": 12
}
]
Configure how the browser behaves before content is extracted.
| Property | Description |
|---|---|
scrollFullPage | Whether to scroll the entire page to trigger lazy-loaded content. |
summary | AI-powered summary of the page content. |
snippets | Relevant snippets extracted using AI. |
response | HTTP status and optionally response headers. |
curl -X POST https://api.expand.ai/v1/fetch \
-H "x-expand-api-key: {{API_KEY}}" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"select": {
"summary": {
"prompt": "Extract the key features and pricing information"
}
}
}'curl -X POST https://api.expand.ai/v1/fetch \
-H "x-expand-api-key: {{API_KEY}}" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"select": {
"snippets": {
"query": "How do I authenticate with the API?"
}
}
}'