SEMrush API integration for website SEO analytics

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Semrush API for SEO Analytics

Semrush API opens data impractical to collect manually: competitors' organic traffic and keywords, positions for thousands of queries, backlink profile, technical audits. API lets include this in own analytics system, compare domains in single dashboard, automate competitive analysis.

Authentication and Basic Client

Semrush API uses API key as query parameter. Response format CSV (default) or JSON for some endpoints:

import requests
import csv
import io

class SemrushClient:
    BASE_URL = 'https://api.semrush.com'

    def __init__(self, api_key: str):
        self.api_key = api_key
        self.session = requests.Session()

    def _request(self, params: dict) -> list[dict]:
        params['key'] = self.api_key
        resp = self.session.get(self.BASE_URL, params=params, timeout=30)
        resp.raise_for_status()

        if resp.text.startswith('ERROR'):
            raise ValueError(f'Semrush API error: {resp.text}')

        reader = csv.DictReader(io.StringIO(resp.text), delimiter=';')
        return list(reader)

Organic Keywords for Domain

Get top organic keywords with positions, search volume, estimated traffic.

Compare with Competitors

Get competitor domains by similarity of organic keyword intersection.

Competitor Organic Keywords

Get keywords your competitors rank for that you don't.

Backlink Audit via API

Get backlinks with anchor text, source domain score, first/last seen dates.

Position Tracking

Semrush Position Tracking available via separate API for projects.

Daily Metrics Collection

Collect daily metrics for domains and store in PostgreSQL:

def collect_daily_metrics(client: SemrushClient, domains: list[str], db_conn):
    for domain in domains:
        try:
            ranks = client.compare_domains([domain])[0]
            keywords = client.get_organic_keywords(domain, limit=500)
            # Store in PostgreSQL
        except Exception as e:
            print(f'Error collecting for {domain}: {e}')

API Cost Calculation

Semrush API tariffed in "API units". Cost per request depends on type and volume. Guru plan has 3000 units/month. Business has 10,000.

Timeline

Basic integration with daily domain metrics and top-200 keywords — 2–3 working days. With competitor analysis, backlink audit, alerts and visualization in Grafana/Metabase — 5–7 days.