Analytics API Overview and Authentication #
Base URL #
All DMSI Analytics API endpoints are under:
https://your-site.com/wp-json/dmsilm/v1/analytics/
Authentication #
All endpoints require WordPress authentication with the manage_dmsilm_analytics capability.
Supported authentication methods:
| Method | How to Use |
|---|---|
| Cookie Auth | Used automatically by the WordPress admin AJAX calls |
| Application Passwords | Create at Users > Your Profile > Application Passwords |
| Basic Auth (with plugin) | Requires a Basic Auth plugin; not recommended for production |
Example using Application Password:
curl -u "admin:xxxx xxxx xxxx xxxx xxxx xxxx" \
https://your-site.com/wp-json/dmsilm/v1/analytics/revenue
Rate Limiting #
The API enforces a rate limit of 60 requests per minute per authenticated user.
When you exceed the rate limit, the API returns:
HTTP 429 Too Many Requests
{
"code": "rate_limit_exceeded",
"message": "Too many requests. Try again in 60 seconds.",
"data": { "status": 429 }
}
Rate limits are tracked using WordPress transients. The 60-request window resets every 60 seconds.
Response Format #
All endpoints return a consistent JSON structure:
Success:
{
"success": true,
"data": { ... },
"meta": {
"period": "monthly",
"date_from": "2026-02-01",
"date_to": "2026-02-28",
"generated_at": "2026-03-22T02:00:00Z"
}
}
Error:
{
"code": "error_code",
"message": "Human-readable error description",
"data": { "status": 400 }
}
Date Parameters #
All endpoints that accept date ranges support these parameters:
| Parameter | Format | Description |
|---|---|---|
date_from | YYYY-MM-DD | Start date (inclusive) |
date_to | YYYY-MM-DD | End date (inclusive) |
period | daily, weekly, monthly, quarterly | Aggregation period |
