Get access to 30+ marketing and SEO tools. analyze competitors, keywords, and backlinks for free..
Sign in Sign Up

We use cookies to make Serpstat better. By clicking "Accept cookies", you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Learn more

Top for a keyword (keyword_top)

keyword_top — method shows you Google top 100 or Yandex top 50 organic search results for the keyword you requested.

Metrics Description
result Encapsulates the answer
results Number of results
top Encapsulates the result
url Page that is ranking on the ""position""
domain Domain
position Domain's position for a keyword
ads Ads found
status_msg Response "OK" or "Error" report on a successful or unsuccessful request
status_code Response code "200" — successful request.
Errors occur when limits are exceeded (number of simultaneous requests or account limits)
left_lines Number of remaining API queries

Part of the API response, for which 1 limit is charged:

 {
"position": 1,
"url": "https://www.bestbuy.com/site/computers-pcs/laptop-computers/abcat0502000.c?id=abcat0502000",
"domain": "bestbuy.com",
"subdomain": "www.bestbuy.com",
"types": [
"related_search",
"snip_info"
]
}

Example PHP Python
Request data:
Response data:
// http://api.serpstat.com/v3/keyword_top?query=buy%20laptop&token=XXX&se=g_ua

{
  "result": {
    "top": [
      {
        "position": 1,
        "url": "https://www.bestbuy.com/site/computers-pcs/laptop-computers/abcat0502000.c?id=abcat0502000",
        "domain": "bestbuy.com",
        "subdomain": "www.bestbuy.com",
        "types": [
          "related_search",
          "snip_info"
        ]
      },
      {
        "position": 2,
        "url": "https://www.amazon.com/Notebooks-Laptop-Computers/b?ie=UTF8&node=565108",
        "domain": "amazon.com",
        "subdomain": "www.amazon.com",
        "types": [
          "related_search",
          "snip_info"
        ]
      },
      ""ads"":[  

      ]
   },
   ""status_msg"":""OK"",
   ""status_code"":200,
   ""left_lines"":998691
}"

<?php
// This example works on serpstat-sdk only
// https://github.com/SerpstatGlobal/serpstat-sdk

require_once __DIR__ . '/../vendor/autoload.php';
// configure your application
$config = [
    'token' => '19666fc1ae1724da1d5ea2f3a99d5f5a',
];
$keywords = 'keywords';
// init client with your serpstat api token
$apiClient = new \Serpstat\Sdk\Core\ApiGuzzleHttpClient($config['token']);
// create instance of any api method class
// list of methods classes in folder src\Methods
$apiMethod = new \Serpstat\Sdk\Methods\KeywordTopMethod(
    $keywords,
    \Serpstat\Sdk\Interfaces\IApiClient::SE_GOOGLE_RU
);
try {
    // try call api method
    $response = $apiClient->call($apiMethod);
} catch (\Exception $e) {
    // catch api error
    $response = $e->getMessage();
}

 

import codecs
import json
import pprint
import urllib.request as urlrequest
from urllib.parse import urlencode

host = 'http://api.serpstat.com/v3'

method = 'keyword_top'
params = {
    'query': 'buy%20laptop',  # string for get info
    'se': 'g_us',  # string search engine
    'token': 'ijmiom4f5m34905g03um8342dm04923lre3w',  # string personal token
}

api_url = "{host}/{method}?{params}".format(
    host=host,
    method=method,
    params=urlencode(params)
)

try:
    json_data = urlrequest.urlopen(api_url).read()
except Exception as e0:
    print("API request error: {error}".format(error=e0))

data = json.loads(json_data)
pprint.pprint(data)

Share this article with your friends

Sign In Free Sign Up

You’ve reached your query limit.

Or email
Forgot password?
Or email
Optional
Back To Login

Don’t worry! Just fill in your email and we’ll send over your password.

Are you sure?

Awesome!

To complete your registration you need to enter your phone number

Back

We sent confirmation code to your phone number

Your phone Resend code Queries left

Something went wrong.

Contact our support team
Or confirm the registration using the Telegram bot Follow this link
Please pick the project to work on

Introducing Serpstat

Find out about the main features of the service in a convenient way for you!

Please send a request, and our specialist will offer you education options: a personal demonstration, a trial period, or materials for self-study and increasing expertise — everything for a comfortable start to work with Serpstat.

Name

Email

Phone

We are glad of your comment
Upgrade your plan

Upgrade your plan

Export is not available for your account. Please upgrade to Lite or higher to get access to the tool. Learn more

Sign Up Free

Thank you, we have saved your new mailing settings.

Invite
View Editing

E-mail
Message
Optional
E-mail
Message
Optional

You have run out of limits

You have reached the limit for the number of created projects. You cannot create new projects unless you increase the limits or delete existing projects.

I want more limits
Open support chat