Get attachments on a company, contact, or deal

I’m not seeing an attachments array for CRM objects like the HubSpot company. Are attachments exposed on contact, company, or deal objects? Are there any plans to?

Hey @lynton,

Attachments are exposed via the engagements API. So if you were to use the GET Associated Engagements endpoint you will see an attachments array in each engagement object, which is populated with file IDs which you can get access to via this endpoint.

Let me know if you have any questions about that.

-Zack

@zwolfson @lynton
Were you guys able to circumvent this problem? I used the strategy mentioned, but the links for the attachments are broken, albeit present in 3 different properties.

Hi, @mathcee.

Could you describe the steps you’re taking and the behavior in greater detail?

For example, did you use this Engagements API endpoint to retrieve engagements on a CRM object, locate file IDs in various engagements’ attachments arrays, query this endpoint with the file IDs, and find that the URLs in the url fields led to 404 error pages?

Can you share examples?

Yes, I did precisely what you described.
What could I produce in the way of examples?

Hi, @mathcee.

If I have described your issue exactly, please confirm that your Hub ID ends with 7645 and then share the following:

  1. The ID of a CRM object you are pulling engagements from (contact, company, deal, or ticket).
  2. The ID of an engagement on the above object which has file IDs in the attachments array you are interested in.
  3. The IDs of the attachments you are trying to access.

Confirmed. That is indeed the end of my Hub ID.
Deal ID: 374693036
Engagement ID: 3815773955
Attachment ID: 19892487693

Hi, @mathcee.

Sincere apologies for the delayed response. For some reason, your response was filtered from my inbox.

Thank you for sharing that information. I found the file you referenced and replicated the behavior you’ve described.

File 19892487693 is "hidden": true, which prevents it from being accessed at public file URLs like https://cdn2.hubspot.net/hubfs/…7645/Your-file.pdf.
Per Derek’s first response to this Community post as well as @SwivelDev’s response to this other Community post, files which are uploaded externally directly to a deal or contact will be hidden by default.

At this time, it is not possible to change a file from "hidden": true to "hidden": false, or vice versa, as indicated in this article. I am sorry if this comes as an unwelcome surprise.

One way to prevent files from being hidden is to upload them to HubSpot’s file manager before attaching them to an engagement. See this screencast.