Your API key authenticates every request you make to the ScrapeGraphAI API. Keep it secure and rotate it if you suspect it has been compromised.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.
Finding your API key
- Log in to the ScrapeGraphAI dashboard.
- Navigate to Settings.
- Your API key is displayed in the API Key section.
Using your API key
Pass the key in theSGAI-APIKEY header for direct API calls. The v2 SDKs read it automatically from the SGAI_API_KEY environment variable — you can also pass it explicitly to the factory.
Keeping your key secure
- Never commit your API key to a public repository. Use environment variables instead:
- Never expose your key in frontend code. Make API calls from a server or backend function.
- Add
.envto your.gitignoreto avoid accidentally committing secrets.
Rotating your API key
If your key has been exposed or you want to rotate it for security:- Go to Settings in the dashboard.
- Click Regenerate API Key.
- Copy the new key immediately — it will only be shown once.
- Update all services and environment variables that use the old key.
- The old key will be invalidated immediately.