Blog / API guides

Similarweb API: Website Traffic Data as JSON

To get Similarweb traffic data as JSON, call GET /v1/similarweb/traffic with a domain: one call returns the site's global, country and category rank, monthly visits, time on site, pages per visit, bounce rate, traffic sources, top countries, three months of visit estimates and top keywords, for 1 credit. Three batch endpoints handle lists of domains; creating a batch costs 1–1,000 credits for each call. All four endpoints are restricted. This guide covers the requests, a real response, a Python tracker and the cost.

What does the Similarweb API on Perceptlayer cover?

The Similarweb API on Perceptlayer has one lookup endpoint and three batch endpoints. GET /v1/similarweb/traffic returns traffic estimates for one domain. POST /v1/similarweb/batches takes a list of domains, and batches-detail and batches-retry take a batch value. Every endpoint in the family is restricted, and each one's cost is in the table below.

Method Path Returns Credits Required Optional
GET /v1/similarweb/traffic Traffic for one domain 1 domain none
POST /v1/similarweb/batches Batches 1–1,000 domains none
GET /v1/similarweb/batches-detail Batches Detail 1 batch after, limit
POST /v1/similarweb/batches-retry Batches Retry 1 batch after, limit

The data is collected from publicly available sources and returned as found at the time of the call. These are Perceptlayer endpoints, not Similarweb's own product or API; if you're comparing the two, check the fields, coverage and terms of each yourself. The Similarweb API page lists all four endpoints with a playground.

What do the restricted-endpoint terms mean here?

All four Similarweb endpoints are restricted, as restricted endpoints cover social, personal and SEO data. They work once you accept the restricted-endpoint terms in your dashboard. Until then, a call returns restricted_endpoint (403) and costs nothing. The terms don't permit collecting personal data without a lawful basis or using the data to contact people.

In practice, keep the work aggregate: brands, competitors' company sites, markets and categories. Traffic estimates describe a domain as a whole, so a sensible job compares sites, not people. Don't use the endpoints to profile individuals' personal sites.

How do you get traffic data for one domain?

Send a GET request to https://api.perceptlayer.com/v1/similarweb/traffic with the site in domain (a string of up to 253 characters) and your key in the X-API-Key header. It's the only parameter. This is the request behind the recorded response:

curl "https://api.perceptlayer.com/v1/similarweb/traffic?domain=google.com" \
  -H "X-API-Key: $API_KEY"

Keys start with sk_live_. Where you can't set a header, the key can go in the api_key query parameter; the authentication docs cover both. Every successful response carries X-Credits-Used and X-Credits-Remaining headers, so you can log the cost of each call.

What does a Similarweb traffic response contain?

The response is one JSON object for the domain: identity fields, three rank objects, an engagement object for the latest month, traffic_sources, top_countries, estimated_monthly_visits and top_keywords. This is the recorded google.com response, trimmed:

{
  "domain": "google.com",
  "site_name": "google.com",
  …
  "category": "computers_electronics_and_technology/search_engines",
  "global_rank": { "Rank": 1 },
  "country_rank": { "Country": 840, "CountryCode": "US", "Rank": 1 },
  "category_rank": {
    "Rank": "1",
    "Category": "Computers_Electronics_and_Technology/Search_Engines"
  },
  "engagement": {
    "visits": "88440771425",
    "time_on_site": "599.5039752915357",
    "page_per_visit": "8.739893922466383",
    "bounce_rate": "0.28396961462676623",
    "month": "10",
    "year": "2026"
  },
  "traffic_sources": {
    "direct": 0.9222188318958956,
    "referrals": 0.018732648177177957,
    "mail": 0.00930165294288359
  },
  "top_countries": [
    { "country_code": "US", "country_id": 840, "share": 0.24237602098657293 },
    { "country_code": "JP", "country_id": 392, "share": 0.059564068685009366 }
  ],
  "estimated_monthly_visits": {
    "2026-08-01": 86589884275,
    "2026-09-01": 85153236883,
    "2026-10-01": 88440771425
  },
  "top_keywords": [
    { "keyword": "gemini", "share": 179329980, "volume": 133061740, "cpc": 0.3 },
    …
  ],
  …
}
Field What a tracking job does with it
global_rank.Rank, country_rank.Rank, category_rank.Rank Rank of the site overall, in its top country and in its category
engagement.visits, month, year Visits for the month the figure covers
engagement.time_on_site, page_per_visit, bounce_rate Engagement for that month
traffic_sources Share of visits by source, as fractions
top_countries[].share Share of visits by country
estimated_monthly_visits Visits per month, keyed by the first day of the month
top_keywords[] keyword, share, volume and cpc

Watch the types. engagement values are strings, category_rank.Rank is a string while global_rank.Rank is a number, and estimated_monthly_visits values are numbers. Convert as you parse. The October figure in estimated_monthly_visits (88440771425) matches engagement.visits, so the two agree on the latest month.

Text fields need care too. The recorded title for google.com was "Publishing Partner Program", which doesn't describe the site, so store title and description as returned and don't build labels from them. Use domain as your key.

How do the batch endpoints work?

The batch endpoints are for lists of domains. POST /v1/similarweb/batches takes a required domains parameter, a list of strings documented with a limit of 253 characters, and costs 1–1,000 credits for each successful call. GET /v1/similarweb/batches-detail and POST /v1/similarweb/batches-retry each take a required batch string and optional after and limit integers, and cost 1 credit each.

Endpoint Parameter Type Required
batches domains list of string yes
batches-detail batch string yes
batches-detail after, limit integer no
batches-retry batch string yes
batches-retry after, limit integer no

