harvest

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-key

Base 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"]}'
FieldTypeDefaultDescription
urlstring—Page to scrape (required).
formatsstring[]["markdown"]Any of markdown, html, rawHtml, links, screenshot, screenshot@fullPage, json.
jsonOptionsobject—For the json format: { schema?, prompt? }. Returns data.json.
actionsobject[][]Browser steps to run before scraping. See Actions.
onlyMainContentbooleantrueStrip navigation, headers, footers and sidebars.
includeTagsstring[][]CSS selectors to keep (everything else is dropped).
excludeTagsstring[][]CSS selectors to remove.
waitFornumber0Extra ms to wait after load (0–15000). Forces the browser.
timeoutnumber30000Request timeout in ms (1000–60000).
mobilebooleanfalseRender with a mobile viewport.
enginestring"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}
  ]
}
FieldTypeDefaultDescription
waitmillisecondsPause 0–10000 ms.
clickselectorClick the first element matching a CSS selector.
writetext, selector?Type text, into the selector if given.
presskeyPress a key such as Enter or Tab.
scrolldirection, amount?Scroll up or down 1–20 times.
screenshotfullPage?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…"}
FieldTypeDefaultDescription
urlstring—Start URL (required).
limitnumber10Max pages (Free plan: up to 100).
maxDepthnumber2How many links deep to follow from the start URL.
includePathsstring[][]Regexes; only matching paths are crawled.
excludePathsstring[][]Regexes; matching paths are skipped.
allowSubdomainsbooleanfalseAlso follow links to subdomains.
ignoreSitemapbooleantrueSet false to seed the crawl from sitemap.xml.
scrapeOptionsobject{}Same options as /v1/scrape (no screenshots).
webhookstring | 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"}'
FieldTypeDefaultDescription
urlstring—Site to map (required).
searchstring—Rank URLs containing this text first.
limitnumber1000Max URLs returned (1–5000).
includeSubdomainsbooleanfalseInclude URLs on subdomains.
ignoreSitemapbooleanfalseSkip 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", …}}
FieldTypeDefaultDescription
urlsstring[]—Up to 10 pages to read together (required).
schemaobject—JSON Schema with "type": "object".
promptstring—What to extract, in plain language.
webhookstring | object—Get a completed event. See Webhooks.

For a single page you can also add "json" to /v1/scrape formats with jsonOptions.

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": {…} }]}
FieldTypeDefaultDescription
startedThe job was accepted.
pageOne page finished (crawl and batch).
completedThe job ended: completed, cancelled or out of credits.
failedThe job stopped with an error.

Credits & limits

Errors

Errors return {"success": false, "error": "…"} with an HTTP status:

FieldTypeDefaultDescription
400Invalid request body or URL.
401Missing or invalid API key.
402Out of credits for this month.
403Email not confirmed, or private address requested.
408The target site timed out.
413Page or input too large.
415Unsupported content type (e.g. images, video).
422An action failed, or extraction could not complete.
429Rate limit hit. Respect the Retry-After header.
502The target site could not be reached.
503Feature not enabled on this server (extract, search).