API Reference
Search
POST /api/v1/search — web search with optional scraping
Search the web via DuckDuckGo and optionally scrape each result page.
Endpoint
POST /api/v1/searchParameters
| Parameter | Type | Default | Description |
|---|---|---|---|
query | string | — | Required. Search query |
limit | integer | 10 | Number of search results |
scrapeResults | boolean | false | Scrape the content of each result |
scrapeOptions | object | — | Options for scraping results (see below) |
Scrape Options
When scrapeResults is true:
| Parameter | Type | Default | Description |
|---|---|---|---|
formats | string[] | ["markdown"] | Output formats: "markdown", "html", "rawHtml", "links", "images", "screenshot" |
onlyMainContent | boolean | true | Extract only main content |
timeout | integer | 10000 | Per-page scrape timeout (ms) |
Examples
cURL
# Search only (fast)
curl -X POST http://localhost:8080/api/v1/search \
-H "Content-Type: application/json" \
-d '{
"query": "rust web scraping",
"limit": 5
}'# Search + scrape results
curl -X POST http://localhost:8080/api/v1/search \
-H "Content-Type: application/json" \
-d '{
"query": "rust web scraping",
"limit": 5,
"scrapeResults": true,
"scrapeOptions": {
"formats": ["markdown"],
"onlyMainContent": true
}
}'Python
import requests
# Search only
response = requests.post("http://localhost:8080/api/v1/search", json={
"query": "rust web scraping",
"limit": 5
})
data = response.json()
for result in data["data"]:
print(f"{result['title']}: {result['url']}")
print(f" {result['snippet']}\n")# Search + scrape
response = requests.post("http://localhost:8080/api/v1/search", json={
"query": "rust web scraping",
"limit": 3,
"scrapeResults": True,
"scrapeOptions": {
"formats": ["markdown"],
"onlyMainContent": True
}
})
data = response.json()
for result in data["data"]:
print(f"# {result['title']}")
if result.get("content"):
print(result["content"]["markdown"][:500])
print()JavaScript
const response = await fetch("http://localhost:8080/api/v1/search", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
query: "rust web scraping",
limit: 5,
scrapeResults: true,
}),
});
const data = await response.json();
data.data.forEach((result) => {
console.log(`${result.title}: ${result.url}`);
if (result.content) {
console.log(result.content.markdown.slice(0, 200));
}
});Response (Search Only)
{
"success": true,
"data": [
{
"title": "Web Scraping with Rust",
"url": "https://example.com/rust-scraping",
"snippet": "A guide to building web scrapers in Rust..."
}
]
}Response (Search + Scrape)
{
"success": true,
"data": [
{
"title": "Web Scraping with Rust",
"url": "https://example.com/rust-scraping",
"snippet": "A guide to building web scrapers in Rust...",
"content": {
"markdown": "# Web Scraping with Rust\n\nRust provides...",
"metadata": {
"title": "Web Scraping with Rust",
"wordCount": 2340,
"readingTime": 10
}
}
}
]
}