zotero-cli
English | 简体中文
Single-user, agent-first CLI for Zotero: manage literature, create items from DOIs, upload PDFs, query Zotero RSS feeds, and produce script-friendly output.
zotero-cli is built for researchers and automation agents that need a
predictable command line interface around Zotero. It wraps the Zotero Web API for
library operations, can read Zotero's local SQLite database for RSS feed queries,
and supports both Zotero File Storage and WebDAV-style attachment upload.
Features
- Manage Zotero items, collections, and tags from the terminal.
- Create items from CrossRef metadata with
items add-doi. - Find existing library items by exact DOI with
items find-doi. - Attach PDFs through Zotero File Storage by default, or WebDAV when configured.
- Query Zotero RSS feeds from the local
zotero.sqlitedatabase. - Export items as BibTeX, RIS, CSL JSON, and other Zotero-supported formats.
- Use human-readable output, JSON envelopes, or key-only quiet mode.
- Keep separate user or group libraries in named profiles.
- Inspect the command tree with
zotero-cli schemafor automation.
Installation
Install the published CLI with uv:
uv tool install zotero
zotero-cli --version
Install the latest code directly from GitHub:
uv tool install git+https://github.com/cywwycedward/zotero-cli.git
zotero-cli --version
Install from source for development:
git clone https://github.com/cywwycedward/zotero-cli.git
cd zotero-cli
uv sync --extra dev
uv run zotero-cli --help
The project package name is zotero; the console command is zotero-cli.
Quick Start
Create a profile and add your Zotero API credentials:
zotero-cli config init
zotero-cli config set api_key "<your-zotero-api-key>"
zotero-cli config set library_id "<your-library-id>"
zotero-cli config set library_type user
zotero-cli config validate
List and search items:
zotero-cli items list --limit 20
zotero-cli items search "machine learning" --limit 10
zotero-cli items show ABCD1234
Create items manually or from a DOI:
zotero-cli items create \
--type journalArticle \
--title "My Paper" \
--doi "10.1145/3368089.3409742" \
--tags "reading,systems"
zotero-cli items add-doi "https://doi.org/10.1145/3368089.3409742" \
--tags "to-read" \
--dry-run
Attach a PDF and export references:
zotero-cli items attach ABCD1234 ./paper.pdf --title "Accepted manuscript"
zotero-cli items export --format bibtex --collection COLL1234 --output references.bib
Configuration
zotero-cli reads profiles from:
~/.config/zotero-cli/config.toml
If XDG_CONFIG_HOME is set, the path becomes:
$XDG_CONFIG_HOME/zotero-cli/config.toml
A minimal user-library profile:
[default]
api_key = "..."
library_id = "12345678"
library_type = "user"
Use a group library by setting library_type = "group" and the group library
ID. Group libraries cannot use WebDAV attachment storage.
Profiles
The default profile is default. Select another profile with --profile:
zotero-cli --profile work config init
zotero-cli --profile work items list
zotero-cli config profiles
Environment Overrides
Profile values can be overridden with environment variables:
export ZOTERO_CLI_DEFAULT_API_KEY="..."
export ZOTERO_CLI_DEFAULT_LIBRARY_ID="12345678"
export ZOTERO_CLI_DEFAULT_LIBRARY_TYPE="user"
The prefix is ZOTERO_CLI_<PROFILE>_, where <PROFILE> is uppercased.
WebDAV Attachments
Without WebDAV settings, attachments use Zotero File Storage through pyzotero. Add a profile-specific WebDAV section to switch attachment uploads to the self-managed WebDAV backend:
[default.webdav]
url = "https://dav.example.com"
storage_path = "/zotero"
username = "myuser"
password = "mypass"
timeout = 120
verify_ssl = true
RSS Feed Queries
Feed commands read Zotero's local SQLite database. Configure the path when auto-detection is not enough:
[default.sqlite]
path = "/home/user/Zotero/zotero.sqlite"
See docs/CONFIGURATION.md for all fields, profile rules, environment variables, and examples.
Command Overview
| Group | Purpose | Commands |
|---|---|---|
items |
Read, write, attach, full-text, export, and DOI workflows | list, search, show, find-doi, fulltext, create, add-doi, update, delete, attach, export |
collections |
Collection tree and membership management | list, show, create, delete, add-items, remove-items |
tags |
Tag listing and batch tag operations | list, add, remove, rename, delete |
feeds |
Local Zotero RSS feed inspection | list, show, items |
config |
Profile and credential management | init, show, set, get, validate, profiles |
schema |
JSON command tree introspection | schema, schema --command items.list |
Global options:
--json Output as a JSON envelope
--profile TEXT Profile name (default: default)
--quiet, -q Quiet mode: keys only
--version, -v Show version and exit
Output Modes
Default output is compact and human-readable, with key-value blocks, lists, trees, summaries, YAML, or raw export bytes depending on the command.
Use --json for scripts:
zotero-cli --json items list --limit 1
JSON output uses a stable envelope:
{
"ok": true,
"data": [],
"error": null,
"meta": {
"command": "items.list",
"elapsed_ms": 12
}
}
Use --quiet when a command has a key-oriented output that you want to pipe:
zotero-cli --quiet items find-doi "10.1145/3368089.3409742" | xargs -r -n1 zotero-cli items show
--json and --quiet are mutually exclusive.
Examples
DOI Workflow
Check whether a DOI already exists, then create it from CrossRef metadata if needed:
zotero-cli items find-doi "doi:10.1145/3368089.3409742"
zotero-cli items add-doi "10.1145/3368089.3409742" --collection COLL1234 --tags "systems"
Set crossref_email for CrossRef polite-pool requests:
zotero-cli config set crossref_email "you@example.com"
PDF Attachment
Create a Zotero item and attach a PDF in one command:
zotero-cli items create \
--type journalArticle \
--title "A Useful Paper" \
--attach ./paper.pdf \
--attach-title "Publisher PDF"
Attach to an existing item:
zotero-cli items attach ABCD1234 ./paper.pdf --dry-run
zotero-cli items attach ABCD1234 ./paper.pdf
Get the indexed full text of an attachment item:
zotero-cli items fulltext ATTACH1234
zotero-cli items fulltext ATTACH1234 --output paper.txt
RSS Feed Query
List feed subscriptions and query a feed by date:
zotero-cli feeds list
zotero-cli feeds items 42 --date 2026-06 --limit 20
zotero-cli feeds items 42 --date 2026-01-01..2026-06-30 --include-undated
Export
Write a collection-scoped bibliography:
zotero-cli items export --format bibtex --collection COLL1234 --output references.bib
Print CSL JSON to stdout:
zotero-cli items export --format csljson --limit 10
Development
Set up the project:
uv sync --extra dev
Run the local checks:
uv run ruff check src tests
uv run mypy src
uv run pytest --cov=src
uv build
Useful project docs:
- DEVELOPMENT.md - development workflow and architecture rules
- CONTRIBUTING.md - contribution expectations
- CHANGELOG.md - release history
- SECURITY.md - security policy
- docs/CONFIGURATION.md - full configuration reference
License
This project is licensed under the MIT License.
Metadata
Release files for zotero 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zotero-0.2.6.tar.gz | 207.3 kB | With provenance | Details for zotero-0.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zotero-0.2.6-py3-none-any.whl | Python 3 | none | any | Details for zotero-0.2.6-py3-none-any.whl |
Total release size: 274.5 kB
Release files / zotero-0.2.6.tar.gz
| Download URL | zotero-0.2.6.tar.gz |
|---|---|
| Size | 207.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
529028b0d681c1581f0928ff97a6db8dc97463347d2644ad22685298bd0862c5
|
|
BLAKE2b-256 checksum How to use checksums |
8cdf899c91c2d717ae710aba6dfb2d73a51e28155dcf00d91cce0d33a35935e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.
Transparency logRelease files / zotero-0.2.6-py3-none-any.whl
| Download URL | zotero-0.2.6-py3-none-any.whl |
|---|---|
| Size | 67.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c10affb8148966e780801a3dce64796d5389b7e61a01886c7fe15cd0db2acf70
|
|
BLAKE2b-256 checksum How to use checksums |
baa1721df142b168e509ae76e662e337de332cceadc884382b17f43dd25d06b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.
Transparency logSecurity for zotero 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for zotero-0.2.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.