papers-zotero
Async Rust client for the Zotero Web API v3.
Zotero is a personal research library manager for collecting, organizing, and citing research papers. This crate provides type-safe access to items, collections, tags, saved searches, and groups.
Quick start
use ;
async
Authentication
A Zotero API key is required. Create one at https://www.zotero.org/settings/keys.
use ZoteroClient;
// Explicit credentials
let client = new;
// Or from ZOTERO_USER_ID and ZOTERO_API_KEY env vars
let client = from_env.unwrap;
Examples
Searching items
let params = builder
.q
.item_type
.sort
.direction
.limit
.build;
let response = client.list_items.await?;
Single item by key
let item = client.get_item.await?;
println!;
Collections
use CollectionListParams;
let collections = client.list_collections.await?;
for coll in &collections.items
// Items in a specific collection
let items = client
.list_collection_items
.await?;
Tags
use TagListParams;
let tags = client.list_tags.await?;
for tag in &tags.items
Filtering by tag
let params = builder
.tag
.limit
.build;
let starred = client.list_items.await?;
Pagination
Zotero uses offset pagination with start and limit:
let page1 = client
.list_items
.await?;
let page2 = client
.list_items
.await?;
Caching
use DiskCache;
use Duration;
let cache = default_location.unwrap;
let client = new.with_cache;
API coverage
| Entity | List | Get |
|---|---|---|
| Items | list_items, list_top_items, list_trash_items, list_item_children, list_publication_items, list_collection_items, list_collection_top_items |
get_item |
| Collections | list_collections, list_top_collections, list_subcollections |
get_collection |
| Tags | list_tags, list_item_tags, list_items_tags, list_top_items_tags, list_trash_tags, list_collection_tags, list_collection_items_tags, list_collection_top_items_tags, list_publication_tags |
get_tag |
| Searches | list_searches |
get_search |
| Groups | list_groups |
-- |
| Key | -- | get_key_info |
-
Items — the primary entity: journal articles, books, conference papers, attachments, notes, and 30+ other types. Each item carries creators, tags, collections, and type-specific bibliographic fields (DOI, ISBN, abstract, etc.).
-
Collections — folders for organizing items into a tree hierarchy. Items can belong to multiple collections.
-
Tags — labels on items. Two types: user-created (type 0) and automatic/imported (type 1).
-
Saved Searches — stored search conditions that dynamically match items.
-
Groups — shared libraries accessible to multiple users.
Parameters
| Struct | Used by | Fields |
|---|---|---|
ItemListParams |
Item endpoints | q, qmode, tag, item_type, item_key, since, sort, direction, limit, start, format, include, style, include_trashed |
CollectionListParams |
Collection endpoints | sort, direction, limit, start |
TagListParams |
Tag endpoints | q, qmode, limit, start, sort, direction |
Responses
All list endpoints return PagedResponse<T> which combines:
items: Vec<T>— the JSON array bodytotal_results: Option<u64>— from theTotal-ResultsHTTP headerlast_modified_version: Option<u64>— from theLast-Modified-Versionheader
Single-entity endpoints (get_item, get_collection, get_search) return the entity directly.
Testing
Live tests require ZOTERO_USER_ID and ZOTERO_API_KEY environment variables.