REST API endpoint

GET /v1/sources

Traffic sources from the current live window with classification and optional child rows.

Request

GET https://api.nowmetrix.com/v1/sources?site=TRACKER_ID

Use this endpoint when you need a focused source breakdown without loading the full realtime top-pages payload.

Authentication

Requires an API key in the Authorization header: Authorization: Bearer nm_YOUR_KEY.

Query parameters

Name Type Required Description
site string required Tracker ID. The API key must have access to this tracker.

cURL example

curl -H "Authorization: Bearer nm_YOUR_KEY" \
  "https://api.nowmetrix.com/v1/sources?site=TRACKER_ID"

Example response

{
  "site": "TRACKER_ID",
  "updated_at": "2026-06-26T12:24:30+00:00",
  "total_visitors": 128,
  "sources": [
    {
      "medium": "search",
      "source": "Google Search",
      "count": 46,
      "percent": 36,
      "children": [
        {
          "label": "google.com",
          "count": 28
        },
        {
          "label": "google.ch",
          "count": 18
        }
      ]
    },
    {
      "medium": "social",
      "source": "social.example",
      "count": 24,
      "percent": 19,
      "children": []
    },
    {
      "medium": "newsletter",
      "source": "morning-briefing",
      "count": 17,
      "percent": 13,
      "children": [
        {
          "label": "daily-edition",
          "count": 11
        },
        {
          "label": "evening-edition",
          "count": 6
        }
      ]
    }
  ]
}

Response fields

Field Type Description
site string Tracker ID used for the request.
updated_at string UTC timestamp for when the payload was generated.
total_visitors integer Active users represented by the source breakdown.
sources[] array<object> Source rows sorted by count.
sources[].medium string Source category, for example search, social, newsletter, or (none).
sources[].source string Normalized source label.
sources[].count integer Number of active users from this source.
sources[].percent integer Rounded percentage of total visitors.
sources[].children[] array<object> Optional detail rows, such as search hostnames or campaign names.
sources[].children[].label string Child row label.
sources[].children[].count integer Child row count.

Freshness and caching

Responses are microcached per tracker for 8 seconds. The response also includes X-NowMetrix-Microcache with HIT or MISS.

Errors

HTTP Code Description
400 site_required The site query parameter is missing.
401 missing_token The Authorization header is missing.
401 invalid_token The token is invalid or revoked.
403 site_not_authorized The API key has no access to this tracker.
429 rate_limit_exceeded The rate limit has been exceeded.
503 redis_unavailable The realtime backend is temporarily unavailable.
{
  "error": {
    "code": "invalid_token",
    "message": "Bearer token is invalid or revoked."
  }
}