SEOpost/keyword-gap

Keyword gap between two domains

CompetitorsKeywords
Cost / request

$0.01

Response format

JSON

Protocol

REST

Description

Compares two domains' organic rankings keyword by keyword. Each row carries keyword_data plus first_domain_serp_element (target1's ranking) and second_domain_serp_element (target2's) with rank_absolute, rank_group and the ranked URL. The classic gap query is: competitor ranks well, you don't — filters: [["first_domain_serp_element.rank_absolute",">",20],"and",["second_domain_serp_element.rank_absolute","<=",10]] with target1 = you, target2 = the competitor (a missing element means that domain does not rank at all). Cost scales with rows; the default 100 is enough for most gap analyses.

Parameters

bodyRequest Bodyrequired

Content type: application/json

{
  "type": "object",
  "required": [
    "target1",
    "target2"
  ],
  "properties": {
    "target1": {
      "type": "string",
      "description": "First domain (e.g. your domain), no protocol."
    },
    "target2": {
      "type": "string",
      "description": "Second domain (e.g. a competitor), no protocol."
    },
    "location_code": {
      "type": "integer",
      "description": "Geo target as a location code. Default 2840 (United States).",
      "default": 2840
    },
    "language_code": {
      "type": "string",
      "description": "Two-letter language code. Default 'en'.",
      "default": "en"
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 1000,
      "default": 100,
      "description": "Max intersecting keywords to return. Default 100."
    },
    "offset": {
      "type": "integer",
      "minimum": 0,
      "description": "Pagination offset."
    },
    "filters": {
      "type": "array",
      "items": {},
      "description": "Optional filter expression as [field, operator, value] triples joined by 'and'/'or'. Operators: =, <>, <, <=, >, >=, in, not_in, like, not_like. Recipe (their wins, your gaps): [[\"first_domain_serp_element.rank_absolute\",\">\",20],\"and\",[\"second_domain_serp_element.rank_absolute\",\"<=\",10]]."
    },
    "order_by": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Sort rules."
    }
  }
}

Responses

Keywords both domains rank for, with each domain's position, in `result[0].items`.

{
  "type": "object"
}

Agent / Developer Schema

Machine-readable formats for integrating this endpoint into AI agents and toolchains.

{
  "operationId": "keyword_gap",
  "method": "post",
  "path": "/keyword-gap",
  "summary": "Keyword gap between two domains",
  "description": "Compares two domains' organic rankings keyword by keyword. Each row carries keyword_data plus first_domain_serp_element (target1's ranking) and second_domain_serp_element (target2's) with rank_absolute, rank_group and the ranked URL. The classic gap query is: competitor ranks well, you don't — filters: [[\"first_domain_serp_element.rank_absolute\",\">\",20],\"and\",[\"second_domain_serp_element.rank_absolute\",\"<=\",10]] with target1 = you, target2 = the competitor (a missing element means that domain does not rank at all). Cost scales with rows; the default 100 is enough for most gap analyses.",
  "parameters": [],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "target1",
            "target2"
          ],
          "properties": {
            "target1": {
              "type": "string",
              "description": "First domain (e.g. your domain), no protocol."
            },
            "target2": {
              "type": "string",
              "description": "Second domain (e.g. a competitor), no protocol."
            },
            "location_code": {
              "type": "integer",
              "description": "Geo target as a location code. Default 2840 (United States).",
              "default": 2840
            },
            "language_code": {
              "type": "string",
              "description": "Two-letter language code. Default 'en'.",
              "default": "en"
            },
            "limit": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 100,
              "description": "Max intersecting keywords to return. Default 100."
            },
            "offset": {
              "type": "integer",
              "minimum": 0,
              "description": "Pagination offset."
            },
            "filters": {
              "type": "array",
              "items": {},
              "description": "Optional filter expression as [field, operator, value] triples joined by 'and'/'or'. Operators: =, <>, <, <=, >, >=, in, not_in, like, not_like. Recipe (their wins, your gaps): [[\"first_domain_serp_element.rank_absolute\",\">\",20],\"and\",[\"second_domain_serp_element.rank_absolute\",\"<=\",10]]."
            },
            "order_by": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Sort rules."
            }
          }
        },
        "example": {
          "target1": "yourapp.com",
          "target2": "competitor.com",
          "limit": 100
        }
      }
    }
  },
  "responses": [
    {
      "statusCode": "200",
      "description": "Keywords both domains rank for, with each domain's position, in `result[0].items`.",
      "content": {
        "application/json": {
          "schema": {
            "type": "object"
          }
        }
      }
    },
    {
      "statusCode": "400",
      "description": "Bad request or upstream task error."
    },
    {
      "statusCode": "401",
      "description": "Unauthorized."
    },
    {
      "statusCode": "429",
      "description": "Too many requests."
    },
    {
      "statusCode": "5XX",
      "description": "Upstream error."
    }
  ]
}

Pricing

$0.01per successful request

Credits are deducted from your agntdata balance on each successful API call. Failed requests (4xx/5xx) are not charged.

Start using this endpoint

Generate your API key and make your first call in under a minute. Free tier available with transparent pricing.