What within the World Is API, and How Do I Use It?
What Is an API?
Utility Programming Interface (API) is a technique of gathering uncooked knowledge from Semrush with out utilizing the usual web site interface.
If the Semrush interface is like strolling by way of a grocery retailer to select your groceries by hand; an API is like ordering your groceries in bulk from a same-day drone supply.
Pulling knowledge by way of an API may be automated, so it is a superb resolution for gathering huge units of information effectively.
You may get knowledge sooner than through the use of the interface and use it to combine Semrush knowledge into your dashboards and different software program.
Widespread makes use of of APIs embody:
-
Customized dashboards for a digital company’s shoppers
-
Inside firm dashboards for eCommerce, funding companies, and many others.
-
Re-selling Semrush knowledge by way of a software program service
-
Gathering large units of information at a sooner price in comparison with utilizing the Semrush interface (glorious for intensive key phrase analysis or giant Place Monitoring campaigns)
-
Pulling site visitors knowledge on your whole opponents in a single report
What’s the catch? Effectively, if you’re unfamiliar with APIs, it may be a bit technical.
However, when you or a teammate or coworker of yours has expertise with an API, the Semrush API ought to be comparatively simple to choose up.
This put up is for introducing the fundamentals of APIs and the way they are often helpful. We’ll get into the specifics of Semrush APIs as nicely. For a listing of all of our calls, parameters, and technical particulars, please find (and bookmark!) the Semrush API Documentation.
Who Are APIs for?
An API can be utilized for an infinite variety of functions. Anybody that may program scripts with API and has the necessity to collect digital advertising and marketing knowledge could make use of it.
Specifically, Semrush’s API is common amongst digital businesses, knowledge scientists, analysis companies, SaaS software program builders, enterprise capitalists, and re-sellers of Semrush knowledge.
How Does an API Work?
An API operates based mostly on a easy name and response. The weather of an API name (defined additional under on this put up) create an HTTP deal with and embody parameters (separated by the “&” image) for the particular report you’re requesting, the database, question, any filters, and naturally, your API key.
Turning the Uncooked Knowledge into One thing Tangible
To make use of an API successfully would require somebody conversant in net growth to create a script or an analogous program that may automate the reception and integration of information.
In pc science, a script is a doc written in a dynamic programming language (widespread languages embody Python, Perl, Powershell, Tcl) that ship directions to pc packages to automate duties.
With a script, you possibly can work with our API calls to show the .CSV or JSON output into one thing readable like a spreadsheet or dashboard.
Net builders can write scripts to take uncooked knowledge from the Semrush API and combine it into readable tables, dashboards, reviews, and interfaces.
Under I’ll speak in regards to the completely different APIs provided on Semrush and present an instance of how a script can pull this knowledge and combine it right into a spreadsheet.
If you’re focused on buying a script that works with an API from us, you possibly can contact us by cellphone or e mail or from the Customized Report web page right here.
What APIs Does Semrush Supply?
Semrush gives two principal API packages:
- Commonplace Semrush API, which incorporates:
- Analytics API (Area Analytics and Key phrase Analysis)
- Initiatives API (Web site Audit, Place Monitoring, and Challenge Administration)
- Tendencies API (a separate API for Site visitors Analytics knowledge, launched in 2019)
How Can You Get It?
To make use of our Analytics API and Initiatives API, that you must:
-
Subscribe to the Enterprise Semrush plan
-
Buy the API package deal and the variety of API items that may suit your wants
To useSemrush Tendencies API, you first must have a Semrush subscription plan (it doesn’t should be a Marketing strategy). The Tendencies API is available in two types: Fundamental and Prolonged.
- The Tendencies Fundamental API permits you to collect knowledge from the Site visitors & Market Site visitors Overview report.
- Site visitors Knowledge
- Month-to-month Visits
- Distinctive Visits
- Pages Per Go to
- Common Go to Period
- Cellular vs. Desktop
- Bounce Charges
- Tendencies Premium API gathers knowledge from the extra in-depth dashboards from the Site visitors & Market Toolkit. In contains all the things from the Tendencies Fundamental API, in addition to:
- Each day Site visitors
- Weekly Site visitors
- Buy Conversion
- Business Classes
- Site visitors Sources
- Site visitors Locations
- Subdomain Site visitors
- Subfolder Site visitors
- Geographic Distribution
- High Pages
- Site visitors Rank
- Viewers Insights
- Age and Intercourse Distribution
- Family Measurement, Earnings, Schooling, and Occupation distributions
- Viewers Pursuits
- Social Media Preferences
For extra particulars, please be happy to seek advice from Tendencies API documentation
You’ll be able to add a Tendencies API to your plan immediately out of your Subscription Data web page or you possibly can attain out to our gross sales staff. We’ll assist you determine what number of API items you want and give you your API key.
Your API key may be discovered within the API items tab of the Subscription Data web page.

Establishing an API Name
To obtain knowledge by way of Analytics API, that you must construct an API name (often known as a request).
An API name is a request despatched to the server for knowledge from the Semrush database.
The API name is constructed by combining parameters to outline the info that you just wish to obtain. Parameters embody the kind of report, your API key, the area you’re querying, the database, show date, export columns, filters, and extra.
Under is a color-coded breakdown of a Area Overview API name for seobook.com (US database) with 8 columns.

The parameters on this name are as follows:

Discover the show date is about to January 2018, making this a name for historic knowledge (20180115 represents January 2018 in YYYYMM15 format). Since this name is in our Analytics database, the info will symbolize a month-to-month determine. Due to this fact, 15 is only a placeholder to make use of for the day in the usual YYYYMMDD format.
Utilizing Initiatives API, if you’re pulling knowledge from a Place Monitoring venture, you possibly can specify a single date to tug the info for.
The parameters and variety of strains included in every name will decide the price of the decision in API items. A name that asks for six columns of information for 100 domains will value ten instances the quantity of items in comparison with a name asking for a similar six columns of information for ten domains.
Examples of all parameters, columns, filters, sorting, and databases can all be discovered within the API Documentation.
Column names, for instance, may be discovered within the “Columns” part of the API Documentation.

Along with the essential parameters, there are additionally parameters for including filters, sorting by metrics, and setting a show restrict to the variety of strains the decision will return. All of those parameters may be discovered within the menu on the API documentation.
API Output
After constructing your API name (or request) and sending it to our server, Semrush will return uncooked knowledge with the column headers and the info. For those who sort the decision right into a browser’s deal with bar, for instance, it should return the uncooked knowledge within the browser and seem like this:

This response is 1 line as a result of it is just reporting knowledge for 1 area.
This output is technically a .CSV file. The outputs of our APIs are:
-
Analytics API: .CSV
-
Tendencies API: .CSV
-
Initiatives API: JSON
-
Accounts API: .CSV
Half 1: Analytics API
Now, what may be completed with the Analytics API? This API can be utilized to tug reviews on area analytics, aggressive analysis, key phrase analysis, backlinks, promoting analysis, and extra.
These are the traditional reviews on Semrush used to review the search positions and on-line visibility of your opponents or trade. If aggressive analysis is part of your workflow, utilizing API will speed up the method.
For gathering complete web site site visitors estimations (not simply site visitors from search), you’d wish to look into theTrends API. The Site visitors & Market Site visitors toolkit gives a breakdown of site visitors from search, social, direct, paid, and referral, along with complete month-to-month visits, time on web page, bounce price, pages/session, and extra.
Utilizing a Script with Analytics API
Now, when you had a script that might course of API calls right into a formatted desk, you possibly can make queries in bulk and get super-fast outcomes. For instance, when you had a listing of ten domains like this:

You would use a script to research all the things listed within the spreadsheet. Pictured under is a piece of a script written to tug knowledge by way of the Semrush API and import the strains to a clear spreadsheet on the pc’s desktop.
Discover on the finish of the GIF the time it took to make this name was roughly 1.3 seconds. Now, the file may be discovered on the desktop.
These are the fundamentals of API. In fact, our instance solely confirmed the method with 10 domains, and it took one second. You need to use an analogous course of to tug knowledge on a whole bunch of hundreds of domains in solely minutes.
To familiarize yourselves with our API language and learn how to format a name, builders must learn our API documentation.
Half 2: Initiatives API
The Initiatives API permits customers to create, edit, and handle initiatives utilizing the Web site Audit and Place Monitoring instruments.
You’ll be able to pull reviews from current initiatives or create a brand new venture and configure it with an API name. As a result of the interface makes it simple to configure a Challenge with particular settings, individuals will generally create their Initiatives within the interface after which use API to tug the info.
Please be aware: Initiatives API shares API items with Analytics API. Nevertheless, Tendencies API is separate from Analytics and Initiatives and doesn’t use API items.
Place Monitoring can observe you and your opponents’ key phrase rankings and uncover native opponents. Our Web site Audit device will crawl a web site and give you an in depth record of points on the positioning you could repair to enhance its search engine marketing.
These two instruments are particularly nice for consumer reporting. They will present overview metrics like the overall well being rating of a web site (Web site Audit) and visibility throughout goal key phrases (Place Monitoring). Because of this, the Initiatives API is a good resolution for automating client-facing or inside dashboards.
One other nice purpose to make use of Initiatives API is for the pace. In comparison with the interface, the API will be capable to export knowledge from giant Initiatives at a extra environment friendly price.
Under is an instance of how it will look utilizing a script to tug knowledge from an current Challenge right into a easy spreadsheet.
Utilizing a Script for Initiatives API
First, let’s say we now have a Place Monitoring marketing campaign on Semrush. The area is ebay.com, and it’s monitoring 81 key phrases and 20 opponents. The Challenge ID (discovered within the URL) is 1565219.

Here’s a script that’s formatted to GET the info from the prevailing Place Monitoring Challenge.
Notice how the script solely took six seconds (Time—0:00:06.3727)to export hundreds of rows of knowledge. Under is the spreadsheet that the script created—the entire key phrases within the marketing campaign together with the competitor’s rating pages.
SERP Options Codes
If you’re pulling knowledge from a Place Monitoring marketing campaign, you will notice a column for the SERP Options that the tracked area ranks for. The SERP Options codes as they seem in API are as follows:
-
fsn: Featured snippet
-
geo: Native pack
-
rev: Evaluations
-
stl: Web site hyperlinks
-
vid: Video
-
vib: Featured video
-
new: High tales
-
rel: Folks additionally ask
-
img: Photos
-
twt: Twitter
-
knw: On the spot reply
-
kng: Data panel
-
shp: Procuring adverts
-
adt: AdWords high
-
adb: AdWords backside
Technical Particulars—Initiatives API
Not like the Analytics API, all Challenge API requests function by way of the next HTTP instructions:
POST: Ship a POST name to create one thing new, e.g., create a brand new venture, allow Place Monitoring/Web site Audit device.
PUT: Ship a PUT name if you wish to make some modifications to your current initiatives, e.g., change the key phrases or opponents in Place Monitoring, change the crawled web page restrict.
GET: Ship a GET name to tug some reviews of present initiatives, e.g., every day natural place report, problems with a website audit marketing campaign.
DELETE: Ship a DELETE name to delete something current, e.g., delete an current venture, delete key phrases from an current venture.
Half 3: Tendencies API
The opposite API that’s separate from any Semrush subscription is the Tendencies API. It means that you can collect site visitors estimations for a web site. With the pace of API, you possibly can analysis this knowledge extra effectively.
Tendencies API doesn’t come as part of the primary Semrush API. It must be bought individually from any Semrush subscription, or along with any subscription.
Please be aware that we provide two variations of this API:
- Fundamental API: Site visitors Overview dashboard
- Premium API: Site visitors Overview report, Site visitors Sources, Site visitors Locations, Geographic Distribution, and Subdomains
This API can combine seamlessly with software program like Google Sheets, Excel, Salesforce, Tableau, Energy BI, and extra.
Tendencies API Knowledge Use Circumstances
Some examples of how you possibly can use this API embody:
-
Qualifying new leads
-
Evaluating new markets
-
Enhancing an current SaaS providing with site visitors knowledge
-
Offering knowledge on prospects to your gross sales staff
-
Evaluating new enterprise companions and prospects
To qualify new leads, you possibly can take your record of domains and pull all of their Site visitors Overview knowledge to see which leads have the very best web site engagement and which web sites present weak engagement from their guests. The leads with the worst engagement may very well be one of the best locations to start out if you’re pitching web site providers.
To consider a brand new market, you possibly can collect a listing of domains out there you wish to find out about, after which make an API name to tug their site visitors knowledge. An Overview name would can help you see the typical qualities of the market, similar to web site visits, cell vs. desktop site visitors, time on web page, pages per session, and extra.
For those who already provide a SaaS platform for individuals to review web sites or companies, including Semrush Site visitors & Market knowledge to your providing would give highly effective insights into this enterprise’s on-line presence—good knowledge for aggressive evaluation.
The Tendencies API may additionally combine with a gross sales prospecting software program to offer your gross sales staff additional information about every alternative. Which suggests they’ll all the time carry knowledge to their gross sales pitch.
If that you must consider new enterprise companions and prospects, this API may combine together with your current data and supply perception into their strengths and weaknesses on-line.
Utilizing Tendencies API with a Script
Once more, this API can simply combine right into a script. Let’s take the next ten domains from a spreadsheet:

Use a script to tug the info:
And the ensuing information on these domains populates into this spreadsheet:
Calculating API Items Utilization
As you intend your Analytics and Initiatives API calls, you’ll need to estimate what number of API items you’ll be spending.
Take note: Tendencies API doesn’t use API items, and subsequently you received’t must calculate items, and Accounts API calls are free. Calculating API Items is barely related for Analytics and Initiatives API calls.
Every Analytics and Initiatives name has its personal worth, and for historic knowledge, the value will go up. The API documentation will inform you the value in items per line of every name.

To estimate your funds, you’ll need to estimate a number of issues:
-
If the API is getting used internally or externally
-
What sort of knowledge is getting used (which reviews you’ll use & if you’d like dwell or historic knowledge)
-
How a lot knowledge you’ll need (what number of calls you’ll be making each month)
To calculate the price of a name, you would want to multiply the price per line by the variety of strains within the name.
What’s a line?
Effectively, when you consider the response as a .csv file, every row of information within the response is a line. Every line may symbolize metrics for a specific key phrase, area, or URL relying in your report. Notice within the picture under how the decision has a display_limit parameter of 25 and subsequently returns 25 strains.

One other instance could be if you wish to pull the highest 100 key phrases for a site utilizing dwell knowledge; you’d use the “domain_organic” name, which prices 10 API items per line for dwell knowledge, or 50 API items per line for historic knowledge.

In fact, calculating API items utilization shall be extra difficult than that as you utilize API extra extensively, however the primary logic stays the identical. You may be charged API items for each line of information that you just request.
To view your API items steadiness, go to your Semrush Profile—Subscription information—API items.
Integrating with Google Sheets
Utilizing API with Google Sheets is without doubt one of the easiest methods to combine API with one other platform.
Very similar to Microsoft Excel, Google Spreadsheets helps a wide selection of features.
Through the use of features like IMPORTDATA, TRANSPOSE, and SPLIT, you possibly can enter your API calls right into a cell and populate the spreadsheet with formatted knowledge.
For instance, a Area Overview report request instance utilizing IMPORTDATA would look just like the next:
(importdata(” https://api.semrush.com /sort=domain_rank&key=abcdefghijklm0pqrstuv123&export_columns=Dn,Rk,Or,Ot,Oc,Advert,At,Ac&area=seobook.com&database=us”)
The outcomes of the decision will populate into the cell that you just entered the formulation.

We’ve an article in our Data Base that exhibits you learn how to use Tendencies API in Google Sheets.
Recap
If you wish to collect extra knowledge at a sooner tempo than the interface, Semrush API is your good resolution.
Including the usual API to your subscription is offered after subscribing to the Enterprise degree and can grant you entry to our Analytics API, Initiatives API, and Accounts API. These APIs will allow you to pull analysis knowledge in your competitor’s search efficiency, key phrase analysis, and construct superior progress dashboards.
Request API entry right here.
Anybody can buy Semrush Tendencies API—with or and not using a Semrush subscription. This API is wonderful for evaluating markets and potential enterprise companions and investments.
Phrases of Use
Earlier than utilizing our API, that you must learn and conform to our phrases of use. For those who want to resell our knowledge by way of API, a separate settlement should be made. Full phrases of use may be discovered right here.