competitor_get_keyword_gap
Competitor research read low risk
Part of the Competitor Keywords Agent.
What it does
The paid keyword gap from the client's side - the Ahrefs Keyword Gap, automated. Returns {client_domain, source_database, competitors[], gap_keywords[], rows_charged, usd_charged}. `gap_keywords` are the ACTUAL terms rivals buy and the client does not, each with `search_volume`, `cpc_broad`, `cpc_exact`, `monthly_cost_exact`, `advertisers_on_term`, `is_question` and `bid_on_by` naming which rivals bid on it - so a row goes straight into the opportunities table. `competitors[]` is the rival list with `shared_keywords`, `relevance` and `keywords_they_have_we_do_not`, which counts the gap rows THIS call returned for that rival and is therefore bounded by `limit`, not their whole footprint. Pass `competitors` from the onboarding document whenever they are known — the gap is only as good as the set it compares against. Without it the tool falls back to the tightest few SpyFu discovers by overlap. `compared_against` and `competitor_set` report which was used. gap_keywords are ranked by exact CPC rather than volume: a high bid is the market pricing commercial intent, whereas ranking by volume returns category giants like 'saas' or 'erp' that no advertiser should buy. Two calls under the hood: the PPC competitor list, then the gap itself. That is SpyFu. On SE Ranking the rival list carries counts (`keywords_they_have_we_do_not` is their total minus the shared keywords) and the gap comes back as keyword rows too: one keywords/comparison request per compared rival (the named set, else the tightest few), merged into `gap_keywords` with `search_volume`, `cpc`, `competition`, `bid_on_by` and `landing_pages`, ranked by CPC; `gap_rows` per rival counts them. 100 credits per request (credits_charged), 0 per row. The paid comparison is documented and not yet checked on a live account; a rival whose comparison fails keeps its counts and is named in a warning. Runs on the user's own SpyFu or SE Ranking account, connected under Competitor data in the Scalix console (ADR-103); `provider` says which was used. With nothing connected it returns not_configured naming the console step. Read-only; SpyFu bills per row ($0.20 per 1,000 rival rows, $1.00 per 1,000 gap rows).
When to use it
Use early in a competitor analysis to find the keyword gap: which competitors bid on the most terms the client is missing, so the deep per-competitor pulls go to the right domains. Also use it to discover competitors the client has not named — the rows come back ranked by overlap, which often surfaces rivals the media buyer did not list.
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
domain | string | yes | The CLIENT's bare domain, e.g. 'client.com'. The gap is computed from their side. |
competitors | array | no | The competitor domains to compare against — the set from the onboarding document. STRONGLY PREFERRED: without it the tool compares against the tightest few competitors SpyFu discovers, and a broad advertiser in that list drags its whole catalogue into the results (verified live: intuit.com arrived as a rival and returned HVAC dispatch software and cloud call centres as the top gap terms). Accepts domains or a comma/newline separated string. |
source | string | no | The market. SpyFu: two-letter country code, e.g. 'US' (default), 'UK', 'DE', 'AU' - 28 markets. SE Ranking: regional database, e.g. 'us' (default), 'uk', 'de'. Match the market the client competes in: a domain with no data in one market may be busy in another. |
limit | integer | no | Caps both the rival list (max 550) and the gap keyword rows (max 10000). Billing is per row, so this directly controls cost. |
provider | string | no | 'spyfu' or 'seranking'. Leave it out to use whichever the user connected under Competitor data in the Scalix console (SpyFu first when both are). |
Safeguards
Policy
Never present a figure as Google data; the vendor is named in the internal evidence note only, never in a client report. The gap is an index comparison, not a measured gap: a term the client already runs may still appear if SpyFu has not indexed it on their domain, so cross-reference gads_list_keywords before recommending anything. Take final CPC from gads_keyword_ideas.
Reminder
Read-only - nothing in any ad account changes. Runs on the user's own vendor plan; the key never appears in the response.
Errors
| Error class | Means | What to do | Retry |
|---|---|---|---|
not_configured | No SpyFu or SE Ranking account is connected to the user's Scalix account. | Connect SpyFu or SE Ranking under Competitor data in the Scalix console - searches run on the user's own plan and credits. Until then, open SpyFu -> Kombat, put the client against each competitor, take the terms only the rivals buy, and paste the export. | no |
invalid_argument | The domain was not a domain, or the provider is unknown. | Pass the client's bare domain, e.g. 'client.com', and provider 'spyfu' or 'seranking' (or none). | no |
needs_reauth | The vendor rejected the key connected to the user's Scalix account, or the plan does not include API access. | Paste a new key under Competitor data in the Scalix console: SpyFu -> Account Settings -> API Usage (Pro + AI or Team/Agency - Basic has no API), or SE Ranking -> Profile & Preferences -> API Dashboard (type Data). The console card turns amber until then. | no |
quota_exhausted | The vendor balance is used up (SE Ranking answers 403 Insufficient funds and does not charge that request). | Top up the SpyFu API balance or the SE Ranking wallet, or export the gap from SpyFu -> Kombat and paste it. | no |
not_found | The vendor has no data for that domain in that market. | Check the domain spelling and try the market code for the client's actual market before concluding anything. | no |
rate_limited | The vendor's rate limit was hit. | Back off and retry in a minute. | yes |
platform_unavailable | The vendor was unreachable or returned a server error. | Retry in a minute; if it persists, collect the gap manually and say so in the evidence note. | yes |
Edge cases
- Pass `competitors` from the onboarding document. The discovered fallback is capped at the tightest few by overlap on purpose — feeding more rivals makes the gap worse, not better.
- A named rival SpyFu does not list as a competitor still gets a row, so a set the strategist chose is never silently narrowed.
- Ranked by exact CPC, so the rows are low-volume and high-intent by design. That is the shape of a B2B gap; raise `limit` rather than expecting head terms.
- Pass the CLIENT domain as `domain`, not a competitor's — a competitor answers a different question (who competes with THEM).
- gap_keywords are real keyword rows, not a count, so they can be used directly; keywords_they_have_we_do_not is derived by counting those rows per rival and is therefore bounded by `limit`.
- With no rivals found and none named, gap_keywords is empty and the second call is skipped rather than charged for.
- The gap does not account for what the client already runs; exclude enabled keywords using gads_list_keywords before recommending anything.
- cpc_exact can be null on some rows even though the sort uses it.
- Billing is per row returned across both calls, reported as rows_charged and usd_charged.
- SE Ranking: a named rival it does not list still gets a row with null counts, and its gap rows still come from its own comparison request.