Attach a local file
zotero_attach_fileAttach a local file to a Zotero item or create a standalone attachment. Choose linked mode to store just the path, or imported mode to copy the file into Zotero for syncing.
Instructions
Attach a file from disk to a Zotero item, or add it as a standalone attachment. mode="linked" (default) records the path only: instant for any file size, but the file must stay put and the attachment does not sync to zotero.org. mode="imported" copies the file into Zotero's storage, so it syncs and survives the original being moved. Group libraries accept only "imported", since a local path means nothing to other members. filePath must be absolute. Pass parentItemKey to hang the file off an existing reference; omit it for a standalone attachment, optionally filed into collections.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | "linked" stores the path only (instant, no copy, no sync); "imported" copies the file into Zotero (syncs). | linked |
| tags | No | Tags to attach. | |
| title | No | Attachment title shown in Zotero. Defaults to the file name. | |
| groupId | No | Group library ID. Omit for the personal library ("My Library"), which is what almost every request wants. Group IDs come from zotero_list_libraries. | |
| filePath | Yes | Absolute path to the file on this machine, e.g. "/Users/me/papers/smith-2024.pdf". | |
| collections | No | Collections to file the attachment into. Only valid for standalone attachments (no parentItemKey). | |
| parentItemKey | No | Item this file belongs to. Omit to create a standalone attachment item. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | ||
| bytes | Yes | ||
| filePath | Yes | ||
| uploaded | Yes | True when file bytes were transferred; false for linked files and deduplicated uploads. | |
| attachment | Yes | ||
| contentType | Yes | ||
| attachmentKey | Yes |