Analytics API
Jump to Analyze keyword gaps among competitorsAnalyze keyword gaps among competitors
The Domain vs. Domain report helps you to compare the keyword profiles of up to five competitors.
This tutorial shows you how to create a report that compares your domain with two competitors to find keywords that they rank for, but you don’t (untapped keywords). This is perfect for finding content gaps and new SEO opportunities.
Jump to Before you startBefore you start
- Make sure you have:
- Access to Standard API.
- Enough API units to make calls. Following the examples from this tutorial, you’ll spend a total of 800 API units (80 API units per line * 10 top keywords).
- Get your API key from the Subscription Info tab.
You can use API testing tools like Postman to test your requests before full implementation. Note that test requests consume API units.
Jump to Specify keyword type and domainsSpecify keyword type and domains
Imagine you are analyzing mybrand.com against two competitors: competitor1.com and competitor2.com.
To find untapped keywords for mybrand.com, use the following formula:
*|or|competitor1.com|+|or|competitor2.com|-|or|mybrand.com
- Use the asterisk
*to start with all keywords. - Use
|or|competitor1.comto add competitor organic keyword pools. - Use
|+|or|competitor2.comto add additional competitor organic keyword pools to the keyword set. - Use
|-|or|mybrand.comto exclude keywords you already rank for.
This string must be included as the domains parameter to your request in the URL-encoded format.
Jump to Encode special charactersEncode special characters
Since this parameter contains special characters like *, |, +, and -, you must encode it. The encoded string will look as follows:
domains=%2A%7Cor%7Ccompetitor1.com%7C%2B%7Cor%7Ccompetitor2.com%7C%2D%7Cor%7Cmybrand.comLet’s break it down:
Jump to Filter resultsFilter results
You can use the display_filter parameter to apply filters to the report. For example, if you want to focus on:
- Moderate to high search volume keywords that have the potential to drive meaningful traffic, set Search Volume (
Nq) to greater than 1,000. - Keywords that are moderately or less competitive in organic search, set Keyword Difficulty (
Kd) to less than 60. - Keywords with low to moderate paid competition in Google Ads, making them potentially easier organic SEO targets, set Competition (
Co) to less than 0.6.
The string will look as follows: +|Nq|Gt|1000|+|Kd|Lt|60|+|Co|Lt|0.6
Here:
- Search volume > 1,000:
+|Nq|Gt|1000+→ includeNq→ search volumeGt→ greater than1000→ value
- Keyword Difficulty < 60:
+|Kd|Lt|60+→ includeKd→ keyword difficultyLt→ lower than60→ value
- Competition < 0.6:
+|Co|Lt|0.6+→ includeCo→ competitionLt→ lower than0.6→ value
Jump to Encode special charactersEncode special characters
Since this parameter contains special characters like + and |, you must encode it. The encoded string will look as follows:
display_filter=%2B%7CNq%7CGt%7C1000 %7C%2B%7CKd%7CLt%7C60%7C%2B%7CCo%7CLt%7C0.6Let’s break it down:
Jump to Sort resultsSort results
You can sort the results by descending search volume using the display_sort parameter: display_sort=nq_desc.
To check other sorting options, refer to Sortings.
Jump to Add other request paramsAdd other request params
- Select report type:
type=domain_domains. - Specify your API key:
key=YOUR_API_KEY. - Specify the database:
database=usfor the United States. - (Optional) Specify the columns you want to extract. In this example, it’s
export_columns=Ph,P0,P1,P2,Nq,Kd,Co,Cp. - (Optional) Limit the number of lines returned. In this example, it’s top 10 results:
display_limit=10.
Jump to Construct your requestConstruct your request
When you put all the parameters together, the request will look like this:
https://api.semrush.com/?type=domain_domains&key=YOUR_API_KEY&database=us&domains=%2A%7Cor%7Ccompetitor1.com%7C%2B%7Cor%7Ccompetitor2.com%7C%2D%7Cor%7Cmybrand.com&display_sort=nq_desc&display_filter=%2B%7CNq%7CGt%7C1000%7C%2B%7CKd%7CLt%7C60%7C%2B%7CCo%7CLt%7C0.6&export_columns=Ph,P0,P1,P2,Nq,Kd,Co,Cp&display_limit=10Jump to What’s nextWhat’s next
In this guide, you learned how to identify high-value, lower-competition organic keywords your competitors rank for, but you do not. This approach supports data-driven content planning by highlighting untapped keywords where competitors have visibility.
From here, you can refine your filters to match your SEO goals, integrate results into your reporting workflows, or build automated tools to streamline ongoing analysis. For a more comprehensive strategy, you may also explore other Semrush API reports.
Jump to Analyze AI Overview impact on your trafficAnalyze AI Overview impact on your traffic
AI-powered search features, like Google’s AI Overview, are changing how users interact with search results. This often leads to fewer clicks on regular organic listings.
In this guide, you’ll learn how to evaluate possible traffic loss. You can check how often Google AI Overviews appear for your ranking keywords and see how often your domain is included in these overviews.
Jump to Option 1. Use Domain Overview reportOption 1. Use Domain Overview report
To analyze the impact of the AI Overview SERP feature on your organic visibility and traffic, you can use the Analytics API Domain Overview method and export the FKn and FPn columns with code 52 for AI Overview.
In the report:
FK52shows the total number of the AI Overview SERP feature triggered by the keywords that your domain ranks for.FP52shows the total number of the AI Overview SERP feature that your domain actually ranks in.
https://api.semrush.com/?key=YOUR_API_KEY&type=domain_ranks&domain=your-domain.com&database=us&export_columns=Db,Dn,Rk,Ot,FK52,FP52Jump to Analyze resultsAnalyze results
Compare FP52 against FK52:
- A high
FP52/FK52ratio indicates a strong presence in AI Overview. - A low ratio signals potential visibility loss—your content may be ranking traditionally, but not surfaced in AI answers.
Jump to Option 2. Use Domain Organic Search Keywords reportOption 2. Use Domain Organic Search Keywords report
In some methods, such as Domain Organic Search Keywords, you can retrieve keywords presented in the AI Overview results:
- Export the
FkandFpSERP Features columns:
Fk: All SERP features triggered by a keyword.Fp: SERP features in which the domain appears for that keyword.
2. Apply the display_filter parameter to the request. For example, use display_filter=+|Fk|Eq|52 to filter only those keywords that trigger AI Overview. If you need keywords in AI Overview results where your domain ranks, use Fp instead.
The filter must be URL-encoded:
display_filter=%2B%7CFk%7CEq%7C52.
https://api.semrush.com/?type=domain_organic&key=API_KEY&display_limit=50&export_columns=Ph,Po,Pp,Pd,Nq,Cp,Ur,Tr,Tc,Co,Nr,Td,Fk,Fp&domain=justanswer.com&database=us&display_filter=%2B%7CFk%7CEq%7C52&display_positions_type=allhttps://api.semrush.com/?type=domain_organic&key=API_KEY&display_limit=50&export_columns=Ph,Po,Pp,Pd,Nq,Cp,Ur,Tr,Tc,Co,Nr,Td,Fk,Fp&domain=justanswer.com&database=us&display_filter=%2B%7CFp%7CEq%7C52&display_positions_type=allJump to Analyze resultsAnalyze results
- Discover the exact keywords that trigger AI Overview.
- Identify which of those keywords your domain actually appears in AI Overview.
- Compare both lists to uncover missed opportunities where AI Overview is active but your domain isn’t included.
Jump to Take actionTake action
Focus on improvements that make your content AI-friendly using Semrush tools, such as SEO Writing Assistant. This can help recover lost organic traffic from zero-click searches.
Jump to Import Semrush data into Google SheetsImport Semrush data into Google Sheets
To integrate CSV Semrush API reports into your Google Sheets reports, you can:
- Use built-in cell formulas to directly insert data into your sheet without writing any code.
- Use Apps Script. This allows you to fetch data and implement more complex logic. Additionally, you can securely store your API key in Script Properties, keeping it hidden from sheet users.
In this article, you will find examples of how to use both options.
Jump to Use cell formulaUse cell formula
You can fetch and split CSV data from the Semrush API into columns using functions, like IMPORTDATA, SPLIT, and ARRAYFORMULA. You just need to create a formula for your case and insert it into the cell.
=IMPORTDATA("https://api.semrush.com/?type=domain_organic&key=SEMRUSH_API_KEY&export_columns=Ph,Po,Nq,Cp&domain=example.com&database=us&display_limit=10")=ARRAYFORMULA(SPLIT(IMPORTDATA("https://api.semrush.com/?type=domain_organic&key=SEMRUSH_API_KEY&export_columns=Ph,Po,Nq,Cp&domain=example.com&database=us&display_limit=10"), ";"))Jump to Use Apps ScriptUse Apps Script
Jump to Step 1. Store your API key securelyStep 1. Store your API key securely
- Open the Google Sheets file where you want to import the CSV API data.
- Go to Extensions → Apps Script to open the Apps Script editor.
- In the Apps Script editor, click the gear icon next to Project Settings.
- Under Script Properties:
- Click Add script property.
- Add Property:
SEMRUSH_API_KEYand Value: Your API key. - Click Save script properties to save changes.
Jump to Step 2. Create Apps Script functionStep 2. Create Apps Script function
In the Apps Script:
- Go to Editor.
- Create and add your functions.
- Save the changes.
As an example, you can use the following functions that will:
- Fetch and parse the data from the Semrush API endpoint.
- Store data in a monthly-named sheet, such as “June 2025”.
- Create a monthly trigger to fetch new data, for example, at 9 AM on the 1st day of the month.
function getSemrushData(domain) {
var apiKey = PropertiesService.getScriptProperties().getProperty('SEMRUSH_API_KEY');
var apiUrl = `https://api.semrush.com/?type=domain_organic&key=${apiKey}&export_columns=Ph,Po,Nq,Cp&domain=${domain}&database=us&display_limit=10`;
var response = UrlFetchApp.fetch(apiUrl);
var csvData = response.getContentText();
var rows = Utilities.parseCsv(csvData, ";");
return rows;
}function fetchAndStoreMonthlyData() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var domain = 'example.com'; // Replace with your domain
var rows = getSemrushData(domain);
var sheetName = Utilities.formatDate(new Date(), Session.getScriptTimeZone(), "MMMM yyyy");
var sheet = spreadsheet.insertSheet(sheetName);
rows.forEach(row => sheet.appendRow(row));
}function createMonthlyTrigger() {
var exists = ScriptApp.getProjectTriggers().some(t => t.getHandlerFunction() === 'fetchAndStoreMonthlyData');
if (!exists) {
ScriptApp.newTrigger('fetchAndStoreMonthlyData')
.timeBased()
.everyMonths(1)
.onMonthDay(1)
.atHour(9)
.create();
}
}Jump to Step 3. Execute the scriptStep 3. Execute the script
Run createMonthlyTrigger() manually from the Editor once to set up the monthly trigger.
You need to provide Apps Script with all the requested permissions to execute the script.
The script will now run automatically at the start of each month, creating a new sheet and fetching the data.
This script is intended as a starting point. You may need to customize the code to fit your unique use case, including error handling or different scheduling requirements.
For example, if a scheduled trigger is unnecessary, you can callgetSemrushData()directly from a Google Sheets cell:=getSemrushData("example.com").
Jump to What’s nextWhat’s next
Now that you’ve imported Semrush data into Google Sheets, you can optionally take any of the following next steps—or choose your own workflow:
- Visualize your data in Looker Studio: Connect your Google Sheet as a data source and build custom dashboards.
- Export it to BigQuery: For larger datasets or advanced analysis, you can push your sheet data into BigQuery and connect it to Looker Studio or other visualization tools.
Last updated: January 30, 2026