Grab Google Rankings from VALUE SERP API using R'


It's a great paid API that provides ranking data for a cheap price.

How to use its API?

>> Create an account <<

When you create your account, you are given a few dollars to test the service.

API Authentication

Grab your API key from your profile

Here is how you can send query, replace the api_key with your own below.

# Loading the right libraries

# Parameters list
params = list(
      `api_key` = 'XXXXXX',
      `q` = "covid",
      `gl` = "fr",
      `hl` = "fr",
      `num` = 20,
      `google_domain` = ''
# q : the search query
# gl : 2 letter country code 
# hl : language code
# num : number of result asked

# ask for the data
res <- httr::GET(url = '', query = params)

# translate to string
res_text <- httr::content(res, "text")

# translate to a more readable format
res_json <- jsonlite::fromJSON(res_text, flatten = TRUE)

You can inspect the result by running this command line


To make it easier for you, I have created a function that you can copy and paste, just replace the api_key with your own below.

serpValueRank <- function(myKwd, glang, hlang, nbr, tld){
  all_full_txt <- data.frame(matrix(ncol = 2, nrow = 0))
  colnames(all_full_txt) <- c("kwd", "POS1")
  for (i in 1:length(myKwd)) {
    params = list(
      `api_key` = 'XXXXXX',
      `q` = myKwd[i],
      `gl` = glang,
      `hl` = hlang,
      `num` = nbr,
      `google_domain` = paste0('google', tld)
    message(i, " ", myKwd[i])
    all_full_txt[i, "kwd"] <- myKwd[i]
    res <- httr::GET(url = '', query = params)
    res_text <- httr::content(res, "text")
    res_json <- jsonlite::fromJSON(res_text, flatten = TRUE)
    for (rslt in 1:length(res_json[["organic_results"]][["link"]])) {
      all_full_txt[i, paste0("POS", rslt)] <-

after this has been copy-pasted, you can just launch the function as many times as you want. you can ask for one ranking

ranking <- serpValueRank("covid", "fr", "fr", 20, ".fr")

or several at once

kwds <- c("covid", "covid test", "covid booster")

kwdsRankings <- serpValueRank(kwds, "fr", "fr", 20, ".fr")


You can also save those results as a CSV or an Excel file

⚠️ By default, VALUE SERP will separate all SERP features. Meaning 'organic result' will exclude the video carousel for example. If you would like all of them flattened into the organic_results array, then you could use “flatten_results=true”. The flattened “position” property will include every SERP features

Last updated