APIs & Integrations

MAdmin
Member

How to export deal atachments

Hi, 

We want to know the possible solutions for the data extraction/export of deal attachments from hubspot. As per this document we can export the deal attachments but I coud not find the relationship field/deal id on the response file. So please let me know how to get the deal id from the response file.

2 Replies 2
coldrickjack
Top Contributor

How to export deal atachments

Hey @MAdmin,

 

Deal attachments are associated to deals as Engagements (Notes) and unfortunately there isn't a single endpoint you can use to retrieve this data. Instead you need to perform a couple of steps. I've broken them down below.

 

Step 1. Get all associated engagements to the deal: This is done using the CRM Deals API. Specifically the GET
/crm/v3/objects/deals/{dealId}/associations/{toObjectType} endpoint. See screenshot of what I get back below notice the ID of the engagement(s) we will use this in the next step:

 

Screenshot 2022-09-28 at 12.02.35.png

 

Step 2. Get the attachment ID for the engagement: This is done using the CRM Engagements API. Specifically using 

the GET /crm/v3/objects/notes/{noteId} endpoint. See screenshot of sample response. Also important to include the "properties" query param as without it it will not return the attachment ID (based on my testing).

 

Screenshot 2022-09-28 at 12.04.55.png

Step 3. Get the attachment details: This is done using the CMS Files API. Specifically the GET
/files/v3/files/{fileId} endpoint. See below:

Screenshot 2022-09-28 at 12.06.40.png

I hope that helps.

0 Upvotes
MAdmin
Member

How to export deal atachments

Thanks @coldrickjack , will try this apprach 

0 Upvotes