Attach a file (PDF, snapshot) to an item
zotero_attach_fileAttach a PDF or other file to an existing Zotero item by supplying the parent item key and either a download URL or a local path.
Instructions
Add a stored file attachment (e.g. a PDF full text) under an existing item. Give parent (the item key) and either url (Zoteus downloads it, then stores it) or path (a file on the machine running Zoteus). filename and content_type are inferred when omitted. Saves through the Zotero desktop app when one is reachable (Zotero 10+ local API; you may be asked once to allow Zoteus write access, choose "Always Allow"), and otherwise through the cloud Web API, which needs ZOTERO_API_KEY with file access and uses your Zotero file-storage quota. url works on every setup including a remote/hosted Zoteus that cannot see your desktop, so prefer it over path unless the file really is on the server. Returns the new attachment key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | URL to download the file from; works on remote/hosted servers. | |
| path | No | Filesystem path to the file, on the machine running Zoteus. | |
| title | No | Attachment title, e.g. "Full Text PDF". | |
| parent | Yes | Key of the parent item to attach the file to. | |
| filename | No | File name to store; inferred from path/url if omitted. | |
| library_id | No | Group library to attach in; forces the cloud path. | |
| content_type | No | MIME type; inferred from the extension if omitted (pdf -> application/pdf). | |
| library_type | No |