Skip to main content

Python SDK for Zotero debug-bridge

Project description

zotero-bridge

PyPI Python CI License

Python SDK for the Zotero debug-bridge — programmatically manage your Zotero library via HTTP.

Install

pip install zotero-bridge

Or from source:

git clone https://github.com/Xp-speit2018/zotero-bridge.git
cd zotero-bridge
pip install -e ".[dev]"

Quick start

from zotero_bridge import ZoteroBridge

bridge = ZoteroBridge()

# Lookup existing items
lookup = bridge.lookup("10.1109/DAC63849.2025.11132862", "DOI", include_attachments=True)

# Backward-compatible duplicate check
dup = bridge.check_duplicate("10.1109/DAC63849.2025.11132862", "DOI")

# Add by identifier (magic wand)
item = bridge.add_by_identifier("10.1109/DAC63849.2025.11132862", "DOI")

# Auto-fetch PDF
bridge.find_fulltext(item["itemID"])

# Add note + tag
bridge.add_note(item["itemID"], "Key insight: ...")
bridge.add_tag(item["itemID"], "to-read")

# Download PDF bytes
pdf = bridge.get_pdf_bytes(item["itemID"])

Configuration

Environment variables (optional):

Variable Default Description
ZOTERO_BRIDGE_URL http://localhost:23120 Debug-bridge proxy URL
ZOTERO_BRIDGE_TOKEN zotero-debug Bearer token
ZOTERO_LIBRARY_ID (empty) Library ID; empty = user library

Or a .env file (requires python-dotenv):

ZOTERO_BRIDGE_URL=http://localhost:23120
ZOTERO_BRIDGE_TOKEN=zotero-debug

CLI lookup

Look up existing Zotero items and print JSON:

zotero-lookup --doi "10.1109/DAC63849.2025.11132862" --attachments --notes
zotero-lookup --title "Attention Is All You Need" --first

CLI ingestion workflow

A ready-made pipeline that checks for duplicates, fetches metadata + PDF, creates DBLP-style venue collections, and aliases items into a project collection:

# Auto-derive venue from metadata
zotero-ingest --doi "10.1109/DAC63849.2025.11132862" --project "MyResearch"

# Or specify venue explicitly (still normalised to DBLP convention)
zotero-ingest --doi "10.1109/DAC63849.2025.11132862" --venue "ASPLOS" --project "MyResearch"

Note that metadata and pdf collection uses the built-in magic wand and Find Full Text functionality, which maybe paywalled or not depending on your network.

API overview

Items

Method Description
lookup(identifier, id_type, include_notes=False, include_attachments=False, first_only=False) Look up Zotero items by DOI / ISBN / arXiv / title
check_duplicate(identifier, id_type) Backward-compatible first-match duplicate check
add_by_identifier(identifier, id_type) Magic wand ingest
find_fulltext(item_id) Auto-download PDF
get_item(item_id) Retrieve metadata
delete_item(item_id) Trash an item
update_field(item_id, field, value) Update a single field
add_tag(item_id, tag) Add a tag
remove_tag(item_id, tag) Remove a tag

Notes

Method Description
add_note(item_id, note_text) Add a child note
get_notes(item_id) List child notes

Attachments

Method Description
get_attachments(item_id) List all attachments with paths
retrieve_pdf(item_id) Get PDF metadata
get_pdf_bytes(item_id) Download raw PDF bytes

Collections

Method Description
create_collection(name, parent_id) Create a collection
get_collections(parent_id) List collections
get_or_create_collection(name, parent_id) Idempotent creation
add_to_collection(item_id, collection_id) Alias / place item
remove_from_collection(item_id, collection_id) Remove from collection

Export

Method Description
export.item(item_id, format, options) Export a single item
export.items(item_ids, format, options) Export multiple items
export.collection(collection_id, format, options) Export a whole collection
export.library(format, options) Export the entire library
export.list_formats() List available export formats

Supported formats: better-bibtex, better-biblatex, bibtex, biblatex, ris, csl-json, csv, zotero-rdf, tei, cff.

# Better BibTeX with notes
bib = bridge.export.item(item_id, format="better-bibtex", options={"exportNotes": True})

# Full collection as RIS
ris = bridge.export.collection(collection_id, format="ris")

# Entire library
bib = bridge.export.library(format="better-bibtex")

DBLP venue naming

When the ingestion workflow auto-derives a venue name, it normalises to DBLP convention:

  • ISSTA 2023issta2023
  • ASPLOS 2025, Volume 1asplos2025-1
  • NeurIPS 2023, Volume 2neurips2023-2

A curated mapping of 50+ common venues + DBLP API fallback + local cache handles less common venues automatically.

Requirements

Releases

Version Date PyPI Notes
0.3.0 2026-05-19 zotero-bridge-0.3.0 Public lookup API and zotero-lookup CLI
0.2.1 2025-05-18 zotero-bridge-0.2.1 Fix PyPI project links
0.2.0 2025-05-18 zotero-bridge-0.2.0 Export support (BibTeX, RIS, CSL JSON, etc.)
0.1.0 2025-05-18 zotero-bridge-0.1.0 Initial release

Acknowledgements

This SDK is built on top of the Zotero debug-bridge extension by Emile Sonneveld / iris-advies.com, originally distributed as part of the zotero-better-bibtex test fixtures. The debug-bridge enables arbitrary JavaScript execution inside a running Zotero instance via an authenticated HTTP endpoint, which is the foundation of everything this SDK does.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zotero_bridge-0.3.0.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zotero_bridge-0.3.0-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file zotero_bridge-0.3.0.tar.gz.

File metadata

  • Download URL: zotero_bridge-0.3.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zotero_bridge-0.3.0.tar.gz
Algorithm Hash digest
SHA256 fa5d95961415235d33b42eeb8127fc72a6f19fea2a3840a6e6d089bf9d473b22
MD5 f4f0dfeca2b30d3a5d714c77ef7b214d
BLAKE2b-256 dcdb6ddccb20e82d0deb92da931abbf69e0f2b12a10056698c9fcceb3ba3e1fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for zotero_bridge-0.3.0.tar.gz:

Publisher: publish.yml on Xp-speit2018/zotero-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zotero_bridge-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: zotero_bridge-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zotero_bridge-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72aa21a1d5b0d0caa69b0e2ec8982c00b6fa2c5d6411d0bab002ed52b32e4e14
MD5 a23d68ab92d5a3d992169534faf3fb75
BLAKE2b-256 a16b328ef66b9ca2d7602e995901c5b7a828b5a5e5f421807edb22034669bcf0

See more details on using hashes here.

Provenance

The following attestation bundles were made for zotero_bridge-0.3.0-py3-none-any.whl:

Publisher: publish.yml on Xp-speit2018/zotero-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page