Setup
Put them in your environment or
.env; Data APIs covers the other ways.
Notes
- Auth is the SGAI-APIKEY header. All paths are under /api. This is the v2 API; the v1 host and its smartscraper/searchscraper/markdownify/smartcrawler endpoints are deprecated.
- An optional SGAI-Session-Id header groups related requests for the history list.
- Crawls are asynchronous: start, poll status, then page through crawl.pages.
- Monitors (scheduled change detection) are not in this entry.
Endpoints
Scrape a URL
- A read over POST: it fetches a page and changes nothing in your account.
- Credits are per format; stealth adds 5.
Extract structured data with a prompt
- A read over POST: it extracts data and changes nothing in your account.
- Costs 5 credits, plus 5 with stealth.
Search and fetch the top results
- A read over POST: it runs a search and changes nothing in your account.
- Costs 2 credits per result, or 5 with a prompt.
Start a crawl
- Starts a billed job: it only produces data and changes nothing else in your account.
- Async: poll crawl.status, then read content with crawl.pages. Costs 2 credits to start plus per-page scrape cost.
Get a crawl’s status
- Status is running, completed, failed or stopped.