Kanorio

SDKs & tools

CLI

Script the Management API from your terminal, generate TypeScript types for a site's collections, and check a headless front end's setup.

The Kanorio CLI wraps the Management API for scripts and CI, and adds two developer tools: type generation and a health check for headless front ends.

npx @kanorio/cli --help

Sign in

npx @kanorio/cli login --token knr_pat_...

The token is stored in ~/.config/kanorio/config.json with owner-only permissions. In CI, set KANORIO_TOKEN instead. It takes precedence over the stored token. A service account token works too.

Common commands

kanorio sites list
kanorio pages list ws_example123
kanorio pages replace-sections ws_example123 pg_example456 --file sections.json
kanorio media upload ws_example123 --file hero.jpg
kanorio publish ws_example123
kanorio domains status ws_example123

Commands that overwrite content read the resource first and send its timestamp, so they fail with CONFLICT instead of overwriting someone's edits. Run kanorio --help for the full list.

Output and exit codes

  • Add --json to print the raw API response, including errors, for scripting.
  • Errors print as <CODE> (HTTP <status>): <message> on stderr and exit with 1. Usage errors exit with 2.
  • Warnings about deprecated operations go to stderr.

Generate types

kanorio types --site https://s-xxxxxxxxxxxx.kanorio.com --out src/kanorio.d.ts

types reads the site's public collection schema and writes FieldData, Expanded and Item types for every collection, plus the types for pages, globals and site metadata. Run it again when the schema changes, or subscribe to the collections.schema.changed webhook to automate it.

Check a headless front end

kanorio doctor --site ws_example123

doctor checks that your front end serves the sitemap, robots.txt, llms.txt, feeds, JSON-LD and the IndexNow key file, that page content is in sync, and that pageviews and webhooks are arriving. Add --switching before you move a domain from a Kanorio-hosted site to your own front end.