Learn R Programming

serpstatr

The aim of serpstatr is to provide a wrapper for the latest version of Serpstat API. The main purpose of this API is automation of common SEO and PPC tasks like keywords research and competitors analysis in Google.

All package functions names have the same structure:

  • sst_ prefix to distinguish from other packages
  • Serpstat modules prefix (for example, sa_ for search analytics)
  • API function name

How to use

  1. Get your API key. It is required

in all package functions. Set it as a SERPSTAT_API_TOKEN system variable. All functions are using it by default.

  1. Search analytics

Check if you have enough limits to make API calls

sst_sa_stats()$summary_info$left_lines

Get database ID to make requests:

sst_sa_database_info()$data

Call functions to get keywords data:

  • sst_sa_domains_info() - domain summary stats
  • sst_sa_domain_keywords() - domain keywords with stats
  • sst_sa_domain_history() - domain historical metrics
  • sst_sa_domain_top_pages() - domain top pages
  • sst_sa_domain_organic_competitors() - domain organic competitors
  • sst_sa_domain_regions_count() - number of keywords per region for a domain
  • sst_sa_keywords_info() - keywords summary stats
  • sst_sa_keywords() - search Serpstat database for keywords with stats
  • sst_sa_related_keywords() - semantically related keywords for a given keyword
  • sst_sa_keyword_top() - get list of URLs from SERP for a keyword
sst_sa_keywords_info(
  keywords      = c('seo', 'ppc', 'serpstat'),
  se            = 'g_us',
  sort          = list(cost = 'asc'),
  return_method = 'df'
)$data
  1. Backlinks

Call functions to get the data on the backlinks:

  • sst_bl_domain_summary() - backlinks summary stats for the domain
  • sst_bl_referring_domains() - referring domains stats for the domain
sst_bl_domain_summary(
  domain        = 'serpstat.com',
  search_type   = 'domain',
  return_method = 'list'
  )$data
  
  1. Rank tracker

Call functions to get the data on your rankings:

  • sst_rt_project_regions() - all regions for a project
  • sst_rt_serp_history() - search results history in search region by keyword
  • sst_rt_positions_history() - ranking history for the domain or URL in selected search region
  • sst_rt_competitors() - data on competitors in search results
sst_rt_positions_history(
  project_id    = project_id,
  region_id     = region_id,
  date_from     = '2020-12-01',
  date_to       = '2020-12-30',
  keywords      = c('seo', 'ppc', 'serpstat'),
  url           = 'serpstat.com',
  sort          = 'keyword',
  order         = 'desc',
  page          = 1,
  size          = 100,
  return_method = 'list'
  )$data$keywords
  1. Audit

Call functions to audit your website for technical issues:

  • sst_au_start() - start website audit
  • sst_au_get_summary() - get website audit summary
sst_au_start(
  project_id    = project_id
  )$data$reportId
  
  1. Project management

Call functions to manage your projects:

  • sst_pm_create_project() - create a new project
  • sst_pm_delete_project() - delete an existing project
  • sst_pm_list_projects() - list all projects available for the user
sst_pm_create_project(
  domain    = 'serpstat.com',
  name      = 'Serpstat'
  )$data$project_id

Installation

To get the current development version from GitLab:

devtools::install_gitlab('alexdanilin/serpstatr')

Issues

Send all issues on GitLab page.

Copy Link

Version

Install

install.packages('serpstatr')

Monthly Downloads

195

Version

0.4.0

License

MIT + file LICENSE

Maintainer

Alex Danilin

Last Published

August 20th, 2025

Functions in serpstatr (0.4.0)

sst_return_check

Preprocess the API response
sst_sa_domain_keywords_per_region

Number of keywords for each region for a domain
sst_rt_serp_history

Get search results history in search region by keywords
sst_sa_domain_history

Domain history
sst_rt_positions_history

Get ranking history for the domain or URL in selected search region
sst_sa_domain_keywords

Domain organic keywords
sst_sa_domain_organic_competitors

Domain competitors in organic search
sst_rt_competitors

Get the data on competitors in search results
sst_sa_database_info

List all Serpstat databases
sst_rt_project_regions

Get all regions for the project
sst_sa_keyword_top

Top for a keyword
sst_sa_keywords

Phrase match keywords
sst_sa_stats

Get the number of API rows left
sst_sa_domains_info

Domains summary
sst_sa_domain_top_pages

Domain top pages
sst_sa_keywords_info

Keywords summary
sst_sa_related_keywords

Related keywords for a keyword
sst_pm_create_project

Create a new project
sst_bl_domain_summary

Backlinks summary
sst_pm_list_projects

List existing projects
sst_au_get_summary

Website audit summary
sst_lists_to_df

Convert list of lists to data.frame
sst_pm_delete_project

Delete the existing project
serpstatr

serpstatr: Serpstat API wrapper for R.
sst_au_start

Start a website audit
sst_bl_referring_domains

Referring domains
sst_call_api_method

Make a request to Serpstat API endpoint