We have no recorded response from any of the three, so we can't show their fields or confirm how a value from batches flows into batch; the parameter name is the only link the catalogue shows. Run them in the playground on the batches endpoint page and the batches detail page before you build on them. For a few hundred domains, a loop over traffic at 1 credit each has a fixed, known cost.

How do you track competitor traffic in Python?

A monthly tracker calls traffic once per domain and appends one row per domain: the month, the domain, the ranks, visits, engagement and the top source. Running it each month builds a history you can chart. The script uses Python, requests and csv, and reads only fields in the recorded response.

import csv
import os
import time

import requests

API_KEY = os.environ["API_KEY"]
URL = "https://api.perceptlayer.com/v1/similarweb/traffic"
DOMAINS = ["google.com", "bing.com", "duckduckgo.com"]


def traffic(domain, attempts=3):
    for _ in range(attempts):
        r = requests.get(URL, params={"domain": domain},
                         headers={"X-API-Key": API_KEY}, timeout=60)
        if r.status_code in (429, 503):
            time.sleep(int(r.headers.get("Retry-After", "5")))
            continue
        r.raise_for_status()
        return r.json()
    raise RuntimeError(f"gave up on {domain}")


with open("similarweb-traffic.csv", "a", newline="") as f:
    out = csv.writer(f)
    for domain in DOMAINS:
        d = traffic(domain)
        e = d.get("engagement") or {}
        sources = d.get("traffic_sources") or {}
        top_source = max(sources, key=sources.get) if sources else ""
        out.writerow([
            e.get("year"), e.get("month"), d.get("domain"),
            (d.get("global_rank") or {}).get("Rank"),
            (d.get("category_rank") or {}).get("Rank"),
            e.get("visits"), e.get("bounce_rate"), e.get("page_per_visit"),
            top_source,
        ])
        time.sleep(1)

The row uses year and month from engagement, not the run date, so a second run in the same month writes a duplicate you can drop. The one-second pause keeps a free account within its 1 request a second.

What should the job do with errors?

Every error returns an HTTP status and a JSON body with code, message and request_id, and costs nothing. restricted_endpoint (403) means the terms aren't accepted yet. Retry rate_limited (429) and temporarily_unavailable (503) after the Retry-After seconds. Requests have no idempotency key, so a timed-out request may still have been billed, which matters most for batches. The errors docs list every code.

What does Similarweb data cost?

traffic, batches-detail and batches-retry cost 1 credit per successful call. batches costs 1–1,000 credits for each successful call, and the cost depends on the call. Without a recorded batch, budget each batch call at 1,000 credits, the top of the range. Failed calls cost nothing and return X-Credits-Used: 0.

Plan Arithmetic Credits
50 domains, monthly, via traffic 50 × 1 credit 50 a month
500 domains, monthly, via traffic 500 × 1 credit 500 a month
500 domains, monthly, for a year 500 × 12 × 1 credit 6,000 a year
10 batch calls, top of range 10 × 1,000 credits up to 10,000

The first three fit the Starter pack's 10,000 credits with room left. Ten batch calls at the top of the range use the whole Starter pack, so check X-Credits-Used on your first batch before you scale. The 100 free credits on signup cover 100 traffic calls. Purchased credits last 12 months. See pricing for what credits cost and the credits docs for how calls are debited.

To start, accept the restricted-endpoint terms, run domain=google.com in the playground on the traffic endpoint page, then get a free API key. Other SEO and site data sources are on the web and SEO APIs page, and company data guides include the ZoomInfo API guide.

APIs in this post

Frequently asked questions

Is this Similarweb's official API?

No. These are Perceptlayer endpoints that return Similarweb traffic estimates collected from publicly available sources, returned as found at the time of the call. They look up one domain or work with batches of domains. If you're choosing between them and Similarweb's own products, compare fields, coverage and terms yourself, and read Similarweb's terms before using the data commercially.

Are all the Similarweb endpoints restricted?

Yes. All four, traffic, batches, batches-detail and batches-retry, are restricted endpoints. They work after you accept the restricted-endpoint terms in your dashboard; before that, calls return restricted_endpoint (403) and cost nothing. The terms don't permit collecting personal data without a lawful basis or using it to contact people, so keep use cases to brands, sites and markets.

How much does a Similarweb batch cost?

POST /v1/similarweb/batches costs 1–1,000 credits for each successful call; the cost depends on the call. Budget each batch at 1,000 credits until you've seen what your own batches cost in the X-Credits-Used header. batches-detail and batches-retry cost 1 credit per call. For short lists, traffic at 1 credit per domain has a fixed cost.

Which month does the traffic data cover?

The engagement object carries month and year fields; in the recording they were 10 and 2026. estimated_monthly_visits held three months keyed by date, from 2026-08-01 to 2026-10-01. Store the month the response reports rather than the date you called, so repeated calls within a month don't look like new data.

Why are some Similarweb numbers strings?

That's how the recorded response returns them: engagement.visits, time_on_site, page_per_visit and bounce_rate are strings, and so is category_rank.Rank, while global_rank.Rank and the estimated_monthly_visits values are numbers. Convert each field with float() or int() as you parse, and treat a missing field as unknown.

  1. Semrush API: SEO Data as JSON

    Ten Semrush endpoints at 1 credit each: domain overview, competitors, traffic, trending domains and keyword suggestions. Parameters and recorded responses.

  2. Depop API: Resale Listings as JSON

    Search Depop listings as JSON with brand, condition, sizes and price.amount per item; the recorded jacket search had a total_count of 6,815,522. 1 credit.

  3. StockTwits API: Symbol Streams as JSON

    Three StockTwits endpoints as JSON: a symbol's message stream with sentiment and cursor, symbol search and trending symbols, each 1 credit a call.

Start with 100 free credits

No password to set. We email you a sign-in link, and your key works on every API.

No credit card. 100 free credits on signup.