Google Search · curl
curl -G https://www.searchapi.io/api/v1/search \ -H "Authorization: Bearer $SEARCHAPI_API_KEY" \ --data-urlencode 'engine=google' \ --data-urlencode 'q=how long do olympic marathons take'curl -G https://www.searchapi.io/api/v1/search \ -H "Authorization: Bearer $SEARCHAPI_API_KEY" \ --data-urlencode 'engine=google' \ --data-urlencode 'q=how long do olympic marathons take'
Fetch AI Overview · curl
curl -G https://www.searchapi.io/api/v1/search \ -H "Authorization: Bearer $SEARCHAPI_API_KEY" \ --data-urlencode 'engine=google_ai_overview' \ --data-urlencode 'page_token=PASTE_FROM_PREVIOUS_RESPONSE'curl -G https://www.searchapi.io/api/v1/search \ -H "Authorization: Bearer $SEARCHAPI_API_KEY" \ --data-urlencode 'engine=google_ai_overview' \ --data-urlencode 'page_token=PASTE_FROM_PREVIOUS_RESPONSE'
Replace PASTE_FROM_PREVIOUS_RESPONSE with ai_overview.page_token from the response before it. It is valid for a few minutes.
The key is read from SEARCHAPI_API_KEY and sent as a Bearer token.