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
Step 4. Analyze SERP overlap and plan SEO actions
Once you have collected SERP data for multiple locations, the goal is to understand why certain competitors rank consistently and how your site compares. Then use those insights to inform your SEO decisions.
1. Identify overlapping and location-specific competitors
Start by comparing SERP results for each location to identify:
- Overlapping domains, i.e., websites that rank for the same keyword in multiple nearby locations.
- Location-specific competitors, i.e., domains that appear only in one city’s SERP.
These domains are your primary benchmarks.
Example: SERP overlap for “yoga studio” in two nearby locations
In our example, the overlapping domains across Barcelona and Sant Cugat del Vallès are:
estudiodeyoga.comurbansportsclub.com
Location-specific top competitors include:
- Barcelona:
estudiodeyoga.com,bronsayogastudio.com,urbansportsclub.com - Sant Cugat del Vallès:
estudiodeyoga.com,yogasantcugat.com,urbansportsclub.com
2. Analyze why competitors rank across multiple locations
Once overlapping competitors are identified, compare your site to theirs across several dimensions:
Backlink profile and website authority
Investigate the link profiles of domains ranking in multiple locations to understand their authority and local link-building strategies. Use the Backlinks API to identify referring domains, anchors, and link metrics.
Overall organic visibility
Use the Domain Analysis API to identify the specific pages and keywords driving traffic to these competitors, including their top-performing local content. You can also compare high-level metrics such as estimated organic traffic and overall visibility.
SERP features
Use the SERP features data already collected in Step 3 to identify:
- which SERP features appear for the analyzed keywords (e.g.,
Local Pack,Reviews) - which competitors are associated with those features
Page structure and technical implementation
Analyze how competitors structure their high-ranking pages. Use the Website Audit API to examine their technical implementation, on-page optimization, and internal linking structure.
3. Translate analysis into SEO actions
Based on the analysis above, an SEO specialist can define next actions:
- Creating missing location pages or improving existing ones
- Optimizing page structure
- Building links from local directories or other relevant resources
- Identifying keyword gaps and content opportunities from competitor domains, which can be automated using MCP or similar tools
Useful resources:
- Explore our guide on finding keyword opportunities for a domain.
- Watch the walkthrough below on how to automate keyword gap analysis with MCP.
