Your product manager asked for a quick read on where your competitors’ traffic comes from and which countries are driving visits. You don’t have time for a lengthy integration—by the end of this guide, you’ll have the Site Traffic API wired into Postman (and a script) to pull traffic source, country share, and engagement metrics for any domain, plus a country code list you can use to normalize reports.
What the Site Traffic API gives you
The Site Traffic API returns:
- Traffic source and overview for a domain—engagement metrics, top countries by share, and a short site description/title.
- A complete list of supported countries with ISO codes so you can map country shares to names and regions.
Typical uses include competitive benchmarking, weekly growth dashboards, attribution QA, and prefetching country metadata for reporting. You can call it directly over HTTPS or from AI agents via the MCP endpoint.
Getting started on Zyla API Hub
Open the Site Traffic API page on Zyla API Hub and click Subscribe (or Start Free Trial when available). The platform uses a subscription + quota model (not pay-per-call). For this API, you can start with a 7-day trial or 50 requests. There is no Free Plan. Check the API page for current access options and pricing.
Once subscribed, you’ll receive an API key. Use it in the Authorization header as a Bearer token for every request.
Postman: set up and make your first calls
Step 1 — Create a collection and auth
- Create a new Postman Collection named “Zyla — Site Traffic API”.
- In the collection’s Authorization tab, set Type to “Bearer Token”.
- Paste YOUR_API_KEY into the Token field.
Step 2 — Countries List request
Add a new GET request named “Countries List” with this exact URL:
https://zylalabs.com/api/29/site-traffic-api/1372/countries-list
Headers:
- Authorization: Bearer YOUR_API_KEY
cURL (importable into Postman):
curl -s -X GET "https://zylalabs.com/api/29/site-traffic-api/1372/countries-list" \
-H "Authorization: Bearer YOUR_API_KEY"
Step 3 — Traffic Source and Overview request
Add another GET request named “Traffic Source and Overview”. This endpoint requires a single query parameter:
- domain (required): pass the domain without protocol and without “www”. Example: google.com
URL:
https://zylalabs.com/api/29/site-traffic-api/93/traffic-source-and-overview?domain=google.com
Headers:
- Authorization: Bearer YOUR_API_KEY
cURL (importable into Postman):
Endpoints you can use today
1) Countries List
Method: GET
URL: https://zylalabs.com/api/29/site-traffic-api/1372/countries-list
Description: Receive a list of all supported countries and their codes. Use this to map country codes returned in traffic results to readable names and regions.
Request parameters: none documented.
Authorization: Bearer YOUR_API_KEY
Official sample cURL:
Official sample JSON response (truncated here as provided):
[{"name":"Afghanistan","alpha-2":"AF","alpha-3":"AFG","country-code":"004","iso_3166-2":"ISO 3166-2:AF","region":"Asia","sub-region":"Southern Asia","intermediate-region":"","region-code":"142","sub-region-code":"034","intermediate-region-code":""},{"name":"Åland Islands","alpha-2":"AX","alpha-3":"ALA","country-code":"248","iso_3166-2":"ISO 3166-2:AX","region":"Europe","sub-region":"Northern Europe","intermediate-region":"","region-code":"150","sub-region-code":"154","intermediate-region-code":""},{"name":"Albania","alpha-2":"AL","alpha-3":"ALB","country-code":"008","iso_3166-2":"ISO 3166-2:AL","region":"Europe","sub-region":"Southern Europe","intermediate-region":"","region-code":"150","sub-region-code":"039","intermediate-region-code":""},{"name":"Algeria","alpha-2":"DZ","alpha-3":"DZA","country-code":"012","iso_3166-2":"ISO 3166-2:DZ","region":"Africa","sub-region":"Northern Africa","intermediate-region":"","region-code":"002","sub-region-code":"015","intermediate-region-code":""},{"name":"American Samoa","alpha-2":"AS","alpha-3":"ASM","country-code":"016","iso_3166-2":"ISO 3166-2:AS","region":"Oceania","sub-region":"Polynesia","intermediate-region":"","region-code":"009","sub-region-code":"061","intermediate-region-code":""},{"name":"Andorra","alpha-2":"AD","alpha-3":"AND","country-code":"020","iso_3166-2":"ISO 3166-2:AD","region":"Europe","sub-region":"Southern Europe","intermediate-region":"","region-code":"150","sub-region-code":"039","intermediate-region-code":""},{"name":"Angola","alpha-2":"AO","alpha-3":"AGO","country-code":"024","iso_3166-2":"ISO 3166-2:AO","region":"Africa","sub-region":"Sub-Saharan Africa","intermediate-region":"Middle Africa","region-code":"002","sub-region-code":"202","intermediate-region-code":"017"},{"name":"Anguilla","alpha-2":"AI","alpha-3":"AIA","country-code":"660","iso_3166-2":"ISO 3166-2:AI","region":"Americas","sub-region":"Latin America and the Caribbean","intermediate-region":"Caribbean","region-code":"019","sub-region-code":"419","intermediate-region-code":"029"},{"name":"Antarctica","alpha-2":"AQ","alpha-3":"ATA","country-code":"010","iso_3166-2":"ISO 3166-2:AQ","region":"","sub-region":"","intermediate-region":"","region-code":"","sub-region-code":"","intermediate-region-code":""},{"name":"Antigua and Barbuda","alpha-2":"AG","alpha-3":"ATG","country-code":"028","iso_3166-2":"ISO 3166-2:AG","region":"Americas","sub-region":"Latin America and the Caribbean","intermediate-region":"Caribbean","region-code":"019","s…
What you’ll actually use:
- alpha-2 and alpha-3: map country codes (e.g., US, JP) to names.
- name: display country names in dashboards.
- region/sub-region: group traffic by higher-level geography.
2) Traffic Source and Overview
Method: GET
URL: https://zylalabs.com/api/29/site-traffic-api/93/traffic-source-and-overview
Description: Pass a domain (no protocol, no “www”). Receive top-5 country shares, sources, and engagement stats.
Required query parameters:
- domain: for example, google.com
Authorization: Bearer YOUR_API_KEY
Official sample cURL:
Example response (as provided):
{
"Version": 1,
"SiteName": "google.com",
"Description": "Learn about the Certified Publisher Program. Our publishing software experts will help you maximize revenue and grow your business.",
"TopCountryShares": [
{
"Country": 840,
"CountryCode": "US",
"Value": 0.23679350972974017
},
{
"Country": 392,
"CountryCode": "JP",
"Value": 0.059428140900848324
},
{
"Country": 356,
"CountryCode": "IN",
"Value": 0.05710248670449797
},
{
"Country": 76,
"CountryCode": "BR",
"Value": 0.049777326688909565
},
{
"Country": 826,
"CountryCode": "GB",
"Value": 0.03518837304351638
}
],
"Title": "Google Advanced Search",
"Engagments": {
"BounceRate": "0.28352824215831807",
"Month": "6",
"Year": "2026",
"PagePerVisit": "8.695346223748027",
"Visits": "84940150026",
"TimeOnSite": "605.4395199614316"
},
"EstimatedMonthlyVisits": {
"2026-04-01": 84751050692,…
What you’ll actually use:
- TopCountryShares: includes CountryCode (e.g., US) and Value (decimal share, 0–1). Multiply by Visits to estimate absolute visits per country.
- Engagments: string-typed metrics for BounceRate, PagePerVisit, Visits, TimeOnSite, plus Month and Year.
- Title and Description: quick site metadata for UI labels.
Working code you can paste
JavaScript (Node.js) — Traffic Source and Overview
import fetch from "node-fetch";
const API_KEY = process.env.ZYLA_API_KEY || "YOUR_API_KEY";
const DOMAIN = "google.com";
async function getTrafficOverview(domain) {
const url = `https://zylalabs.com/api/29/site-traffic-api/93/traffic-source-and-overview?domain=${encodeURIComponent(domain)}`;
const res = await fetch(url, {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
});
if (!res.ok) {
const body = await res.text();
throw new Error(`HTTP ${res.status}: ${body}`);
}
const data = await res.json();
// Parse key fields the dashboard needs
const site = data.SiteName;
const title = data.Title;
const desc = data.Description;
// Engagments fields come as strings — normalize to numbers where needed
const engagements = {
bounceRate: parseFloat(data.Engagments?.BounceRate ?? "0"),
month: parseInt(data.Engagments?.Month ?? "0", 10),
year: parseInt(data.Engagments?.Year ?? "0", 10),
pagesPerVisit: parseFloat(data.Engagments?.PagePerVisit ?? "0"),
visits: parseFloat(data.Engagments?.Visits ?? "0"),
timeOnSiteSeconds: parseFloat(data.Engagments?.TimeOnSite ?? "0")
};
// Compute top-5 countries with absolute visit estimates
const countries = (data.TopCountryShares || []).map(c => ({
iso2: c.CountryCode,
share: c.Value, // 0..1
estVisits: engagements.visits * (c.Value || 0)
}));
return { site, title, desc, engagements, countries };
}
getTrafficOverview(DOMAIN)
.then(result => {
console.log("Site:", result.site);
console.log("Title:", result.title);
console.log("Visits (est):", result.engagements.visits.toLocaleString());
console.log("Top countries:");
for (const c of result.countries) {
console.log(` ${c.iso2}: ${(c.share * 100).toFixed(2)}% ~ ${Math.round(c.estVisits).toLocaleString()} visits`);
}
})
.catch(err => {
console.error(err);
process.exit(1);
});
Python — Countries List
import os
import requests
API_KEY = os.getenv("ZYLA_API_KEY", "YOUR_API_KEY")
URL = "https://zylalabs.com/api/29/site-traffic-api/1372/countries-list"
resp = requests.get(URL, headers={"Authorization": f"Bearer {API_KEY}"})
resp.raise_for_status()
countries = resp.json()
# Build a quick ISO2 -> name map you can join against TopCountryShares.CountryCode
iso2_to_name = {c.get("alpha-2"): c.get("name") for c in countries if "alpha-2" in c and "name" in c}
print("US =", iso2_to_name.get("US"))
print("JP =", iso2_to_name.get("JP"))
Field notes that save you time
- Auth header: Always set Authorization: Bearer YOUR_API_KEY. Do not send an access_key query param.
- Country codes: TopCountryShares uses ISO-3166 alpha-2 (e.g., US, JP). Join these to Countries List alpha-2.
- Numeric strings: In Engagments, several numbers are string-typed. Parse to float/int before calculations.
- Timestamps: Month and Year are string fields. If you need a Date object, coerce safely.
- Caching: Country list changes rarely—cache it for hours or days. Traffic overview is time-sensitive; cache per domain per fetch window as your product allows.
- Pagination: Not documented for these endpoints. The Countries List returns the full set; TopCountryShares returns the top five.
- Error handling: Treat non-2xx as errors and log the body. Keep request/response logs in Postman for debugging.
- Trial and quotas: Subscription + quota model (not pay-per-call). First API: 7-day trial or 50 requests. No Free Plan. Check the API page for current details before load testing.
Build a simple competitor traffic dashboard
- Fetch Countries List once and store iso2 → name and region maps.
- For each domain on your watchlist, call Traffic Source and Overview with domain=example.com.
- Parse Engagments.Visits and TopCountryShares[].Value to compute estimated visits by country.
- Render a table ordered by share descending with country names from your map.
- Display bounce rate, pages per visit, and time on site beside the chart for quick context.
Call the Site Traffic API from an AI agent via MCP
If your team uses Claude Code, Cursor, Windsurf, or any MCP-compatible client, you can expose Zyla APIs through the MCP endpoint. Point your client to:
https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY
From there, instruct your agent to perform a GET to the same HTTPS endpoints you tested in Postman, including the Authorization header. For capabilities and setup details, see the MCP page.
Quick reference
- Countries List — GET https://zylalabs.com/api/29/site-traffic-api/1372/countries-list
- Traffic Source and Overview — GET https://zylalabs.com/api/29/site-traffic-api/93/traffic-source-and-overview?domain=YOUR_DOMAIN
- Auth: Authorization: Bearer YOUR_API_KEY
- API page: Site Traffic API
Postman troubleshooting tips
- 401 Unauthorized: Verify the Bearer token in the Authorization header is YOUR_API_KEY from Zyla (no quotes, no extra spaces).
- 404/405: Confirm the exact request URL path matches the docs and that you’re using GET.
- Empty or partial data: Ensure the domain query param is present and formatted without protocol or www.
- Rate or quota messages: Review your subscription status on Zyla; usage is tracked against your plan’s quota.
FAQ
Do I need to include “www” or “https://” in the domain parameter?
No. Pass the domain only, e.g., “example.com”.
How do I map CountryCode values to country names?
Call Countries List and join TopCountryShares.CountryCode (ISO-3166 alpha-2) to the alpha-2 field from that list.
Why are engagement numbers returned as strings?
Engagments fields like BounceRate, Visits, and PagePerVisit may be string-typed. Parse them to numbers before calculations.
Is this API priced per call?
No. It uses a subscription + quota model (not pay-per-call). For this API, you can start with a 7-day trial or 50 requests. No Free Plan. Check the API page for current options.
Can I call these endpoints from an MCP-compatible IDE agent?
Yes. Point your agent to the MCP endpoint with your key and perform the same GET requests with the Authorization header.
Ready to test in Postman? Create your account, subscribe, and get your API key here: Register. Then open the Site Traffic API on Zyla API Hub and start pulling traffic, country shares, and engagement metrics today.
Official API response
[{"name":"Afghanistan","alpha-2":"AF","alpha-3":"AFG","country-code":"004","iso_3166-2":"ISO 3166-2:AF","region":"Asia","sub-region":"Southern Asia","intermediate-region":"","region-code":"142","sub-region-code":"034","intermediate-region-code":""},{"name":"Åland Islands","alpha-2":"AX","alpha-3":"ALA","country-code":"248","iso_3166-2":"ISO 3166-2:AX","region":"Europe","sub-region":"Northern Europe","intermediate-region":"","region-code":"150","sub-region-code":"154","intermediate-region-code":""},{"name":"Albania","alpha-2":"AL","alpha-3":"ALB","country-code":"008","iso_3166-2":"ISO 3166-2:AL","region":"Europe","sub-region":"Southern Europe","intermediate-region":"","region-code":"150","sub-region-code":"039","intermediate-region-code":""},{"name":"Algeria","alpha-2":"DZ","alpha-3":"DZA","country-code":"012","iso_3166-2":"ISO 3166-2:DZ","region":"Africa","sub-region":"Northern Africa","intermediate-region":"","region-code":"002","sub-region-code":"015","intermediate-region-code":""},{"name":"American Samoa","alpha-2":"AS","alpha-3":"ASM","country-code":"016","iso_3166-2":"ISO 3166-2:AS","region":"Oceania","sub-region":"Polynesia","intermediate-region":"","region-code":"009","sub-region-code":"061","intermediate-region-code":""},{"name":"Andorra","alpha-2":"AD","alpha-3":"AND","country-code":"020","iso_3166-2":"ISO 3166-2:AD","region":"Europe","sub-region":"Southern Europe","intermediate-region":"","region-code":"150","sub-region-code":"039","intermediate-region-code":""},{"name":"Angola","alpha-2":"AO","alpha-3":"AGO","country-code":"024","iso_3166-2":"ISO 3166-2:AO","region":"Africa","sub-region":"Sub-Saharan Africa","intermediate-region":"Middle Africa","region-code":"002","sub-region-code":"202","intermediate-region-code":"017"},{"name":"Anguilla","alpha-2":"AI","alpha-3":"AIA","country-code":"660","iso_3166-2":"ISO 3166-2:AI","region":"Americas","sub-region":"Latin America and the Caribbean","intermediate-region":"Caribbean","region-code":"019","sub-region-code":"419","intermediate-region-code":"029"},{"name":"Antarctica","alpha-2":"AQ","alpha-3":"ATA","country-code":"010","iso_3166-2":"ISO 3166-2:AQ","region":"","sub-region":"","intermediate-region":"","region-code":"","sub-region-code":"","intermediate-region-code":""},{"name":"Antigua and Barbuda","alpha-2":"AG","alpha-3":"ATG","country-code":"028","iso_3166-2":"ISO 3166-2:AG","region":"Americas","sub-region":"Latin America and the Caribbean","intermediate-region":"Caribbean","region-code":"019","s…
Official API response
[{"name":"Afghanistan","alpha-2":"AF","alpha-3":"AFG","country-code":"004","iso_3166-2":"ISO 3166-2:AF","region":"Asia","sub-region":"Southern Asia","intermediate-region":"","region-code":"142","sub-region-code":"034","intermediate-region-code":""},{"name":"Åland Islands","alpha-2":"AX","alpha-3":"ALA","country-code":"248","iso_3166-2":"ISO 3166-2:AX","region":"Europe","sub-region":"Northern Europe","intermediate-region":"","region-code":"150","sub-region-code":"154","intermediate-region-code":""},{"name":"Albania","alpha-2":"AL","alpha-3":"ALB","country-code":"008","iso_3166-2":"ISO 3166-2:AL","region":"Europe","sub-region":"Southern Europe","intermediate-region":"","region-code":"150","sub-region-code":"039","intermediate-region-code":""},{"name":"Algeria","alpha-2":"DZ","alpha-3":"DZA","country-code":"012","iso_3166-2":"ISO 3166-2:DZ","region":"Africa","sub-region":"Northern Africa","intermediate-region":"","region-code":"002","sub-region-code":"015","intermediate-region-code":""},{"name":"American Samoa","alpha-2":"AS","alpha-3":"ASM","country-code":"016","iso_3166-2":"ISO 3166-2:AS","region":"Oceania","sub-region":"Polynesia","intermediate-region":"","region-code":"009","sub-region-code":"061","intermediate-region-code":""},{"name":"Andorra","alpha-2":"AD","alpha-3":"AND","country-code":"020","iso_3166-2":"ISO 3166-2:AD","region":"Europe","sub-region":"Southern Europe","intermediate-region":"","region-code":"150","sub-region-code":"039","intermediate-region-code":""},{"name":"Angola","alpha-2":"AO","alpha-3":"AGO","country-code":"024","iso_3166-2":"ISO 3166-2:AO","region":"Africa","sub-region":"Sub-Saharan Africa","intermediate-region":"Middle Africa","region-code":"002","sub-region-code":"202","intermediate-region-code":"017"},{"name":"Anguilla","alpha-2":"AI","alpha-3":"AIA","country-code":"660","iso_3166-2":"ISO 3166-2:AI","region":"Americas","sub-region":"Latin America and the Caribbean","intermediate-region":"Caribbean","region-code":"019","sub-region-code":"419","intermediate-region-code":"029"},{"name":"Antarctica","alpha-2":"AQ","alpha-3":"ATA","country-code":"010","iso_3166-2":"ISO 3166-2:AQ","region":"","sub-region":"","intermediate-region":"","region-code":"","sub-region-code":"","intermediate-region-code":""},{"name":"Antigua and Barbuda","alpha-2":"AG","alpha-3":"ATG","country-code":"028","iso_3166-2":"ISO 3166-2:AG","region":"Americas","sub-region":"Latin America and the Caribbean","intermediate-region":"Caribbean","region-code":"019","s…