Get location-specific search results
Step 1. Get available locations
In our example, we’ll use the keyword “yoga studio” and two nearby cities in Spain as our locations: Barcelona and Sant Cugat del Vallès. We’ll first fetch all locations in Spain, then select the cities to analyze.
Example: Retrieve all locations in Spain
curl -X GET 'https://api.seranking.com/v1/serp/classic/locations?country_code=ES' \
-H 'Authorization: Token YOUR_API_KEY'What you’ll get:
- A list of locations for a specific country
- Their location IDs, names, and country code
From the returned list, we pick the two location IDs of interest for our SEO analysis:
- Barcelona → location_id:
12998 - Sant Cugat del Vallès → location_id:
354503
These IDs will be used in Step 2 when creating SERP tasks.
Step 2. Add SERP tasks
Now, we’ll use the Add SERP tasks endpoint to queue keywords for SERP collection. You can specify the device, language, and location. Each queued task returns a task_id for fetching results later.
Example: Queue keyword “yoga studio” for Barcelona
curl -X POST 'https://api.seranking.com/v1/serp/classic/tasks' \
-H 'Authorization: Token YOUR_API_KEY' \
--data '{
"search_engine": "google",
"device": "desktop",
"language_code": "es",
"location_id": 12998,
"query": ["yoga studio"],
"tag": "barcelona_test"
}'
Step 3. Retrieve SERP results
After queuing tasks in Step 2, we can now retrieve results using either the Get standard SERP results or Get advanced SERP results endpoints. Both return structured results for your keywords, but they differ in scope and detail.
A. Standard SERP results
curl -X GET 'https://api.seranking.com/v1/serp/classic/tasks?task_id=104' \
-H 'Authorization: Token YOUR_API_KEY'What you’ll get:
- Request metadata: keyword, device, location, language, tag, and crawl time
- Summary statistics: total search results, number of organic results, and SERP features
- Top 100 SERP results of the following types only: organic results, ads, featured snippets
- For each item: absolute and group rank, position on the page, page title and URL, description/snippet, and associated SERP features
B. Advanced SERP results
curl -X GET 'https://api.seranking.com/v1/serp/classic/tasks/results_advanced?task_id=104' \
-H 'Authorization: Token YOUR_API_KEY'What you’ll get:
- All standard metadata and summary statistics
- Detailed information for all SERP item types, including: organic results, ads, featured snippets, videos and images, AI Overview, and related searches
- For each item: absolute and group rank, position on the page, snippet/overview, domain and URL, and additional type-specific fields
We’ll use the Get advanced SERP results endpoint in this example to include AI Overview items.
Step 4. Analyze local SERP overlap and competitors
Once results for both cities are retrieved, we identify overlapping competitors and unique local opportunities.
In our example, the overlapping domains are:
- estudiodeyoga.com
- urbansportsclub.com
Top competitors per location:
- Barcelona: estudiodeyoga.com, bronsayogastudio.com, urbansportsclub.com
- Sant Cugat del Vallès: estudiodeyoga.com, yogasantcugat.com, urbansportsclub.com
Next steps:
- Compare SERP results and overlapping sources with AI Overview data.
- Analyze text snippets from AI Overview items and your page’s content to optimize for search intent.
- Conduct keyword research across competitors to discover new keywords you may be missing.
- Use the findings to refine local SEO strategy, content, and targeting for each city.

