Skip to main content
These endpoints answer two questions: what are people and agents reading and failing to find, and which pages need attention. Analytics and health endpoints need the default SQLite search backend and return 501 when KiwiFS runs with search.engine = "grep". KiwiFS records a page view on every GET /api/kiwi/file for a markdown page, except from known bots. Tag views with ?source= or the X-Kiwi-Source header (default api) to break them down by client.

Health dashboard

Return page counts, health issues, link coverage, recent updates, and engagement in one call. The web UI’s analytics panel uses this.
string
Path prefix. Only pages under it are counted.
integer
default:"30"
Days used for the stale check. See Stale pages.
integer
Indexed pages.
integer
Sum of word counts.
object
Issue groups. Each has count and paths. Orphans, broken links, and empty pages come from the latest janitor scan.
object
object[]
The 10 most recently updated pages, each with path and updated_at.
object

Analytics overview

Return headline numbers for a period, each compared with the period before it.
string
default:"7d"
Number of days followed by d, such as 7d, 30d, or 90d. Invalid values fall back to 7d.
string
Period used.
integer
Page views in the period.
number
Change in views versus the previous period, in percent.
integer
Searches in the period.
number
Change in searches, in percent.
number
Share of searches that returned results.
number
Change in success rate, in percentage points.
integer
Distinct pages viewed.
number
Change in distinct pages viewed, in percent.

Page views

Return the most viewed pages, optionally for one page or since a point in time.
integer
default:"20"
Maximum rows, up to 200.
string
Only return views of this page.
string
Unix timestamp or RFC 3339 time. Returns 400 if it is neither.
integer
Row limit used.
string
Path filter, if given.
integer
Start time as a Unix timestamp, if given.
object[]

Page view time series

Return page views bucketed over time, plus the top 20 pages for the period. Buckets are hourly for periods up to 7 days and daily beyond that.
string
default:"30d"
Number of days followed by d.
string
Limit the time series to one page. top_pages always covers every page.
string
Period used.
string
Path filter, if given.
object[]
Buckets, each with timestamp (Unix seconds, bucket start) and count.
object[]
Up to 20 pages, same shape as page views results.

Search analytics

Return search volume over time, the success rate, and the 20 most frequent failed queries for a period.
string
default:"30d"
Number of days followed by d.
string
Period used.
number
Share of searches that returned results.
object[]
Buckets, each with timestamp and count.
object[]

Failed searches

Return the most frequent searches that returned no results.
integer
default:"20"
Maximum rows, up to 200.
string
Unix timestamp or RFC 3339 time. Returns 400 if it is neither.
integer
Row limit used.
integer
Start time as a Unix timestamp, if given.
object[]
Return pages whose views rose or fell most compared with the previous period.
string
default:"7d"
Number of days followed by d.
string
Period used.
Pages with rising views.
object[]
Pages with falling views. Both arrays share this shape:

Content gaps

Return failed queries that suggest missing pages. Dismissed queries are excluded.
integer
default:"20"
Maximum rows, up to 200.
object[]
Same shape as failed searches results.

Dismiss a content gap

Hide a query from the content gaps list, for example after writing the missing page.
string
required
Query text, exactly as listed.
string
default:"search"
search_type from the content gap entry.
Returns 400 if query is missing.

View sources

Return page views in a period grouped by source. The source is the source query parameter or X-Kiwi-Source header sent with the file read, or api when neither is set.
string
default:"7d"
Number of days followed by d.
string
Period used.
object
Map from source name to view count.

Page health check

Return size, link, and freshness metrics and open issues for one page.
string
required
Page path.
Returns 400 if path is missing. A page that isn’t indexed returns 200 with the issue page not found in index.
string
Page path.
integer
Words in the page.
Outgoing links.
Incoming links.
number
Days since the page last changed.
number
Frontmatter quality_score, if set.
string[]
Issues from the latest janitor scan, formatted kind: message.

Stale pages

List pages due for review. A page is stale when its next-review date has passed, or, if it has no next-review, when its reviewed date is older than days. Pages with status: deprecated or status: archived are skipped.
integer
default:"30"
Age threshold for the reviewed fallback.
integer
Threshold used.
integer
Stale pages found.
object[]
Pages, each with path and frontmatter.

Contradictions

List pages that may conflict with a given page. A page is a candidate when it shares a tags or topics value with the given page and either has a different status, or both pages set source-of-truth: true.
string
required
Page path.
string
Page checked.
string[]
Paths of possibly conflicting pages.

Janitor scan

Return the results of a knowledge base health scan. The server runs scans on a schedule; this endpoint returns the cached result unless you ask for a fresh one or a non-default threshold.
integer
default:"90"
Days without changes before a page counts as stale. The default comes from the janitor configuration.
boolean
default:"false"
Run a new scan instead of returning the cached result.
Cached responses include an X-Kiwi-Janitor-LastScan header with the scan time.
object[]
integer
Pages scanned.
integer
Pages with no issues.
string
When the scan ran.

Memory report

Summarize episodic memory: how many episode files exist, how many have been merged into durable pages, and which haven’t. See Episodic memory.
string
default:"episodes/"
Folder holding episode files. Defaults to [memory] episodes_path_prefix in config.
integer
Maximum entries in episodic_files and unmerged.
integer
Entries to skip in episodic_files and unmerged.
Returns 400 for a negative or non-numeric limit or offset. Results are cached for 30 seconds.
integer
Episode files found.
integer
Episode files before pagination.
integer
Unmerged episodes before pagination.
integer
merged-from references across all pages.
number
Percentage of episodes referenced by a merged-from entry.
integer
Pages flagged as contradicting each other.
number
Mean age of active pages, in days.
integer
Pages whose expires_at has passed.
integer
Pages with memory_status: contested.
object
Map from frontmatter scope value to page count.
object[]
Episode files, each with path and optional episode_id and memory_kind.
object[]
Episodes not yet merged, same shape.
string[]
Problems found while scanning. Omitted when empty.

MCP equivalents

kiwi_analytics (health dashboard), kiwi_health_check, and kiwi_memory_report.

Refactor

Find and fix broken links and orphan pages.

Web UI analytics

The analytics panel built on these endpoints.
Last modified on October 19, 2026