Skip to main content

kagi lens

Manage Kagi search lenses from the terminal.

Synopsis

Authentication

Required: KAGI_SESSION_TOKEN Lens management uses Kagi’s authenticated settings pages.

Subcommands

kagi lens list

List available lenses and whether they are enabled.

kagi lens get <ID_OR_NAME>

Fetch one lens definition by id or exact name.

kagi lens create <NAME>

Create a lens. Supported options:
  • --included-sites <CSV>
  • --included-keywords <CSV>
  • --description <TEXT>
  • --region <REGION>
  • --before-date <YYYY-MM-DD>
  • --after-date <YYYY-MM-DD>
  • --excluded-sites <CSV>
  • --excluded-keywords <CSV>
  • --shortcut <KEYWORD>
  • --autocomplete-keywords / --no-autocomplete-keywords
  • --template <default|news>
  • --file-type <EXT>
  • --share-with-team / --no-share-with-team
  • --share-copy-code / --no-share-copy-code

kagi lens update <ID_OR_NAME>

Update a lens by id or exact name.

kagi lens enable <ID_OR_NAME>

Enable a lens.

kagi lens disable <ID_OR_NAME>

Disable a lens.

kagi lens delete <ID_OR_NAME>

Delete a lens.

Output Contract

list returns an array of summaries:
get, create, and update return full lens details:
enable and disable return:

Examples

Use a lens in search after creating it:
Inspect the full configuration for one lens:

Notes

  • Targets can be either the numeric lens id or the exact lens name.
  • --template news maps to Kagi’s built-in news lens template.
  • kagi search --lens still uses the numeric search lens index, not the lens id shown here.

See Also

  • search - use a lens during search
  • assistant - assistant profiles can also reference a lens id
  • auth-matrix - auth requirements for settings commands