Authentication

Statnive’s REST API uses standard WordPress REST authentication. You can authenticate with application passwords, cookie-based authentication (for logged-in users), or any authentication plugin that integrates with the WordPress REST API. All endpoints require the manage_options capability by default.

Base URL

All endpoints are registered under the statnive/v1 namespace:

https://yoursite.com/wp-json/statnive/v1/

Available Endpoints

GET /stats/summary

Returns a summary of key metrics for a given date range.

Parameters:

  • from (string, required) — Start date in YYYY-MM-DD format.
  • to (string, required) — End date in YYYY-MM-DD format.

Response:

{
  "visitors": 1234,
  "pageviews": 3456,
  "sources": { "organic_search": 520, "social": 310, "direct": 280 },
  "top_pages": [{ "path": "/", "views": 890 }]
}

GET /stats/sources

Returns traffic source breakdown by channel.

GET /stats/pages

Returns page-level analytics sorted by pageview count.

GET /stats/realtime

Returns the current active visitor count and recent pageview feed.

Rate Limiting

API requests are rate-limited to 60 requests per minute per authenticated user. This limit is enforced at the application level and returns a 429 Too Many Requests response when exceeded.