Three operations cover more than one page. Map is a single call; batch and crawl are jobs.

Map a site

POST /v1/vision/map lists a site's URLs from its sitemaps and from the links on the start page, without scraping each page. Use it to decide what to scrape or crawl. It bills one vision.page per call.

bash
curl -s https://beta-api.b3os.org/v1/vision/map \ -H "Authorization: Bearer $B3OS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url": "https://docs.example.com", "search": "authentication", "limit": 100}'
FieldDefaultMeaning
searchnoneOrder results by relevance to this phrase
sitemapincludeUse sitemaps alongside links (include), not at all (skip), or only sitemaps (only)
include_subdomainstrueInclude URLs on subdomains
ignore_query_parameterstrueTreat URLs that differ only in their query string as one
limit1000At most 5000

Scrape a list of URLs

POST /v1/vision/batches scrapes up to 1,000 URLs with the same options, as one job. Each page bills one vision.page.

bash
curl -s "https://beta-api.b3os.org/v1/vision/batches?wait=60" \ -H "Authorization: Bearer $B3OS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"urls": ["https://example.com/blog/a", "https://example.com/blog/b"], "scrape": {"formats": ["markdown"]}}'
  • scrape takes the same options as a single scrape (formats, engine, actions, profile, headers) and applies them to every URL.
  • ignore_invalid_urls: true skips URLs that do not parse and lists them in result.invalid_urls, instead of rejecting the request.
  • max_concurrency limits how many pages run at once; your concurrency limit caps it either way.

The finished job's result counts pages_succeeded and pages_failed. The pages themselves, failures included, are at GET /v1/vision/batches/{batch_id}/pages in the order they finished, and they are listed while the batch is still running.

Crawl a site

POST /v1/vision/crawls starts at url, discovers pages from links and sitemaps breadth first, and scrapes up to limit of them. One crawl runs at a time per organization. Each page bills one vision.page.

bash
curl -s https://beta-api.b3os.org/v1/vision/crawls \ -H "Authorization: Bearer $B3OS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url": "https://docs.example.com", "limit": 200, "include_paths": ["^/guides/"], "scrape": {"formats": ["markdown"]}, "webhook": {"url": "https://example.com/hooks/b3os"}}'
FieldDefaultMeaning
limit100Most pages to scrape, at most 500
max_depth5Most link hops from url, at most 20; sitemap URLs count as depth 0
include_paths, exclude_pathsnoneRegular expressions (RE2) a URL path must match, or must not match
sitemapincludeinclude, skip or only
crawl_entire_domainfalseFollow links to parent and sibling paths, not only below url
allow_subdomainsfalseFollow links to subdomains
allow_external_linksfalseScrape pages on other sites the crawl links to, one hop only
ignore_query_parametersfalseTreat URLs that differ only in their query as one
delay_msnoneMinimum gap between requests to the same host
scrape{"formats": ["markdown"]}Options for every page, as in a single scrape

A crawl honors robots.txt: URLs it skipped for that reason are listed in result.robots_blocked. Pages, failures included, are at GET /v1/vision/crawls/{crawl_id}/pages with their depth, available while the crawl runs.

Follow, wait or cancel

Batches and crawls follow the job contract:

  • ?wait=<seconds> (up to 60) on the create call returns the finished job if it ends in time, or 202 with the job and a Location to poll.
  • GET .../{id}/events streams job.* lifecycle events plus page.succeeded and page.failed for each page. Reconnect with Last-Event-ID to resume.
  • webhook: {url, events} on create posts the events you choose to your URL, signed.
  • POST .../{id}/cancel stops new pages. Pages already scraped stay listed and billed.

Batch and crawl records, with their pages, are kept for 7 days after they finish.

Ask a question... ⌘I