Quickstart — CLI
This walks through zot as a plain command-line tool. If you want to drive it
from an AI agent instead, see Quickstart: AI agent.
Make sure zot ping is green first — see Install.
Read your library
Section titled “Read your library”Reads hit Zotero’s fast local HTTP API.
zot search "bolivia" --limit 10 # full-text searchzot search "x" --tag "#digitalización" # filter by tagzot search "x" --item-type book # filter by typezot get ABCD1234 # one item (Zotero key or BBT citekey)zot pdf ABCD1234 # local path(s) of the item's PDF(s)zot collections # key, #items, namezot tags # #items, tagzot stats # library analyticsAdd --json to any command for machine-readable output. Listing commands stop
at --limit and print showing N of M on stderr — pass --all to paginate
through everything.
Find and fill gaps
Section titled “Find and fill gaps”zot missing abstract --collection SS5MVVB6 # items lacking a fieldzot missing doi # library-widezot enrich --field doi --source crossref --dry-run # preview filling DOIszot enrich --field doi --source crossref # apply (undoable)zot lint # data-quality reportzot missing uses a reliable getField check rather than Zotero’s empty-string
search condition (which silently returns zero — see the
JS recipes).
Import, dedupe, edit
Section titled “Import, dedupe, edit”zot add doi 10.1371/journal.pmed.0020124 --pdf # import by identifier (+ OA PDF)zot dedupe --by title --fuzzy # find near-duplicate titleszot dedupe --merge --yes # merge (oldest = master)zot set date 2021 ABCD1234 --yes # edit a fieldzot tag add review ABCD1234 EFGH5678 --yes # add a tag to itemszot tag normalize --dry-run # fold case/space tag variantszot export "My Collection" --format bibtex --out refs.bibWrites are safe-by-default: they refuse to run non-interactively without
--yes, and prompt on a TTY.
Batch edits, undoably
Section titled “Batch edits, undoably”zot apply is the batch primitive. Each line of a JSONL file describes one
item’s edit:
{"key":"ABCD1234","set":{"date":"2021"},"addTags":["ml"],"addToCollection":"To Read"}{"key":"EFGH5678","removeTags":["old"],"trash":false}zot apply edits.jsonl --dry-run # previewzot apply edits.jsonl # apply — snapshots the affected items firstzot undo last # roll it backzot undo list # see prior operationsBecause apply snapshots before writing, zot undo can restore it. (Merges are
the exception — they are not reversible; take a zot backup first.)
The escape hatch
Section titled “The escape hatch”For anything the commands above don’t cover, zot exec runs arbitrary
privileged Zotero JavaScript:
zot exec 'return Zotero.version;' # inlinezot exec script.js # from a fileecho 'return 1+1;' | zot exec - # from stdinzot exec script.js --dry-run # intercept writes, report onlySee the JS recipe book for ready-made snippets.
Global flags & exit codes
Section titled “Global flags & exit codes”| Flag | Effect |
|---|---|
--json | machine-readable output |
-q, --quiet | suppress progress notices |
--yes | confirm writes non-interactively |
--base / --token / --user-id | override config (or ZOTERO_AGENT_* env) |
Exit codes: 0 ok, 1 error, 2 connection/exec, 3 not-found, 4 config. Full details in the command reference.