Add Files to Deal via API


Hi! 🙂


We have a multitude of programs to manage our contacts and their companies and deals and everything.
To make this work, we have a custom synchronizing tool that copies the data back and forth.
Now we want to create a PDF externally and send it using HubSpot. The file itself is deal-scoped.


So our requirements are:

  • we need access to these files via API, so the tool can do the job
  • we need to be able to access these files from the email
  • the files should preferably be sent as file, not as public link
  • it would be good to restrict access to the files in HubSpot, so not every employee can see every file

My developer account can not link Google Mail, so I can't test this quickly, but from I was told our options are:


  • adding the attachments to either deal or company - but that is not possible via API (or at least I could not find a documentation for the endpoint) and these files can only be added as a link to the email
  • adding the files to the marketing files, which works over the API (, but these files are "public" files and shouldn't be used for security relevant data, right?

Is there any other option? Or something I'm missing?


Thanks for your help!

2 Replies 2
Community Manager

@Teun , would be able to help out here 😀



Check out our Community Developer Blog
where we feature our Community driven developer podcast and how to content
Guide | Diamond Partner

Hi @SSchulz !


Right now, HubSpot only allows attachments for one-to-one sales emails, so you only have two alternatives.


1. You can include a link to a file in the e-mail, the requirement to make these files private make this quite hard, but you could try this with a signed url (haven't used this myself tho). You can read a bit more here about file URL's.

2. Store the files somewhere outside HubSpot and use the SMTP API to send an e-mail through HubSpot, which allows you to add an attachment to an e-mail. Downside is that you need the transactional email addon and that the e-mail can not be managed in HubSpot (you could create it and copy the HTML tho).


I think you should be able to add a file to a deal with the API if I read the docs correctly. In the Files API docs, they mention the Engagement API, but if I click on the relevant endpoint, it seems deprecated. So we might need some input from someone managing this API.

Did my answer solve your issue? Help the community by marking it as the solution.