Attached documents are documents and files which are uploaded associated to a instance, and they carry a instance id with them. Detached documents are documents/files uploaded from a standalone service, they do not have a valid instance id but use a fictious -1 instance id. So you can differentiate between attached and detached documents by the -1 instance id.