I am trying to extract a pdf from a deal file property.
I send the the value of the file id to n8n and patch it into the file browser url which is https://app-eu1.hubspot.com/api/filemanager/api/v2/files/{{file id value}}/signed-url-redirect?portalId={{portalID}}&response-content-disposition=attachment and try to download it with a http request.
I am stuck there - it does not get the file, I think it downloads the page itself. I’m just starting to get into using the API so there are a lot of variables that I might got wrong.
Might be authentification problem or might be a case of requesting in the wrong format or that Hubspot actually creates a temporary download url and the link above is kinde useless for API requests.
I am wondering if it is even possible to dowload the file directly or if I should just drop it? Any tips appreciated.
@CKol - We are missing some context here, but it seesm to me that you are close to what you want.
The general situation is that, wehn a file is uploaded/attached via email etc. that the value of the ‘file’ property is set to an opaque identifier, but that the UI resolves that doen intoo a URL that can be displayed or downloaded. Through the Files API, this is seen as a set of details on the file such as (from the docs)
The URLs enable access directly to the file (if the privacy settings permit this). My experience is that PDFs are properly recognized by the file system and presented as such through the UI. I’m not sure whether your n8n approach is strictly necessary - but as I said, there is some context missing.
"The reason your current approach downloads the page instead of the PDF is because:
a. Signed URL Redirect is browser-centric, not API-friendly.
b. Your request likely doesn’t follow the redirect properly or lacks authentication.
Use the HubSpot File Manager API v3 to fetch the file metadata for the deal file property, extract the URL field from the response, and then make a GET request to that URL (with an OAuth token if the file is private) to download the PDF, rather than using the signed-url-redirect endpoint, which returns an HTML page and is intended for browser downloads
I hope this will help you out. Please mark it as Solution Accepted and upvote to help another Community member.