Per-post analytics
The API returns, per post, the total views and visitors for the requested window and the daily series. Reference: analytics.
| Route | Use |
|---|---|
GET /v1/analytics/posts/{reference} |
one post, by id (ULID or UUID) or slug |
GET /v1/analytics/posts/batch?refs=a,b,c |
up to 50 posts at once |
Both also exist as /v1/sites/{site}/analytics/posts/.... Scope analytics:read (literal fine-grained, no v1 package grants it); live permission of the cvt_ bearer: site.analytics:read. The query counts against the grant’s read quota.
Parameters
Section titled “Parameters”All optional, in the query:
| Parameter | Description |
|---|---|
from, to |
YYYY-MM-DD dates, in UTC; to is inclusive |
days |
window length in days, 1 to 731 (default 30) |
language |
BCP-47; used only to disambiguate a slug |
refs |
batch only: comma-separated ids or slugs |
reference accepts an id or a slug; drafts and scheduled posts resolve too.
One post
Section titled “One post”curl -s "https://api.canverly.net/v1/analytics/posts/my-slug?days=7" \ -H "Authorization: Bearer $TOKEN"{ "post_id": "01J...", "path": "/blog/my-slug", "published": true, "window": { "from": "2026-10-18", "to": "2026-10-24", "days": 7 }, "totals": { "views": 412, "visitors": 301 }, "timeseries": [{ "date": "2026-10-18", "views": 50, "visitors": 41 }]}visitorsis the count of distinct visitors in the window, not the sum of the days. The daily series is in UTC, with no gaps.- Only
viewsandvisitorsare exposed; there is no country, user agent, referrer orsite_id. Bots and responses with status 400 or above are not counted; staff traffic is filtered at ingestion. - The queried path is the
pathof the post’s public URL, matched exactly (never a prefix). - Unpublished post (draft, scheduled, restricted):
200withpublished: false,path: null, zeroed totals and a series with the same dates as the window. This is not an error. - A post that does not exist in this site:
404 POST_NOT_FOUND(post not found).
curl -s "https://api.canverly.net/v1/analytics/posts/batch?refs=my-slug,01J...,other-slug&days=30" \ -H "Authorization: Bearer $TOKEN"{ "window": { "from": "2026-09-25", "to": "2026-10-24", "days": 30 }, "items": [ { "ref": "my-slug", "post_id": "01J...", "path": "/blog/my-slug", "published": true, "totals": { "views": 1200, "visitors": 900 }, "timeseries": [] } ], "errors": [{ "ref": "other-slug", "code": "POST_NOT_FOUND", "message": "post not found" }]}refsis comma-separated, trimmed and deduplicated, keeping the order. Each ref is at most 200 bytes and there are at most 50 distinct ones.- Missing or empty
refs:400 INVALID_PARAMETER(refs is required: a comma-separated list of post ids or slugs). More than 50:400(refs accepts at most 50 posts per request). A long ref:400(each ref must have at most 200 bytes). This validation happens before the site is proven. itemsfollows the order ofrefs. A ref that does not resolve goes toerrors[]without failing the batch, withcodePOST_NOT_FOUND,INVALID_PARAMETERorUPSTREAM_UNAVAILABLE. A live post for which analytics returned no number goes toerrors[]withMETRICS_UNAVAILABLE(no metrics were returned for this post's page).- The API makes one call to analytics with the distinct paths.
Window
Section titled “Window”from/to or days; days defaults to 30. Responses always carry window with the dates actually used.
days is valid from 1 to 731 (default 30). A non-numeric or out-of-range days, or a from that is not a date, falls back to the default of 30 days without an error; from greater than to is un-inverted and a span over 731 days is cut keeping to. So check window in the response instead of assuming the days you sent applied. The 422 INVALID_PARAMETER only comes from a malformed query (missing site or paths). vitals stays at 1 to 90 days, with 400 outside that range.
Errors and caching
Section titled “Errors and caching”| Status | error.code |
When |
|---|---|---|
| 400 | INVALID_PARAMETER |
invalid refs; ambiguous slug (pass language) |
| 404 | not_found |
site out of reach, or flag off |
| 404 | POST_NOT_FOUND |
post does not exist in this site |
| 422 | INVALID_PARAMETER |
malformed query (missing site or paths), with analytics’ own text |
| 503 | ANALYTICS_UNAVAILABLE |
the analytics service did not answer; retry (nothing else in the API is affected) |
Missing scope: 403 insufficient_scope (bearer) or 403 forbidden (key). See errors and limits.
Every response carries Cache-Control: private, no-store. The API keeps no cache between calls, so each query goes to analytics.