Semrush research skill
SEO and competitive intelligence via the SemRush API.
by OpenClaudia·MIT license·★ 705 Stars on the repo·GitHub ↗
npx degit OpenClaudia/openclaudia-skills/skills/semrush-research#main ~/.claude/skills/semrush-researchChecked ·commit main
Files of Semrush research
Show the full text299 lines
SemRush Research
Pull live SEO and competitive intelligence data from the SemRush API.
Prerequisites
Requires SEMRUSH_API_KEY set in .env, .env.local, or ~/.claude/.env.global.
# Verify 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_keyto your.envfile.
API Base
All requests go to https://api.semrush.com/ with the API key passed as &key={SEMRUSH_API_KEY}.
Responses are semicolon-delimited CSV. The first line is the header row. Parse accordingly.
1. Domain Overview
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}
Export Columns
| Column | Meaning |
|---|---|
Dn |
Domain |
Rk |
SemRush Rank |
Or |
Organic keywords count |
Ot |
Organic traffic estimate |
Oc |
Organic traffic cost ($) |
Ad |
Paid keywords count |
At |
Paid traffic estimate |
Ac |
Paid traffic cost ($) |
Example curl
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
# Response format (semicolon-delimited):
# Dn;Rk;Or;Ot;Oc;Ad;At;Ac
# example.com;12345;8234;145000;234500;120;3400;5600
# Parse with 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
}'
2. Keyword Overview
Get search volume, CPC, competition, and SERP features for a keyword.
Endpoint
https://api.semrush.com/?type=phrase_all&key={KEY}&phrase={keyword}&database=us&export_columns=Ph,Nq,Cp,Co,Nr,Td
Export Columns
| Column | Meaning |
|---|---|
Ph |
Keyword phrase |
Nq |
Search volume (monthly) |
Cp |
CPC (USD) |
Co |
Competition (0-1) |
Nr |
Number of results |
Td |
Trend (12 months, comma-separated) |
Example curl
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 &database=XX where XX is: us, uk, ca, au, de, fr, es, it, br, in, jp.
3. Related Keywords
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=20
Example curl
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
curl -s "..." | awk -F';' 'NR>1 { printf "%-40s Vol: %-8s CPC: $%-6s Comp: %s\n", $1, $2, $3, $4 }'
4. Keyword Difficulty
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 |
|---|---|
Ph |
Keyword |
Kd |
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
5. Domain Organic Keywords
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 |
|---|---|
Ph |
Keyword |
Po |
Position |
Nq |
Search volume |
Cp |
CPC |
Url |
Ranking URL |
Tr |
Traffic (%) |
Tc |
Traffic cost |
Example curl
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
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_num
Example curl
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
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 |
|---|---|
Dn |
Competitor domain |
Cr |
Competition level |
Np |
Common keywords |
Or |
Organic keywords |
Ot |
Organic traffic |
Oc |
Organic traffic cost |
Ad |
Paid keywords |
Example curl
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)
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_duration
Workflow: 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
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
Rate Limits and Costs
- Each API call costs API units (check your plan)
- Use
&display_limit=to control result count (default varies by endpoint) - Cache results locally when doing multi-step analysis to avoid redundant calls
- Domain overview calls are cheapest; backlink and traffic analytics cost more
Error Handling
| Error | Meaning |
|---|---|
ERROR 50 :: NOTHING FOUND |
No data for this query |
ERROR 120 :: WRONG KEY |
Invalid API key |
ERROR 130 :: LIMIT EXCEEDED |
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.,
ukinstead ofus) - Root domain instead of subdomain
- Broader keyword phrase
| 1 | |
| 2 | name semrush-research |
| 3 | description > |
| 4 | SEO and competitive intelligence via the SemRush API. Use when asked to |
| 5 | research competitors, analyze domains, find keyword opportunities, check |
| 6 | backlinks, or estimate traffic. Trigger phrases: "competitor analysis", |
| 7 | "domain overview", "keyword research", "backlink check", "traffic estimate", |
| 8 | "SEO intelligence", "semrush", "competitive research". |
| 9 | |
| 10 | |
| 11 | # SemRush Research |
| 12 | |
| 13 | Pull live SEO and competitive intelligence data from the SemRush API. |
| 14 | |
| 15 | ## Prerequisites |
| 16 | |
| 17 | Requires `SEMRUSH_API_KEY` set in `.env`, `.env.local`, or `~/.claude/.env.global`. |
| 18 | |
| 19 | |
| 20 | # Verify the key is available |
| 21 | echo "SEMRUSH_API_KEY is ${SEMRUSH_API_KEY:+set}" |
| 22 | |
| 23 | |
| 24 | If the key is not set, instruct the user: |
| 25 | > You need a SemRush API key. Get one at https://www.semrush.com/api/ |
| 26 | > Then add `SEMRUSH_API_KEY=your_key` to your `.env` file. |
| 27 | |
| 28 | ## API Base |
| 29 | |
| 30 | All requests go to `https://api.semrush.com/` with the API key passed as `&key={SEMRUSH_API_KEY}`. |
| 31 | |
| 32 | Responses are semicolon-delimited CSV. The first line is the header row. Parse accordingly. |
| 33 | |
| 34 | |
| 35 | |
| 36 | ## 1. Domain Overview |
| 37 | |
| 38 | Get a high-level snapshot of any domain's organic and paid search performance. |
| 39 | |
| 40 | ### Endpoint |
| 41 | |
| 42 | |
| 43 | https://api.semrush.com/?type=domain_ranks&key={KEY}&export_columns=Dn,Rk,Or,Ot,Oc,Ad,At,Ac&domain={domain} |
| 44 | |
| 45 | |
| 46 | ### Export Columns |
| 47 | |
| 48 | | Column | Meaning | |
| 49 | |--------|---------| |
| 50 | | `Dn` | Domain | |
| 51 | | `Rk` | SemRush Rank | |
| 52 | | `Or` | Organic keywords count | |
| 53 | | `Ot` | Organic traffic estimate | |
| 54 | | `Oc` | Organic traffic cost ($) | |
| 55 | | `Ad` | Paid keywords count | |
| 56 | | `At` | Paid traffic estimate | |
| 57 | | `Ac` | Paid traffic cost ($) | |
| 58 | |
| 59 | ### Example curl |
| 60 | |
| 61 | |
| 62 | 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" |
| 63 | |
| 64 | |
| 65 | ### Parsing the Response |
| 66 | |
| 67 | |
| 68 | # Response format (semicolon-delimited): |
| 69 | # Dn;Rk;Or;Ot;Oc;Ad;At;Ac |
| 70 | # example.com;12345;8234;145000;234500;120;3400;5600 |
| 71 | |
| 72 | # Parse with awk |
| 73 | curl -s "..." | awk -F';' 'NR==2 { |
| 74 | 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", |
| 75 | $1,$2,$3,$4,$5,$6,$7,$8 |
| 76 | }' |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | ## 2. Keyword Overview |
| 82 | |
| 83 | Get search volume, CPC, competition, and SERP features for a keyword. |
| 84 | |
| 85 | ### Endpoint |
| 86 | |
| 87 | |
| 88 | https://api.semrush.com/?type=phrase_all&key={KEY}&phrase={keyword}&database=us&export_columns=Ph,Nq,Cp,Co,Nr,Td |
| 89 | |
| 90 | |
| 91 | ### Export Columns |
| 92 | |
| 93 | | Column | Meaning | |
| 94 | |--------|---------| |
| 95 | | `Ph` | Keyword phrase | |
| 96 | | `Nq` | Search volume (monthly) | |
| 97 | | `Cp` | CPC (USD) | |
| 98 | | `Co` | Competition (0-1) | |
| 99 | | `Nr` | Number of results | |
| 100 | | `Td` | Trend (12 months, comma-separated) | |
| 101 | |
| 102 | ### Example curl |
| 103 | |
| 104 | |
| 105 | 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" |
| 106 | |
| 107 | |
| 108 | ### Supported Databases |
| 109 | |
| 110 | Use `&database=XX` where XX is: `us`, `uk`, `ca`, `au`, `de`, `fr`, `es`, `it`, `br`, `in`, `jp`. |
| 111 | |
| 112 | |
| 113 | |
| 114 | ## 3. Related Keywords |
| 115 | |
| 116 | Find semantically related keywords for content planning and gap analysis. |
| 117 | |
| 118 | ### Endpoint |
| 119 | |
| 120 | |
| 121 | https://api.semrush.com/?type=phrase_related&key={KEY}&phrase={keyword}&database=us&export_columns=Ph,Nq,Cp,Co,Nr,Td&display_limit=20 |
| 122 | |
| 123 | |
| 124 | ### Example curl |
| 125 | |
| 126 | |
| 127 | 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" |
| 128 | |
| 129 | |
| 130 | ### Parsing Multiple Rows |
| 131 | |
| 132 | |
| 133 | curl -s "..." | awk -F';' 'NR>1 { printf "%-40s Vol: %-8s CPC: $%-6s Comp: %s\n", $1, $2, $3, $4 }' |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | ## 4. Keyword Difficulty |
| 139 | |
| 140 | Estimate how hard it is to rank for a keyword. |
| 141 | |
| 142 | ### Endpoint |
| 143 | |
| 144 | |
| 145 | https://api.semrush.com/?type=phrase_kdi&key={KEY}&phrase={keyword}&database=us&export_columns=Ph,Kd |
| 146 | |
| 147 | |
| 148 | | Column | Meaning | |
| 149 | |--------|---------| |
| 150 | | `Ph` | Keyword | |
| 151 | | `Kd` | Keyword difficulty (0-100) | |
| 152 | |
| 153 | Interpretation: |
| 154 | 0-29: Easy - achievable with quality content |
| 155 | 30-49: Moderate - needs solid content + some backlinks |
| 156 | 50-69: Hard - needs strong domain authority + backlinks |
| 157 | 70-84: Very hard - requires established authority |
| 158 | 85-100: Extremely hard - dominated by top-tier domains |
| 159 | |
| 160 | |
| 161 | |
| 162 | ## 5. Domain Organic Keywords |
| 163 | |
| 164 | See which keywords a domain ranks for organically. |
| 165 | |
| 166 | ### Endpoint |
| 167 | |
| 168 | |
| 169 | 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 |
| 170 | |
| 171 | |
| 172 | | Column | Meaning | |
| 173 | |--------|---------| |
| 174 | | `Ph` | Keyword | |
| 175 | | `Po` | Position | |
| 176 | | `Nq` | Search volume | |
| 177 | | `Cp` | CPC | |
| 178 | | `Url` | Ranking URL | |
| 179 | | `Tr` | Traffic (%) | |
| 180 | | `Tc` | Traffic cost | |
| 181 | |
| 182 | ### Example curl |
| 183 | |
| 184 | |
| 185 | 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" |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | ## 6. Backlink Overview |
| 191 | |
| 192 | Get a summary of a domain's backlink profile. |
| 193 | |
| 194 | ### Endpoint |
| 195 | |
| 196 | |
| 197 | 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_num |
| 198 | |
| 199 | |
| 200 | ### Example curl |
| 201 | |
| 202 | |
| 203 | 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" |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | ## 7. Competitor Discovery |
| 209 | |
| 210 | Find domains competing for the same organic keywords. |
| 211 | |
| 212 | ### Endpoint |
| 213 | |
| 214 | |
| 215 | 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 |
| 216 | |
| 217 | |
| 218 | | Column | Meaning | |
| 219 | |--------|---------| |
| 220 | | `Dn` | Competitor domain | |
| 221 | | `Cr` | Competition level | |
| 222 | | `Np` | Common keywords | |
| 223 | | `Or` | Organic keywords | |
| 224 | | `Ot` | Organic traffic | |
| 225 | | `Oc` | Organic traffic cost | |
| 226 | | `Ad` | Paid keywords | |
| 227 | |
| 228 | ### Example curl |
| 229 | |
| 230 | |
| 231 | 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" |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | ## 8. Traffic Analytics (Estimates) |
| 237 | |
| 238 | Estimate a domain's overall traffic sources and engagement. |
| 239 | |
| 240 | ### Endpoint |
| 241 | |
| 242 | |
| 243 | 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_duration |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | ## Workflow: Full Competitive Analysis |
| 249 | |
| 250 | When the user asks for a full competitive analysis, run these steps in order: |
| 251 | |
| 252 | **Domain Overview** - Get the target domain's metrics |
| 253 | **Competitor Discovery** - Find top 5-10 competitors |
| 254 | **Domain Overview** for each competitor - Compare metrics |
| 255 | **Top Keywords** for each domain - Find keyword gaps |
| 256 | **Backlink Overview** for each domain - Compare link profiles |
| 257 | |
| 258 | ### Output Format |
| 259 | |
| 260 | Present results as a comparison table: |
| 261 | |
| 262 | |
| 263 | | Metric | target.com | competitor1.com | competitor2.com | |
| 264 | |---------------------|-----------|-----------------|-----------------| |
| 265 | | SemRush Rank | ... | ... | ... | |
| 266 | | Organic Keywords | ... | ... | ... | |
| 267 | | Organic Traffic | ... | ... | ... | |
| 268 | | Traffic Cost | ... | ... | ... | |
| 269 | | Backlinks | ... | ... | ... | |
| 270 | | Referring Domains | ... | ... | ... | |
| 271 | |
| 272 | |
| 273 | Then highlight: |
| 274 | **Keyword gaps**: Keywords competitors rank for but target does not |
| 275 | **Quick wins**: Keywords where target ranks positions 5-20 (improvement opportunities) |
| 276 | **Content gaps**: Topics competitors cover but target does not |
| 277 | **Backlink opportunities**: Sites linking to competitors but not target |
| 278 | |
| 279 | ## Rate Limits and Costs |
| 280 | |
| 281 | Each API call costs API units (check your plan) |
| 282 | Use `&display_limit=` to control result count (default varies by endpoint) |
| 283 | Cache results locally when doing multi-step analysis to avoid redundant calls |
| 284 | Domain overview calls are cheapest; backlink and traffic analytics cost more |
| 285 | |
| 286 | ## Error Handling |
| 287 | |
| 288 | | Error | Meaning | |
| 289 | |-------|---------| |
| 290 | | `ERROR 50 :: NOTHING FOUND` | No data for this query | |
| 291 | | `ERROR 120 :: WRONG KEY` | Invalid API key | |
| 292 | | `ERROR 130 :: LIMIT EXCEEDED` | API unit limit reached | |
| 293 | | Empty response | Usually means no data available for the query parameters | |
| 294 | |
| 295 | When you get "NOTHING FOUND", try: |
| 296 | Different database (e.g., `uk` instead of `us`) |
| 297 | Root domain instead of subdomain |
| 298 | Broader keyword phrase |
| 299 |
Discussion
Alternatives
Browse more free Claude skills or everything in Marketing.