Skip to content

Get XML statistics ​

GET/xml/stats

Required scope: publisher:xml:read

Authenticate with Authorization: Bearer YOUR_NEXUS_API_KEY. The legacy token query parameter remains available; use one transport per request.

Authentication and error codes →

Returns XML traffic statistics for the authenticated member's TIDs. Omit tid or leave it empty to include every owned TID. Each row then includes tid, alongside the selected day, country, or SubID grouping. Supply a TID to filter to one owned source; the single-TID response keeps its existing fields.

Query parameters ​

ParameterRequiredDescription
tokenOnly without BearerCompatibility transport for a publisher API key with publisher:xml:read. Prefer the Authorization header; never send both.
tidNoPositive owned XML traffic-source/account identifier. Missing or empty includes all owned TIDs.
date_fromYesInclusive start date in YYYY-MM-DD.
date_toYesInclusive end date in YYYY-MM-DD.
groupByNoday, geo, or subid; default day.
exportNojson or csv.
bash
curl --get "https://api.example.com/xml/stats" \
  --header "Authorization: Bearer YOUR_NEXUS_API_KEY" \
  --data-urlencode "tid=12345" \
  --data-urlencode "date_from=2026-08-01" \
  --data-urlencode "date_to=2026-08-17" \
  --data-urlencode "groupBy=day"
javascript
const params = new URLSearchParams({ tid: '12345', date_from: '2026-08-01', date_to: '2026-08-17', groupBy: 'geo' });
const response = await fetch(`https://api.example.com/xml/stats?${params}`, {
  headers: { Authorization: `Bearer ${process.env.NEXUS_API_KEY}` },
});
if (!response.ok) throw new Error(`Nexus returned ${response.status}`);
console.log(await response.json());
python
import os
import requests

response = requests.get(
    'https://api.example.com/xml/stats',
    headers={'Authorization': f"Bearer {os.environ['NEXUS_API_KEY']}"},
    params={'tid': 12345, 'date_from': '2026-08-01', 'date_to': '2026-08-17', 'groupBy': 'subid'},
    timeout=30,
)
response.raise_for_status()
print(response.json())

To request all owned TIDs, remove tid from any example above or send tid=. An account with no assigned TIDs returns 404 / NO_DATA, not statistics from other members.

Example daily response ​

json
{
  "status": "success",
  "message": "XML API report",
  "data": [
    {
      "date": "2026-08-17",
      "gross_requests": 26023392,
      "gross_clicks": 10356,
      "gross_valid": 10356,
      "gross_invalid": 0,
      "gross_revenue": 5.28,
      "net_requests": 0,
      "net_clicks": 3749,
      "net_revenue": 2.25
    }
  ]
}

Errors ​

  • 400 — invalid dates, grouping, export format, or a nonempty invalid TID.
  • 401 — missing, invalid, disabled, expired, revoked, or inactive key; the response code distinguishes the reason.
  • 403 — the supplied TID is foreign or forbidden for this key.
  • 404 — no data was available for the requested export.
  • 429 — request limit reached; retry later.
  • 413 / 503 — report too large or service temporarily unavailable.

Use inclusive UTC dates with at most 90 days per request. Include X-Request-ID when reporting an error. See authentication errors.

White-label Nexus API documentation