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.
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:
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).
Step 3. Get the attachment details: This is done using the CMS Files API. Specifically the GET /files/v3/files/{fileId} endpoint. See below: