Wednesday, September 30, 2026
HomeSEOWhat within the World Is API, and How Do I Use It?

What within the World Is API, and How Do I Use It?

[ad_1]

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 might be automated, so it is a wonderful resolution for gathering huge units of knowledge effectively.

You will get knowledge sooner than by utilizing the interface and use it to combine Semrush knowledge into your dashboards and different software program.

Widespread makes use of of APIs embrace:

  • Customized dashboards for a digital company’s purchasers

  • Inner firm dashboards for eCommerce, funding companies, and so forth.

  • Re-selling Semrush knowledge by way of a software program service

  • Gathering enormous units of knowledge at a sooner price in comparison with utilizing the Semrush interface (glorious for in depth key phrase analysis or giant Place Monitoring campaigns)

  • Pulling Site visitors Analytics knowledge on your whole opponents in a single report

What’s the catch? Properly, 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 needs to be comparatively straightforward to select 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 an inventory of all of our calls, parameters, and technical particulars, please find (and bookmark!) the Semrush API Documentation.

Who’re 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. 

Particularly, Semrush’s API is standard 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 primarily based on a easy name and response. The weather of an API name (defined additional beneath on this put up) create an HTTP handle and embrace parameters (separated by the “&” image) for the precise 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 internet improvement to create a script or the same program that may automate the reception and integration of knowledge.

In pc science, a script is a doc written in a dynamic programming language (frequent languages embrace Python, Perl, Powershell, Tcl) that ship directions to pc applications 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, stories, and interfaces.

Beneath I’ll discuss 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.

In case you are taken with buying a script that works with an API from us, you possibly can contact us by cellphone or electronic mail or from the Customized Report web page right here.

What APIs does Semrush supply?

Semrush presents two important API packages:

  1. Normal Semrush API, which incorporates:
    1. Analytics API (Area Analytics and Key phrase Analysis)
    2. Initiatives API (Website Audit, Place Monitoring, and Undertaking Administration) 
  2. Site visitors Analytics API (a separate API for Site visitors Analytics knowledge, launched in 2019)

How will you get it?

To make use of our Analytics API and Initiatives API, you want to:

  • Subscribe to the Enterprise Semrush plan

  • Buy the API bundle and the variety of API items that may suit your wants 

To make use of Semrush Site visitors Analytics API, you first have to have a Semrush subscription plan (it doesn’t must be a Marketing strategy). The Site visitors Analytics API is available in two types: Fundamental and Prolonged. 

  • The Site visitors Analytics Fundamental API enables you to collect knowledge from the Site visitors Analytics Overview report. 
  • Site visitors Analytics Prolonged API gathers knowledge from the extra in-depth stories on this software: Site visitors Sources, Geographic Distribution, Vacation spot Websites, and Subdomains.

For extra particulars, please be happy to consult with Site visitors Analytics API documentation.

You possibly can add a Site visitors Analytics API to your plan immediately out of your Subscription Information web page or you possibly can attain out to our gross sales crew. We’ll provide help to resolve what number of API items you want and offer you your API key. 

Your API key might be discovered within the API items tab of the Subscription Information web page. 

VBebwpgFvL05SZhVH34ITBgvRuf3jLenPFdxeFZ39XW0C64hYmb4UX53kK6TV-CDiKPWOXfw4980-5ChfHWLyboN4UNaEqvVFpQBoILyTX1wJRv5FVPVVj0DhAiT8tRVeQfeBArC

Setting up an API Name

