Here's an example of how you can use the SEMrush API to retrieve the Keyword Overview for a specific keyword:
python
from python_semrush.semrush import SemrushClient
# Set your SEMrush API key
api_key = 'your_semrush_api_key'
# Create a SEMrushClient instance
client = SemrushClient(key=api_key)
# Get the Keyword Overview for the keyword "seo"
keyword_overview = client.keyword_overview(
phrase='seo',
database='us'
)
# Print the key metrics for the keyword
print(f"Keyword: {keyword_overview.phrase}")
print(f"Search Volume: {keyword_overview.search_volume}")
print(f"CPC: {keyword_overview.cpc}")
print(f"Competition: {keyword_overview.competition}")
print(f"Number of Results: {keyword_overview.num_results}")
print(f"Trend: {', '.join(map(str, keyword_overview.trend))}")
In this example, we're using the `keyword_overview()` method of the `SemrushClient` class to retrieve the Keyword Overview for the keyword "seo" in the "us" database.
The `KeywordOverviewResult` object returned by the API call contains the following properties:
- `phrase`: The keyword.
- `search_volume`: The estimated monthly search volume for the keyword.
- `cpc`: The average cost-per-click for the keyword in paid search.
- `competition`: The level of competition for the keyword, on a scale of 0 to 1.
- `num_results`: The estimated number of search results for the keyword.
- `trend`: A list of trend values for the keyword over the past 12 months.
You can customize the API call by specifying additional parameters, such as the `display_limit` to control the number of results returned, or the `display_offset` to retrieve data for different date ranges.
By using the SEMrush API's Keyword Overview endpoint, you can programmatically retrieve and analyze keyword data to inform your SEO and content strategies.
Citations:[1] https://developer.semrush.com/api/v3/analytics/keyword-reports/
[2] https://www.semrush.com/kb/257-keyword-overview
[3] https://www.semrush.com/features/keyword-research/
[4] https://www.semrush.com/kb/972-api-reports
[5] https://www.semrush.com/analytics/keywordoverview/