Skip to content
On this page

SERPs

This section describes getting SERP data for a specified keyword result.

Finding the SERP ID

To locate the SERP ID in the Nightwatch app, navigate to the keyword SERP Preview page and find the ID at the top-right corner.

SERP ID Location in the app

You can also retrieve the SERP ID programmatically using the keyword results endpoint. The id field in the response corresponds to the SERP ID, which can be used to fetch SERPs.

Get SERP Data

shell
curl 'https://api.nightwatch.io/api/v1/serp_data/RESULT_ID?access_token=ACCESS_TOKEN'

The above command returns JSON structured like this:

json
{
  "keyword":"example",
  "engine":"google",
  "rank_time":"2019-08-25T03:11:51.614409Z",
  "rank_date":"2019-08-25",
  "locale":"en",
  "data_center":"us",
  "location":"New York, New York, United States",
  "total_number_of_results":160000,
  "serp":{
    "1":{
      "title":"Example #1",
      "href":"https://test.example.com/page/1",
      "description":"This is the first example",
      "base_url":"test.example.com",
      "base_domain":"example.com",
      "position":1
    },
    "2":{
      "title":"Example #2",
      "href":"https://www.example.com/2",
      "description":"This is the second example",
      "base_url":"www.example.com",
      "base_domain":"example.com",
      "position":2
    },
    // ...
    // result slots can be null if they're
    // missing (e.g. less than 100 results)
    "100":null
  },
  "local_pack":{
    "results":[
      {
        "title":"Local result",
        "cid": "1234567890",
        "href":"https://www.example.com/local"
      }
    ],
    "present":true
  },
  "local_image_carousel":{
    "results":[
      {
        "title":"Local result"
      }
    ],
    "present":true
  },
  "knowledge_panel":{
    "results":[
      {
        "title":"Knowledge panel result",
        "cid": "1234567890",
        "href":"https://www.example.com/knowledge-panel"
      }
    ],
    "present":true
  },
  "featured_snippets":{
    "results":[
      {
        "title":"Featured snippet result",
        "href":"https://www.example.com/snippet"
      }
    ],
    "present":true
  }
}

HTTP Request

GET https://api.nightwatch.io/api/v1/serp_data/RESULT_ID?access_token=ACCESS_TOKEN

Response structure:

AttributeDescription
keywordKeyword query string
engineSearch engine (google, places, bing, yahoo, duckduckgo, youtube)
rank_timeThe time the SERP was processed
rank_dateThe date the SERP was processed
localeRequested search language (e.g. en)
data_centerRequested search country (e.g. us)
locationSearch location (e.g. New York, New York, United States)
total_number_of_resultsThe total number of search results
serpA JSON object of ranked organic results
local_packA JSON object containing a list of local pack results
local_image_carouselA JSON object containing a list of carousel results
knowledge_panelA JSON object containing a list of knowledge panel results
featured_snippetsA JSON object containing a list of featured snippet results