To obtain knowledge by way of Analytics API, you want to construct an API name (also referred to 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 information that you simply wish to obtain. Parameters embrace the kind of report, your API key, the area you’re querying, the database, show date, export columns, filters, and extra. 

Beneath is a color-coded breakdown of a Area Overview API name for seobook.com (US database) with 8 columns. 

sample-api-call-semrush

The parameters on this name are as follows:

semrush-api-parameters

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 information will signify a month-to-month determine. Subsequently, 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 mission, you possibly can specify a single date to tug the information for. 

The parameters and variety of traces included in every name will decide the price of the decision in API items. A name that asks for six columns of knowledge for 100 domains will value ten instances the quantity of items in comparison with a name asking for a similar six columns of knowledge for ten domains. 

Examples of all parameters, columns, filters, sorting, and databases can all be discovered within the API Documentation.

Column names, for instance, might be discovered within the “Columns” part of the API Documentation.

SFn3ps88MZM9rcxP7wbDWu0gUfEC83WrdvacrDmTHFqmGDXUpveAbdduXBLPvnCkhTX-7G9efmOCOe4u7voN7CMIrjzZg5zYKeKF-zoAZLUtaidnc39w27JmBbaJqdZB2X-vspcC

Along with the fundamental parameters, there are additionally parameters for including filters, sorting by metrics, and setting a show restrict to the variety of traces the decision will return. All of those parameters might 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 information. In case you sort the decision right into a browser’s handle bar, for instance, it should return the uncooked knowledge within the browser and appear to be this: 

sample-api-response

This response is 1 line as a result of it’s only reporting knowledge for 1 area. 

This output is technically a .CSV file. The outputs of our APIs are:

Half 1: Analytics API

Now, what might be achieved with the Analytics API? This API can be utilized to tug stories on area analytics, aggressive analysis, key phrase analysis, backlinks, promoting analysis, and extra.

These are the basic stories on Semrush used to check 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’ll wish to look into the Site visitors Analytics API. Site visitors Analytics presents 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 might make queries in bulk and get super-fast outcomes. For instance, when you had an inventory of ten domains like this:

img-semblog

You may use a script to investigate all the pieces listed within the spreadsheet. Pictured beneath is a bit of a script written to tug knowledge by way of the Semrush API and import the traces to a clear spreadsheet on the pc’s desktop.

img-semblog

Discover on the finish of the GIF the time it took to make this name was roughly 1.3 seconds. Now, the file might be discovered on the desktop. 

img-semblog

These are the fundamentals of API. After all, our instance solely confirmed the method with 10 domains, and it took one second. You should utilize the same course of to tug knowledge on a whole bunch of 1000’s of domains in solely minutes. 

To familiarize yourselves with our API language and find out how to format a name, builders have to learn our API documentation. 

Half 2: Initiatives API 

The Initiatives API permits customers to create, edit, and handle tasks utilizing the Website Audit and Place Monitoring instruments. 

You possibly can pull stories from current tasks or create a brand new mission and configure it with an API name. As a result of the interface makes it straightforward to configure a Undertaking with particular settings, folks will generally create their Initiatives within the interface after which use API to tug the information. 

Please be aware: Initiatives API shares API items with Analytics API. Site visitors Analytics API, nevertheless, 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 Website Audit software will crawl a web site and offer you an in depth record of points on the location you could repair to enhance its website positioning. 

These two instruments are particularly nice for shopper reporting. They will present overview metrics like the final well being rating of a web site (Website Audit) and visibility throughout goal key phrases (Place Monitoring). Because of this, the Initiatives API is a superb resolution for automating client-facing or inside dashboards. 

One other nice motive to make use of Initiatives API is for the velocity. In comparison with the interface, the API will be capable to export knowledge from giant Initiatives at a extra environment friendly price. 

Beneath is an instance of how it might look utilizing a script to tug knowledge from an current Undertaking right into a easy spreadsheet. 

Utilizing a Script for Initiatives API

First, let’s say we have now a Place Monitoring marketing campaign on Semrush. The area is ebay.com, and it’s monitoring 81 key phrases and 20 opponents. The Undertaking ID (discovered within the URL) is 1565219.

jbDYGa5LJNYa64rGeT6rbH27BN1zLibyzqbaohcO7Vaq7C12S0saNN8x-DpJLYY2S6tntdWWh0jDpgyV8HaJqOdE3ZonA_YlxNIuABPARxwrq9oV-hJgHJP3kHVVHzAw_BdVafhh

Here’s a script that’s formatted to GET the information from the prevailing Place Monitoring Undertaking.

img-semblog

Observe how the script solely took six seconds (Time — 0:00:06.3727)to export 1000’s of rows of data. Beneath is the spreadsheet that the script created — all the key phrases within the marketing campaign together with the competitor’s rating pages.

img-semblog

SERP Options Codes

In case you are 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: Critiques

  • stl: Website hyperlinks

  • vid: Video

  • vib: Featured video

  • new: Prime tales

  • rel: Folks additionally ask

  • img: Pictures

  • twt: Twitter

  • knw: Prompt reply

  • kng: Data panel

  • shp: Procuring adverts

  • adt: AdWords high

  • adb: AdWords backside

Technical Particulars – Initiatives API

In contrast to the Analytics API, all Undertaking 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 mission, allow Place Monitoring/Website Audit software. 

PUT: Ship a PUT name if you wish to make some modifications to your current tasks, 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 stories of present tasks, e.g., each 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 mission, delete key phrases from an current mission.

Half 3: Site visitors Analytics API 

The opposite API that’s separate from any Semrush subscription is Site visitors Analytics. Site visitors Analytics lets you collect site visitors estimations for a web site. With the velocity of API, you possibly can analysis this knowledge extra effectively. 

Site visitors Analytics API doesn’t come as part of the principle Semrush API. It needs to be bought individually from any Semrush subscription, or along with any subscription. 

Please be aware that we provide two variations of this API:

  1. Fundamental API: Site visitors Overview report

  2. Prolonged 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. 

Site visitors Analytics Use Instances

Some examples of how you might use this API embrace:

  • Qualifying new leads

  • Evaluating new markets 

  • Enhancing an current SaaS providing with site visitors knowledge

  • Offering knowledge on prospects to your gross sales crew

  • Evaluating new enterprise companions and prospects 

To qualify new leads, you might take your record of domains and pull all of their Site visitors Overview knowledge to see which leads have the best web site engagement and which web sites present weak engagement from their guests. The leads with the worst engagement could possibly be the most effective locations to begin if you’re pitching web site companies. 

To consider a brand new market, you might collect an inventory 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 common qualities of the market, corresponding to web site visits, cellular vs. desktop site visitors, time on web page, pages per session, and extra. 

In case you already supply a SaaS platform for folks to check web sites or companies, including Semrush Site visitors Analytics knowledge to your providing would give highly effective insights into this enterprise’s on-line presence — excellent knowledge for aggressive evaluation. 

The Site visitors Analytics API may additionally combine with a gross sales prospecting software program to offer your gross sales crew additional data about every alternative. Which suggests they will at all times convey knowledge to their gross sales pitch. 

If you want to 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 Site visitors Analytics 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: 

img-semblog

Use a script to tug the information: 

img-semblog

And the ensuing data on these domains populates into this spreadsheet: 

img-semblog

Calculating API Models Utilization

As you propose your Analytics and Initiatives API calls, you will want to estimate what number of API items you may be spending. 

Bear in mind: Site visitors Analytics API doesn’t use API items, and due to this fact you received’t have to calculate items, and Accounts API calls are free. Calculating API Models is just related for Analytics and Initiatives API calls. 

Every Analytics and Initiatives name has its personal value, and for historic knowledge, the value will go up. The API documentation will let you know the value in items per line of every name. 

BRj_bnMFdWCrTnlAvl9tnSAyCiuIuXhhjZGnN7kTv8fw4BeDpr_24xE40KkJ7DWKUr2gnM_vTVHZnVsDsLio9Qdw-vfxvnFg5NCW1L8YtqbW8n6pXN2bETNXEojp8TmTjhZENqjm

To estimate your price range, you will want to estimate just a few issues:

  • If the API is getting used internally or externally

  • What sort of knowledge is getting used (which stories you’ll use & if you’d like reside or historic knowledge)

  • How a lot knowledge you will want (what number of calls you may be making each month)

To calculate the price of a name, you would want to multiply the fee per line by the variety of traces within the name. 

What’s a line?

Properly, when you consider the response as a .csv file, every row of knowledge within the response is a line. Every line may signify metrics for a specific key phrase, area, or URL relying in your report. Observe within the picture beneath how the decision has a display_limit parameter of 25 and due to this fact returns 25 traces. 

img-semblog

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

tm0y9BROpsx2ovH6p0G3xX86QRo5vVB1-1NkbyYHtxd54f-IfnJLwn1CtMdCAK27Z9fGX22vO-u8Xb91s3VVgvyRelrmHxrRDF7O2BiY8Tgadf3Q58gpTmIaJPlq8daxA4GkuWT8

After all, calculating API items utilization can be extra sophisticated than that as you employ API extra extensively, however the primary logic stays the identical. You’ll be charged API items for each line of knowledge that you simply request. 

To view your API items stability, go to your Semrush Profile – Subscription data – API items.

Integrating with Google Sheets

Utilizing API with Google Sheets is among the easiest methods to combine API with one other platform. 

Very similar to Microsoft Excel, Google Spreadsheets helps a wide selection of capabilities.

Through the use of capabilities 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 much 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 simply entered the system.

img-semblog

We have now an article in our Data Base that reveals you find out how to use Site visitors Analytics API in Google Sheets.

Recap

If you wish to collect extra knowledge at a sooner tempo than the interface, Semrush API is your excellent resolution.

Including the usual API to your subscription is out there after subscribing to the Enterprise stage 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 should buy Semrush Site visitors Analytics API – with or with no Semrush subscription. This API is superb for evaluating markets and potential enterprise companions and investments.

Phrases of Use

Earlier than utilizing our API, you want to learn and conform to our phrases of use. In case you want to resell our knowledge by way of API, a separate settlement should be made. Full phrases of use might be discovered right here.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments