You need to add a traffic overview to an application, but a domain alone is not enough to build a useful dashboard: you also need to interpret country codes and engagement fields consistently. By the end of this guide, you will know how to request a site overview, retrieve the supported-country list, and connect the two in your application.
The Zyla API Hub listing for Site Traffic API provides traffic information for a domain, including its top five countries, traffic sources, and engagement information. It can support competitive research dashboards, market analysis tools, and applications that need a geographic view of a site's audience.
Getting started on Zyla API Hub
Create a free Zyla account, open the Site Traffic API marketplace page, and select Subscribe or Start Free Trial when available. The marketplace uses one account and one API key across its catalog of more than 10,000 public APIs. Send the key in the Authorization: Bearer YOUR_API_KEY header.
Access uses a subscription and quota rather than pay-per-call billing. The first API offers a 7-day trial or 50 requests; check the API page for current access options and pricing. Keep the key on your server or in a secret store rather than exposing it in browser code.
Endpoints for a traffic overview
Traffic Source and Overview
Method: GET
Request URL: https://zylalabs.com/api/29/site-traffic-api/93/traffic-source-and-overview
This endpoint returns traffic status for the top five countries, traffic sources, and engagement information. It requires the domain query parameter. Pass the domain without a URL scheme and without www; the documented example value is google.com.
The documented request URL with that value is https://zylalabs.com/api/29/site-traffic-api/93/traffic-source-and-overview?domain=google.com. Authenticate it with the same Bearer header used in the Countries List request below.
The example overview response includes SiteName, TopCountryShares, Engagments, and EstimatedMonthlyVisits. Keep the spelling Engagments when reading the response: changing it to the more familiar spelling would make your parser look for a different field.
Within TopCountryShares, the example contains Country, CountryCode, and Value. The engagement object includes BounceRate, Month, Year, PagePerVisit, Visits, and TimeOnSite. Those engagement values appear as strings in the example, so convert them deliberately before performing numeric calculations.
Countries List
Method: GET
Request URL: https://zylalabs.com/api/29/site-traffic-api/1372/countries-list
Countries List returns the supported countries and their codes. Use it to turn a country code from a traffic overview into a display name or to group countries by the returned region fields. The request has no documented user parameters; send the authorization header:
curl -s -X GET "https://zylalabs.com/api/29/site-traffic-api/1372/countries-list" \
-H "Authorization: Bearer YOUR_API_KEY"
Read the country response
The following is the official response excerpt. It is truncated at the end, so it illustrates the returned records but is not a complete JSON document to paste into a parser.
[{"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…
For a country label, use name; for a lookup keyed by the overview's two-letter CountryCode, use alpha-2. The list also supplies alpha-3, country-code, and regional fields. Preserve country-code as a string: values such as 004 contain leading zeroes.
Some region fields in the excerpt are empty strings. Treat an empty region as missing data rather than displaying an empty label or assuming every country has the same geographic detail.
Call Countries List from Python
This sample calls the same endpoint as the curl request using Python's standard library. Replace YOUR_API_KEY with your key, then run the script. It builds an index by alpha-2 and prints the country name and region for each record.
import json
import sys
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
url = "https://zylalabs.com/api/29/site-traffic-api/1372/countries-list"
request = Request(
url,
headers={"Authorization": "Bearer YOUR_API_KEY"},
method="GET",
)
try:
with urlopen(request, timeout=7) as response:
countries = json.load(response)
except HTTPError as exc:
sys.exit(f"API request failed with HTTP status {exc.code}")
except (URLError, TimeoutError, json.JSONDecodeError) as exc:
sys.exit(f"Could not retrieve or parse the country list: {exc}")
by_alpha2 = {
country["alpha-2"]: country
for country in countries
if country.get("alpha-2")
}
for code, country in by_alpha2.items():
name = country.get("name", "")
region = country.get("region") or "Region unavailable"
print(f"{code}: {name} — {region}")
Use the index when rendering an overview: look up each entry's CountryCode and display its matching country name. If a code is absent from your index, show the code itself instead of silently dropping the traffic entry. The response values for country shares should remain available alongside the labels so the application can sort or display them.
Build a useful traffic view
For a market research dashboard, start with the requested domain and its top-country entries. Resolve the country codes to names, then show the corresponding share values. The overview is limited to the top five countries, so label that section accordingly rather than presenting it as a complete geographic breakdown.
For an engagement view, read the Engagments object using its exact field names. The example's Month and Year give context for those figures, while EstimatedMonthlyVisits contains date-keyed values. Keep the period visible when comparing or displaying metrics; a monthly estimate should not be presented as a live visit count.
Convert the example's string-valued engagement numbers only after checking that a value is present and can be parsed. Preserve the original response when you need to troubleshoot a conversion. The supplied example does not establish a unit for TimeOnSite, so avoid labeling it as seconds or minutes without checking the API page.
A country-list cache can reduce repeated lookups when rendering multiple overviews. Choose a refresh policy appropriate to your application, and retain a fallback for an unknown code. Cache traffic results separately from the country list so you can refresh the overview without rebuilding the country index on every request.
Use the API from an AI agent
Site Traffic API can also be called through Zyla's MCP endpoint. Configure an MCP-compatible client, such as Claude Code, Cursor, or Windsurf, with https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY.
An agent can use the traffic overview for a domain and the country list to interpret country codes. Protect the configured key as you would the Bearer key in an application, and review the returned fields before using an agent-generated summary in a report.
FAQ
What should I put in the domain parameter?
Use the domain without a URL scheme or www. The documented example is google.com.
How do I convert traffic country codes into names?
Retrieve Countries List and index its records by alpha-2. Match those values to the overview's CountryCode field, while keeping a fallback for codes that are not in your local index.
Does the overview include every country?
The endpoint description specifies traffic status for the top five countries. Do not label that list as a complete country distribution.
Why does my parser need to use Engagments?
That is the field spelling in the documented response. Read it exactly as returned, then map it to a differently named property inside your application if you prefer.
How is access billed?
Site Traffic API uses a subscription and quota. Check the listing for current access options and pricing, including the available first-API trial.
Ready to integrate the country lookup and traffic overview? Create a free Zyla account, then Start 7-day trial on Site Traffic API from the marketplace page and get your API key.