Trashed child attachments returned by collection items endpoint although parent is not present

I am retrieving items from a group collection using the Zotero APIv3, for example:

https://api.zotero.org/groups/xxx/collections/xxx/items?format=json&include=data

The response includes child attachments that are currently in the trash and are no longer visible in the collection. At the same time, their parent items are not included in the API response.

For example, this attachment is returned:

{
"data": {
"key": "GXF4ZJDR",
"version": 2164,
"parentItem": "JTVDNJ7K",
"itemType": "attachment",
"linkMode": "linked_url",
"title": "Base URL",
"accessDate": "",
"url": "...",
"contentType": "",
"charset": "",
"tags": [],
"relations": {},
"dateAdded": "2023-08-25T17:54:30Z",
"dateModified": "2023-08-25T17:54:30Z",
"collections": []
}
}
The attachment has parentItem: "JTVDNJ7K", but the parent item is not present in the collection response. In the Zotero client, I can only find the attachment in the trash as a child item.

I would have expected one of the following behaviors:

1. Trashed child items are excluded from the collection endpoint, or
2. Child items are only returned if their parent item is also part of the response.

Adding `includeTrashed=0` does not appear to change this behavior.

Is this intentional? If so, is there a supported way to exclude trashed child attachments without emptying the trash or making a separate request to /items/trash and filtering the results client-side?
Sign In or Register to comment.