semrush-research
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSemRush Research
SemRush 调研实操
Pull live SEO and competitive intelligence data from the SemRush API.
通过SemRush API获取实时SEO与竞争情报数据。
Prerequisites
前置条件
Requires set in , , or .
SEMRUSH_API_KEY.env.env.local~/.claude/.env.globalbash
undefined需要在、或文件中配置。
.env.env.local~/.claude/.env.globalSEMRUSH_API_KEYbash
undefinedVerify the key is available
验证密钥是否已配置
echo "SEMRUSH_API_KEY is ${SEMRUSH_API_KEY:+set}"
If the key is not set, instruct the user:
> You need a SemRush API key. Get one at https://www.semrush.com/api/
> Then add `SEMRUSH_API_KEY=your_key` to your `.env` file.echo "SEMRUSH_API_KEY is ${SEMRUSH_API_KEY:+set}"
如果未配置密钥,请告知用户:
> 你需要一个SemRush API密钥。可前往https://www.semrush.com/api/获取
> 然后在你的`.env`文件中添加`SEMRUSH_API_KEY=your_key`。API Base
API 基础信息
All requests go to with the API key passed as .
https://api.semrush.com/&key={SEMRUSH_API_KEY}Responses are semicolon-delimited CSV. The first line is the header row. Parse accordingly.
所有请求均发送至,并通过传递API密钥。
https://api.semrush.com/&key={SEMRUSH_API_KEY}响应结果为分号分隔的CSV格式,第一行为表头,需按此解析。
1. Domain Overview
1. 域名概览
Get a high-level snapshot of any domain's organic and paid search performance.
获取任意域名自然搜索与付费搜索表现的高层快照。
Endpoint
接口地址
https://api.semrush.com/?type=domain_ranks&key={KEY}&export_columns=Dn,Rk,Or,Ot,Oc,Ad,At,Ac&domain={domain}https://api.semrush.com/?type=domain_ranks&key={KEY}&export_columns=Dn,Rk,Or,Ot,Oc,Ad,At,Ac&domain={domain}Export Columns
导出列说明
| Column | Meaning |
|---|---|
| Domain |
| SemRush Rank |
| Organic keywords count |
| Organic traffic estimate |
| Organic traffic cost ($) |
| Paid keywords count |
| Paid traffic estimate |
| Paid traffic cost ($) |
| 列名 | 含义 |
|---|---|
| 域名 |
| SemRush 排名 |
| 自然关键词数量 |
| 自然流量估算值 |
| 自然流量成本(美元) |
| 付费关键词数量 |
| 付费流量估算值 |
| 付费流量成本(美元) |
Example curl
curl示例
bash
curl -s "https://api.semrush.com/?type=domain_ranks&key=${SEMRUSH_API_KEY}&export_columns=Dn,Rk,Or,Ot,Oc,Ad,At,Ac&domain=example.com"bash
curl -s "https://api.semrush.com/?type=domain_ranks&key=${SEMRUSH_API_KEY}&export_columns=Dn,Rk,Or,Ot,Oc,Ad,At,Ac&domain=example.com"Parsing the Response
响应结果解析
bash
undefinedbash
undefinedResponse format (semicolon-delimited):
响应格式(分号分隔):
Dn;Rk;Or;Ot;Oc;Ad;At;Ac
Dn;Rk;Or;Ot;Oc;Ad;At;Ac
example.com;12345;8234;145000;234500;120;3400;5600
example.com;12345;8234;145000;234500;120;3400;5600
Parse with awk
使用awk解析
curl -s "..." | awk -F';' 'NR==2 {
printf "Domain: %s\nSemRush Rank: %s\nOrganic Keywords: %s\nOrganic Traffic: %s\nOrganic Traffic Cost: $%s\nPaid Keywords: %s\nPaid Traffic: %s\nPaid Traffic Cost: $%s\n",
$1,$2,$3,$4,$5,$6,$7,$8
}'
---curl -s "..." | awk -F';' 'NR==2 {
printf "域名: %s\nSemRush 排名: %s\n自然关键词: %s\n自然流量: %s\n自然流量成本: $%s\n付费关键词: %s\n付费流量: %s\n付费流量成本: $%s\n",
$1,$2,$3,$4,$5,$6,$7,$8
}'
---2. Keyword Overview
2. 关键词概览
Get search volume, CPC, competition, and SERP features for a keyword.
获取关键词的搜索量、CPC、竞争度及SERP特征。
Endpoint
接口地址
https://api.semrush.com/?type=phrase_all&key={KEY}&phrase={keyword}&database=us&export_columns=Ph,Nq,Cp,Co,Nr,Tdhttps://api.semrush.com/?type=phrase_all&key={KEY}&phrase={keyword}&database=us&export_columns=Ph,Nq,Cp,Co,Nr,TdExport Columns
导出列说明
| Column | Meaning |
|---|---|
| Keyword phrase |
| Search volume (monthly) |
| CPC (USD) |
| Competition (0-1) |
| Number of results |
| Trend (12 months, comma-separated) |
| 列名 | 含义 |
|---|---|
| 关键词短语 |
| 月搜索量 |
| 单次点击成本(美元) |
| 竞争度(0-1) |
| 搜索结果数量 |
| 趋势(12个月数据,逗号分隔) |
Example curl
curl示例
bash
curl -s "https://api.semrush.com/?type=phrase_all&key=${SEMRUSH_API_KEY}&phrase=content+marketing&database=us&export_columns=Ph,Nq,Cp,Co,Nr,Td"bash
curl -s "https://api.semrush.com/?type=phrase_all&key=${SEMRUSH_API_KEY}&phrase=content+marketing&database=us&export_columns=Ph,Nq,Cp,Co,Nr,Td"Supported Databases
支持的数据库
Use where XX is: , , , , , , , , , , .
&database=XXusukcaaudefresitbrinjp使用指定地区,XX可选值:, , , , , , , , , , 。
&database=XXusukcaaudefresitbrinjp3. Related Keywords
3. 相关关键词
Find semantically related keywords for content planning and gap analysis.
查找语义相关的关键词,用于内容规划与差距分析。
Endpoint
接口地址
https://api.semrush.com/?type=phrase_related&key={KEY}&phrase={keyword}&database=us&export_columns=Ph,Nq,Cp,Co,Nr,Td&display_limit=20https://api.semrush.com/?type=phrase_related&key={KEY}&phrase={keyword}&database=us&export_columns=Ph,Nq,Cp,Co,Nr,Td&display_limit=20Example curl
curl示例
bash
curl -s "https://api.semrush.com/?type=phrase_related&key=${SEMRUSH_API_KEY}&phrase=project+management&database=us&export_columns=Ph,Nq,Cp,Co,Nr,Td&display_limit=20"bash
curl -s "https://api.semrush.com/?type=phrase_related&key=${SEMRUSH_API_KEY}&phrase=project+management&database=us&export_columns=Ph,Nq,Cp,Co,Nr,Td&display_limit=20"Parsing Multiple Rows
多行结果解析
bash
curl -s "..." | awk -F';' 'NR>1 { printf "%-40s Vol: %-8s CPC: $%-6s Comp: %s\n", $1, $2, $3, $4 }'bash
curl -s "..." | awk -F';' 'NR>1 { printf "%-40s 搜索量: %-8s 单次点击成本: $%-6s 竞争度: %s\n", $1, $2, $3, $4 }'4. Keyword Difficulty
4. 关键词难度
Estimate how hard it is to rank for a keyword.
估算关键词的排名难度。
Endpoint
接口地址
https://api.semrush.com/?type=phrase_kdi&key={KEY}&phrase={keyword}&database=us&export_columns=Ph,Kd| Column | Meaning |
|---|---|
| Keyword |
| Keyword difficulty (0-100) |
Interpretation:
- 0-29: Easy - achievable with quality content
- 30-49: Moderate - needs solid content + some backlinks
- 50-69: Hard - needs strong domain authority + backlinks
- 70-84: Very hard - requires established authority
- 85-100: Extremely hard - dominated by top-tier domains
https://api.semrush.com/?type=phrase_kdi&key={KEY}&phrase={keyword}&database=us&export_columns=Ph,Kd| 列名 | 含义 |
|---|---|
| 关键词 |
| 关键词难度(0-100) |
难度解读:
- 0-29: 容易 - 优质内容即可实现排名
- 30-49: 中等 - 需要优质内容+部分反向链接
- 50-69: 困难 - 需要较高域名权重+反向链接
- 70-84: 非常困难 - 需要成熟的域名权威
- 85-100: 极难 - 由头部域名主导
5. Domain Organic Keywords
5. 域名自然关键词
See which keywords a domain ranks for organically.
查看域名自然排名的关键词列表。
Endpoint
接口地址
https://api.semrush.com/?type=domain_organic&key={KEY}&domain={domain}&database=us&export_columns=Ph,Po,Nq,Cp,Url,Tr,Tc&display_limit=50&display_sort=tr_desc| Column | Meaning |
|---|---|
| Keyword |
| Position |
| Search volume |
| CPC |
| Ranking URL |
| Traffic (%) |
| Traffic cost |
https://api.semrush.com/?type=domain_organic&key={KEY}&domain={domain}&database=us&export_columns=Ph,Po,Nq,Cp,Url,Tr,Tc&display_limit=50&display_sort=tr_desc| 列名 | 含义 |
|---|---|
| 关键词 |
| 排名位置 |
| 搜索量 |
| 单次点击成本 |
| 排名页面URL |
| 流量占比(%) |
| 流量成本 |
Example curl
curl示例
bash
curl -s "https://api.semrush.com/?type=domain_organic&key=${SEMRUSH_API_KEY}&domain=hubspot.com&database=us&export_columns=Ph,Po,Nq,Cp,Url,Tr,Tc&display_limit=20&display_sort=tr_desc"bash
curl -s "https://api.semrush.com/?type=domain_organic&key=${SEMRUSH_API_KEY}&domain=hubspot.com&database=us&export_columns=Ph,Po,Nq,Cp,Url,Tr,Tc&display_limit=20&display_sort=tr_desc"6. Backlink Overview
6. 反向链接概览
Get a summary of a domain's backlink profile.
获取域名反向链接配置文件的摘要信息。
Endpoint
接口地址
https://api.semrush.com/analytics/v1/?key={KEY}&type=backlinks_overview&target={domain}&target_type=root_domain&export_columns=total,domains_num,urls_num,ips_num,follows_num,nofollows_num,texts_num,images_numhttps://api.semrush.com/analytics/v1/?key={KEY}&type=backlinks_overview&target={domain}&target_type=root_domain&export_columns=total,domains_num,urls_num,ips_num,follows_num,nofollows_num,texts_num,images_numExample curl
curl示例
bash
curl -s "https://api.semrush.com/analytics/v1/?key=${SEMRUSH_API_KEY}&type=backlinks_overview&target=example.com&target_type=root_domain&export_columns=total,domains_num,urls_num,ips_num,follows_num,nofollows_num,texts_num,images_num"bash
curl -s "https://api.semrush.com/analytics/v1/?key=${SEMRUSH_API_KEY}&type=backlinks_overview&target=example.com&target_type=root_domain&export_columns=total,domains_num,urls_num,ips_num,follows_num,nofollows_num,texts_num,images_num"7. Competitor Discovery
7. 竞争对手发现
Find domains competing for the same organic keywords.
查找与目标域名竞争相同自然关键词的域名。
Endpoint
接口地址
https://api.semrush.com/?type=domain_organic_organic&key={KEY}&domain={domain}&database=us&export_columns=Dn,Cr,Np,Or,Ot,Oc,Ad&display_limit=10| Column | Meaning |
|---|---|
| Competitor domain |
| Competition level |
| Common keywords |
| Organic keywords |
| Organic traffic |
| Organic traffic cost |
| Paid keywords |
https://api.semrush.com/?type=domain_organic_organic&key={KEY}&domain={domain}&database=us&export_columns=Dn,Cr,Np,Or,Ot,Oc,Ad&display_limit=10| 列名 | 含义 |
|---|---|
| 竞争对手域名 |
| 竞争程度 |
| 共同关键词数量 |
| 自然关键词数量 |
| 自然流量 |
| 自然流量成本 |
| 付费关键词数量 |
Example curl
curl示例
bash
curl -s "https://api.semrush.com/?type=domain_organic_organic&key=${SEMRUSH_API_KEY}&domain=notion.so&database=us&export_columns=Dn,Cr,Np,Or,Ot,Oc,Ad&display_limit=10"bash
curl -s "https://api.semrush.com/?type=domain_organic_organic&key=${SEMRUSH_API_KEY}&domain=notion.so&database=us&export_columns=Dn,Cr,Np,Or,Ot,Oc,Ad&display_limit=10"8. Traffic Analytics (Estimates)
8. 流量分析(估算)
Estimate a domain's overall traffic sources and engagement.
估算域名的整体流量来源与用户参与度。
Endpoint
接口地址
https://api.semrush.com/analytics/ta/api/v3/summary?key={KEY}&targets={domain}&display_date=2024-01-01&country=us&export_columns=target,visits,users,bounce_rate,pages_per_visit,avg_visit_durationhttps://api.semrush.com/analytics/ta/api/v3/summary?key={KEY}&targets={domain}&display_date=2024-01-01&country=us&export_columns=target,visits,users,bounce_rate,pages_per_visit,avg_visit_durationWorkflow: Full Competitive Analysis
工作流:完整竞争分析
When the user asks for a full competitive analysis, run these steps in order:
- Domain Overview - Get the target domain's metrics
- Competitor Discovery - Find top 5-10 competitors
- Domain Overview for each competitor - Compare metrics
- Top Keywords for each domain - Find keyword gaps
- Backlink Overview for each domain - Compare link profiles
当用户要求进行完整竞争分析时,按以下步骤执行:
- 域名概览 - 获取目标域名的各项指标
- 竞争对手发现 - 找出5-10个主要竞争对手
- 竞争对手域名概览 - 对比各竞争对手的指标
- 各域名核心关键词 - 发现关键词差距
- 各域名反向链接概览 - 对比链接配置文件
Output Format
输出格式
Present results as a comparison table:
| Metric | target.com | competitor1.com | competitor2.com |
|---------------------|-----------|-----------------|-----------------|
| SemRush Rank | ... | ... | ... |
| Organic Keywords | ... | ... | ... |
| Organic Traffic | ... | ... | ... |
| Traffic Cost | ... | ... | ... |
| Backlinks | ... | ... | ... |
| Referring Domains | ... | ... | ... |Then highlight:
- Keyword gaps: Keywords competitors rank for but target does not
- Quick wins: Keywords where target ranks positions 5-20 (improvement opportunities)
- Content gaps: Topics competitors cover but target does not
- Backlink opportunities: Sites linking to competitors but not target
以对比表格形式呈现结果:
| 指标 | target.com | competitor1.com | competitor2.com |
|---------------------|-----------|-----------------|-----------------|
| SemRush 排名 | ... | ... | ... |
| 自然关键词数量 | ... | ... | ... |
| 自然流量 | ... | ... | ... |
| 流量成本 | ... | ... | ... |
| 反向链接数量 | ... | ... | ... |
| 引用域名数量 | ... | ... | ... |然后重点突出:
- 关键词差距:竞争对手有排名但目标域名没有的关键词
- 快速优化机会:目标域名排名在5-20位的关键词(有提升空间)
- 内容差距:竞争对手覆盖但目标域名未涉及的主题
- 反向链接机会:链接到竞争对手但未链接到目标域名的站点
Rate Limits and Costs
调用限制与成本
- Each API call costs API units (check your plan)
- Use to control result count (default varies by endpoint)
&display_limit= - Cache results locally when doing multi-step analysis to avoid redundant calls
- Domain overview calls are cheapest; backlink and traffic analytics cost more
- 每次API调用消耗API点数(请查看你的套餐)
- 使用控制返回结果数量(默认值因接口而异)
&display_limit= - 多步骤分析时本地缓存结果,避免重复调用
- 域名概览调用成本最低;反向链接与流量分析成本较高
Error Handling
错误处理
| Error | Meaning |
|---|---|
| No data for this query |
| Invalid API key |
| API unit limit reached |
| Empty response | Usually means no data available for the query parameters |
When you get "NOTHING FOUND", try:
- Different database (e.g., instead of
uk)us - Root domain instead of subdomain
- Broader keyword phrase
| 错误信息 | 含义 |
|---|---|
| 该查询无数据返回 |
| API密钥无效 |
| API点数已达上限 |
| 空响应 | 通常表示查询参数对应的无可用数据 |
当收到“NOTHING FOUND”错误时,可尝试:
- 更换数据库(例如用代替
uk)us - 使用主域名而非子域名
- 使用更宽泛的关键词短语