Some websites require specific HTTP headers to return content — authentication tokens, cookies, custom user agents, or API keys embedded in headers.Documentation Index
Fetch the complete documentation index at: https://docs.scrapegraphai.com/llms.txt
Use this file to discover all available pages before exploring further.
How to pass headers
In v2 all fetch behaviour — including custom headers and cookies — is configured throughFetchConfig. It’s accepted by sgai.extract(), sgai.scrape(), sgai.search(), and sgai.crawl.start().
FetchConfig options.
Common use cases
Passing a session cookie
Export cookies from your browser (e.g., using a browser extension like EditThisCookie) and pass them viacookies:
Mimicking a real browser
Some sites block requests without a browser-like User-Agent:stealth=True and mode="js" — see the proxy guide.
Bearer token authentication
For APIs or protected dashboards:Tips
- Headers and cookies are sent to the target website, not to the ScrapeGraphAI API.
- Keep sensitive tokens out of your source code — load them from environment variables.
- If you are unsure which headers to pass, open the target URL in your browser, go to DevTools → Network, and inspect the request headers of a successful page load.