Trends · Python
import os
import requests
response = requests.get(
"https://www.searchapi.io/api/v1/search",
headers={"Authorization": f"Bearer {os.environ['SEARCHAPI_API_KEY']}"},
params={
"engine": "google_trends",
"geo": "US",
"q": "heat pump, air conditioner",
"time": "today 12-m",
},
)
print(response.json())
import os
import requests
response = requests.get(
"https://www.searchapi.io/api/v1/search",
headers={"Authorization": f"Bearer {os.environ['SEARCHAPI_API_KEY']}"},
params={
"engine": "google_trends",
"geo": "US",
"q": "heat pump, air conditioner",
"time": "today 12-m",
},
)
print(response.json())
Interest by region · Python
import os
import requests
response = requests.get(
"https://www.searchapi.io/api/v1/search",
headers={"Authorization": f"Bearer {os.environ['SEARCHAPI_API_KEY']}"},
params={
"engine": "google_trends",
"data_type": "GEO_MAP",
"geo": "US",
"q": "heat pump, air conditioner",
"time": "today 12-m",
},
)
print(response.json())
import os
import requests
response = requests.get(
"https://www.searchapi.io/api/v1/search",
headers={"Authorization": f"Bearer {os.environ['SEARCHAPI_API_KEY']}"},
params={
"engine": "google_trends",
"data_type": "GEO_MAP",
"geo": "US",
"q": "heat pump, air conditioner",
"time": "today 12-m",
},
)
print(response.json())
Related queries · Python
import os
import requests
response = requests.get(
"https://www.searchapi.io/api/v1/search",
headers={"Authorization": f"Bearer {os.environ['SEARCHAPI_API_KEY']}"},
params={
"engine": "google_trends",
"data_type": "RELATED_QUERIES",
"geo": "US",
"q": "heat pump",
"time": "today 12-m",
},
)
print(response.json())
import os
import requests
response = requests.get(
"https://www.searchapi.io/api/v1/search",
headers={"Authorization": f"Bearer {os.environ['SEARCHAPI_API_KEY']}"},
params={
"engine": "google_trends",
"data_type": "RELATED_QUERIES",
"geo": "US",
"q": "heat pump",
"time": "today 12-m",
},
)
print(response.json())
The key is read from SEARCHAPI_API_KEY and sent as a Bearer token.