Countries and cities endpoint

GET /api/v1/sites/{site}/countries

Returns visitor counts grouped by country and city.

Example request

curl -H "Authorization: Bearer your-token" "https://pageviews.ai/api/v1/sites/{site_id}/countries?from=2026-03-01&to=2026-03-07"

Response

  • countries — Array of objects with iso (ISO 3166-1 alpha-2 country code) and value (visitor count)
  • cities — Array of objects with city name, iso country code, and value (visitor count)

Example response

{
  "data": {
    "countries": [
      { "iso": "US", "value": 432 },
      { "iso": "GB", "value": 187 },
      { "iso": "DE", "value": 94 }
    ],
    "cities": [
      { "city": "New York", "iso": "US", "value": 89 },
      { "city": "London", "iso": "GB", "value": 76 }
    ]
  }
}