Examples

Each example makes a search and prints selected fields from the response. Before running one, install the package and set your API key.

The examples use results.get("organic_results", []) or a similar expression to read a list of results. The empty list [] is the default if that section is missing. Within a result, item.get("title") returns None if the title is missing. A slice such as [:5] limits the printed list to its first five items.

Follow the API documentation linked from each example for all supported parameters. The API categories below are also listed in SerpApi’s llms.txt.

Starter Examples

Search Engines

AI Answers

Local and Maps

Shopping and Marketplaces

Travel and Hospitality

Media, Apps, and Research

Supported API Map

Search Engines

AI Answers

Local and Maps

Shopping and Marketplaces

Travel and Hospitality

News, Trends, and Demand

Media, Apps, and Social

Research, Knowledge, Ads, Finance, and Jobs