API docs
Authentication
Send your API key as a bearer token on every request. Create keys on the API keys page.
Authorization: Bearer hv-your-keyBase URL: https://app.harvestdata.tech/v1
POST /v1/scrape
Fetch one URL and return clean, LLM-ready content. JavaScript-heavy pages are rendered in a real browser automatically; PDFs are converted to text. 1 credit, or 5 credits with the json format.
curl -X POST https://app.harvestdata.tech/v1/scrape \
-H "Authorization: Bearer $HARVEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "formats": ["markdown", "links"]}'| Field | Type | Default | Description |
|---|---|---|---|
| url | string | — | Page to scrape (required). |
| formats | string[] | ["markdown"] | Any of markdown, html, rawHtml, links, screenshot, screenshot@fullPage, json. |
| jsonOptions | object | — | For the json format: { schema?, prompt? }. Returns data.json. |
| actions | object[] | [] | Browser steps to run before scraping. See Actions. |
| onlyMainContent | boolean | true | Strip navigation, headers, footers and sidebars. |
| includeTags | string[] | [] | CSS selectors to keep (everything else is dropped). |
| excludeTags | string[] | [] | CSS selectors to remove. |
| waitFor | number | 0 | Extra ms to wait after load (0–15000). Forces the browser. |
| timeout | number | 30000 | Request timeout in ms (1000–60000). |
| mobile | boolean | false | Render with a mobile viewport. |
| engine | string | "auto" | auto, fetch (fast, no JS) or browser (headless Chrome). |
Response
{
"success": true,
"data": {
"markdown": "# Example Domain\n\nThis domain is for use in ...",
"metadata": {
"title": "Example Domain",
"url": "https://example.com/",
"sourceURL": "https://example.com",
"statusCode": 200,
"engine": "fetch",
"durationMs": 212
}
}
}Actions
Interact with the page before it is scraped: dismiss a banner, open a tab, load more results. Up to 20 steps; they run in the browser in order. If a step fails the request returns 422 and is not charged.
{
"url": "https://quotes.toscrape.com",
"actions": [
{"type": "click", "selector": "li.next a"},
{"type": "wait", "milliseconds": 1000},
{"type": "scroll", "direction": "down", "amount": 3},
{"type": "screenshot", "fullPage": false}
]
}| Field | Type | Default | Description |
|---|---|---|---|
| wait | milliseconds | Pause 0–10000 ms. | |
| click | selector | Click the first element matching a CSS selector. | |
| write | text, selector? | Type text, into the selector if given. | |
| press | key | Press a key such as Enter or Tab. | |
| scroll | direction, amount? | Scroll up or down 1–20 times. | |
| screenshot | fullPage? | Capture the page; returned in data.actions.screenshots. |
POST /v1/batch/scrape
Scrape a list of URLs as one async job. Takes every /v1/scrape option (no screenshots). Failed URLs are listed with their error and not charged. 1 credit per page.
curl -X POST https://app.harvestdata.tech/v1/batch/scrape \
-H "Authorization: Bearer $HARVEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"urls": ["https://example.com", "https://example.org"], "formats": ["markdown"]}'
# → {"success": true, "id": "9b2e…"} then GET /v1/batch/scrape/9b2e…Up to 100 URLs per batch. Poll with GET, cancel with DELETE, or pass a webhook.
POST /v1/crawl
Start an async crawl from a URL. Follows links on the same site, respects robots.txt. Returns a job id to poll. 1 credit per page.
curl -X POST https://app.harvestdata.tech/v1/crawl \
-H "Authorization: Bearer $HARVEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://docs.example.com", "limit": 25, "scrapeOptions": {"formats": ["markdown"]}}'
# → {"success": true, "id": "3f1c…", "url": "https://app.harvestdata.tech/v1/crawl/3f1c…"}| Field | Type | Default | Description |
|---|---|---|---|
| url | string | — | Start URL (required). |
| limit | number | 10 | Max pages (Free plan: up to 100). |
| maxDepth | number | 2 | How many links deep to follow from the start URL. |
| includePaths | string[] | [] | Regexes; only matching paths are crawled. |
| excludePaths | string[] | [] | Regexes; matching paths are skipped. |
| allowSubdomains | boolean | false | Also follow links to subdomains. |
| ignoreSitemap | boolean | true | Set false to seed the crawl from sitemap.xml. |
| scrapeOptions | object | {} | Same options as /v1/scrape (no screenshots). |
| webhook | string | object | — | Get events as pages arrive. See Webhooks. |
GET /v1/crawl/:id
Returns status (scraping, completed, cancelled, failed), progress and up to 100 pages. Follow next for more.
curl https://app.harvestdata.tech/v1/crawl/3f1c… -H "Authorization: Bearer $HARVEST_API_KEY"DELETE /v1/crawl/:id
Cancels a running crawl. Pages already scraped stay available.
POST /v1/map
List the URLs of a website fast, from its sitemaps and homepage links. 1 credit.
curl -X POST https://app.harvestdata.tech/v1/map \
-H "Authorization: Bearer $HARVEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com", "search": "blog"}'| Field | Type | Default | Description |
|---|---|---|---|
| url | string | — | Site to map (required). |
| search | string | — | Rank URLs containing this text first. |
| limit | number | 1000 | Max URLs returned (1–5000). |
| includeSubdomains | boolean | false | Include URLs on subdomains. |
| ignoreSitemap | boolean | false | Skip sitemaps; only use page links. |
POST /v1/extract
Pull structured data out of one or more pages with AI. Give a JSON Schema for exact fields, a plain-language prompt, or both. Runs async. 5 credits per URL.
curl -X POST https://app.harvestdata.tech/v1/extract \
-H "Authorization: Bearer $HARVEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"urls": ["https://books.toscrape.com/catalogue/a-light-in-the-attic_1000/index.html"],
"prompt": "Book title, price and stock status",
"schema": {
"type": "object",
"properties": {
"title": {"type": "string"},
"price": {"type": "string"},
"in_stock": {"type": "boolean"}
},
"required": ["title", "price", "in_stock"]
}
}'
# GET /v1/extract/:id → {"status": "completed", "data": {"title": "A Light in the Attic", …}}| Field | Type | Default | Description |
|---|---|---|---|
| urls | string[] | — | Up to 10 pages to read together (required). |
| schema | object | — | JSON Schema with "type": "object". |
| prompt | string | — | What to extract, in plain language. |
| webhook | string | object | — | Get a completed event. See Webhooks. |
For a single page you can also add "json" to /v1/scrape formats with jsonOptions.
POST /v1/search
Search the web and get the top results, optionally scraped in the same call. 1 credit, plus the scrape cost of each result when scrapeOptions is set.
curl -X POST https://app.harvestdata.tech/v1/search \
-H "Authorization: Bearer $HARVEST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "open source web scraping libraries", "limit": 5, "scrapeOptions": {"formats": ["markdown"]}}'| Field | Type | Default | Description |
|---|---|---|---|
| query | string | — | Search terms (required). |
| limit | number | 5 | Results to return (1–10). |
| lang | string | "en" | Result language. |
| country | string | "US" | Two-letter country code. |
| scrapeOptions | object | — | Scrape each result with these /v1/scrape options. |
Webhooks
Crawl, batch and extract jobs accept a webhook: a URL, or an object with your own headers (for a shared secret) and the events you want. We POST JSON; delivery is best effort with a 10-second timeout and no redirects.
"webhook": {
"url": "https://your-app.com/hooks/harvest",
"headers": {"X-Webhook-Secret": "your-secret"},
"events": ["page", "completed", "failed"]
}
// POST body
{"success": true, "type": "crawl.page", "id": "3f1c…", "data": [{ "markdown": "…", "metadata": {…} }]}| Field | Type | Default | Description |
|---|---|---|---|
| started | The job was accepted. | ||
| page | One page finished (crawl and batch). | ||
| completed | The job ended: completed, cancelled or out of credits. | ||
| failed | The job stopped with an error. |
Credits & limits
- Free plan: 500 credits per month, reset on the 1st (UTC). Failed requests are not charged.
- Costs: scrape, map, search, each crawled or batched page = 1 credit; json format and extract = 5 credits per page.
- Rate limit: 20 requests per minute per account; 2 jobs (crawl, batch, extract) running at once.
- Job results (crawl, batch, extract) are kept for 30 days after the job finishes, then deleted. Fetch or receive them by webhook before then.
- Every response includes X-Credits-Remaining. GET /v1/credits returns your balance.
Errors
Errors return {"success": false, "error": "…"} with an HTTP status:
| Field | Type | Default | Description |
|---|---|---|---|
| 400 | Invalid request body or URL. | ||
| 401 | Missing or invalid API key. | ||
| 402 | Out of credits for this month. | ||
| 403 | Email not confirmed, or private address requested. | ||
| 408 | The target site timed out. | ||
| 413 | Page or input too large. | ||
| 415 | Unsupported content type (e.g. images, video). | ||
| 422 | An action failed, or extraction could not complete. | ||
| 429 | Rate limit hit. Respect the Retry-After header. | ||
| 502 | The target site could not be reached. | ||
| 503 | Feature not enabled on this server (extract, search). |