APIs & Integrations

vandhemer
Participant

Get attachment from deal ID

Hi,

Is there a way to get the attachment file IDs from a deal with the API?

Thanks!
David

0 Upvotes
6 Replies 6
michaelruck
Member

Get attachment from deal ID

Hello,

is this still the case? the only reason I ask is I'm trying to access all the documents within a deal. Using the current method I have to get all of the engagements for a deal, then loop around those to get the attachment id, then make a separate call to get each document.

On top of this, if there are 100 records in the first engagement call, I have to make another call shifting the offset to get more engagements, then do the above all over again.

Surely there is a get /files/v1/files/associated/deal/[id]/paged?hapikey=happydays

type thing?

Thanks!

0 Upvotes
mathcee
Contributor

Get attachment from deal ID

@michaelruck 

Were you able to circumvent this problem? I used the strategy mentioned, but the links for the attachments are broken, albeit present in 3 different properties, and I needed those.

@Derek_Gervais 

Could you enlighten me as to why there are url and s3 properties on the attachments, but with broken links?

0 Upvotes
lucasverra
Participant

Get attachment from deal ID

Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Get attachment from deal ID

Hi @kremenetskyi,

All attachments to objects (deals, contacts, companies, etc.) are actually just note engagements with an included file. Pulling the associated engagements is currently the only way to get attached files. I can understand the use case you’re mentioning, though. If you have the inclination, I would encourage you to check out the Ideas Forum on the HubSpot Community. There, you can create a post including your use case that product and other customers can see.

0 Upvotes
vandhemer
Participant

Get attachment from deal ID

Hmm just replying to myself :smiley:

So I suppose that I need to use the “get_associated_engagements” endpoint:

Get Associated Engagements | Engagements API

GET /engagements/v1/engagements/associated/:objectType/:objectId/paged - Get engagements associated with another CRM object via the HubSpot API.

Filtering with the DEAL type + the deal ID.
Do you think that there would be a way to filter only engagements with a type that would be like “ATTACHMENT”

Thanks!
David

0 Upvotes
silicium
Member

Get attachment from deal ID

Hello

I’ve just found this old question.
I have pretty the same question.
Is it possible to get list of attachments from DEAL ID?

For now I do it like this:
Get all engagements using

Get Associated Engagements | Engagements API

GET /engagements/v1/engagements/associated/:objectType/:objectId/paged - Get engagements associated with another CRM object via the HubSpot API.


and after check if each engagement has attachments
and if has one or more, I do request for getting attachment info

But it is not really good way. I should do a lot of request.

Probably there will be some new API method for getting attachment list from DEAL (CONTACT, COMPANY) ID.
It will be great.

Thanks.

0 Upvotes