get_keyword_gap
Compares the project's own domain against up to 3 competitor domains and classifies every keyword a competitor ranks for as missing / behind / tied / ahead / unknown. The inverse of find_serp_competitors, which asks who competes for a keyword set. CHARGES CREDITS: one ranked-keywords lookup per domain, so one call costs up to 4 upstream requests (our domain plus the competitors). Each lookup is cached 12h per domain, so re-running the same comparison with a different sort or classification filter is free — do that rather than issuing a new comparison. Compares the top 1000 keywords per domain by search volume, so a large domain is compared on a slice; per-domain coverage reports keywordsFetched, keywordsTotal, truncated and volumeFloor. missing and unknown are NOT interchangeable: missing means a competitor ranks and we provably do not; unknown means our own slice ran out above that keyword's volume, so nothing was measured about whether we rank. Never present unknown as a gap. The project's own domain is read from the project record and cannot be passed in — if the project has no domain the call fails with a validation error telling the user to set one. When unavailable is true, no configured data provider has a ranked-keyword source and no comparison happened; the empty rows in that case does NOT mean the competitors rank for nothing. At most 200 rows are returned; totalRows is the real match count.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | Required. The MisarSEO project ID to scope this call to. Get one from list_projects. | |
| sortField | No | Sort column: 'volume' (default), 'theirPosition' or 'ourPosition'. All three are measured values — there is deliberately no composite opportunity score. Nulls sort last in both directions. | |
| sortOrder | No | Sort direction. Defaults to 'desc'. | |
| languageCode | No | Language code (e.g. 'en', 'es', 'fr'). Omit it to use the project's default market language, which falls back to 'en'. | |
| locationCode | No | DataForSEO location code. Omit it to use the project's default market, which falls back to 2840 (United States) for a project that has not set one. See dataforseo.com/help-center/locations. Some countries (e.g. Iceland, 2352) are served from Google Ads data: keyword volume/CPC/trends work, but keyword difficulty, search intent, and domain analytics are unavailable. | |
| classifications | No | Restrict rows to these classifications. Omit for all five — omitting never hides `unknown`. The filter is applied before the row cap, and `totalRows` reports the pre-cap match count. | |
| competitorDomains | Yes | 1–3 competitor domains (bare domain or full URL). Each one is a separate billable ranked-keywords lookup, so pick the rivals actually being chased. The project's own domain is added automatically and is ignored if it appears here. | |
| includeSubdomains | No | Count subdomains as part of a domain. Defaults to true, and applies to every compared domain including ours. |