APIs & Integrations

MalteKupzok
Participant

Form Submission Files

SOLVE

Hi Everyone!

Is there currently a way how I could achive to retreive files which are stored in a contact property with an api call? 

The problem is this:
We get new contacts after clients submit a form. Within this form they also upload documents. These documents should be processed externally with an automation I am building. However when I get the contact properties which contain the files, I am only getting a signed url, which I cant use to download the documents. 

As far as I know, the files are also not accessible via the files api, because their origin is the submission form.

0 Upvotes
2 Accepted solutions
evaldas
Solution
Recognized Expert | Platinum Partner
Recognized Expert | Platinum Partner

Form Submission Files

SOLVE

Hi @MalteKupzok,

 

When setting up a file property, you can select whether the file is public or private. This ultimately controls the access for the file that was uploaded through the form

 

evaldas_0-1749135794658.png

I assume your file property is set to "Private" and by changing it to "Public", you should be able to retrieve a link that would allow accessing the file directly.

 

If you need to keep it private, then to access a file that was uploaded to a form, you will need to perform a few API calls and add some logic in between :

 

1) GET Contact and retrieve the value of the file property

 

2) The file property uploaded through a form will be a URL, so you will need to use some logic to extract the ID of that file

 

In this case it would be the number after "/signed-url-redirect/", the number "123456789"

 

https://api-na1.hubspot.com/form-integrations/v1/uploaded-files/signed-url-redirect/123456789?portalId=........etc....

 

3) Use the extracted ID to make a call to Get signed URL endpoint that will create a temporary link to publicly access the file 

 

Hope this helps!

✔️ Did this post help answer your query? Help the community by marking it as a solution.

View solution in original post

MalteKupzok
Solution
Participant

Form Submission Files

SOLVE

Hi everyone, I’ve found a working solution and wanted to share it here in case others face the same issue. This will work for private and non-private files.

 

The problem was that the file URLs returned in the contact properties are signed redirect links (e.g. /signed-url-redirect/:fileId?...), which can’t be directly downloaded via requests.get() or similar methods. They often return corrupted files (e.g. .bin) or incomplete content.

 

 

Solution:

 

 

Instead of using the redirect URLs directly, I used the HubSpot v3 Files API to programmatically request a proper signed download URL using the file ID.

 

Here’s how it works:

 

  1. Extract the file ID from the signed URL (after /signed-url-redirect/).

  2. Use this endpoint to get a fresh signed URL:

                GET https://api.hubapi.com/files/v3/files/{fileId}/signed-url

 

  1. Download the file from the signed URL using requests.get(..., stream=True), making sure to handle binary data and preserve the file extension based on headers or the URL.

 

 

 

Why this works:

 

 

The v3 Files API bypasses the redirect logic and gives you a direct, reliable download link that can be used in automations and server scripts. 

 

Thanks to the community for pointing me in the right direction!

View solution in original post

0 Upvotes
4 Replies 4
ELTidwell
Member

Form Submission Files

SOLVE

@MalteKupzok When a file is uploaded through a form, the contact property will only return a signed URL. That URL can be used to download the document, but it’s time-limited for security reasons, so you need to fetch it and process the file while the link is still valid.

These files don’t appear in the Files API because they’re stored differently, but the signed URL is the correct way to access them. A common approach is to have your automation call the contact property, grab the signed URL, immediately download the file contents, and then move it into your own storage or processing pipeline. 

0 Upvotes
MalteKupzok
Solution
Participant

Form Submission Files

SOLVE

Hi everyone, I’ve found a working solution and wanted to share it here in case others face the same issue. This will work for private and non-private files.

 

The problem was that the file URLs returned in the contact properties are signed redirect links (e.g. /signed-url-redirect/:fileId?...), which can’t be directly downloaded via requests.get() or similar methods. They often return corrupted files (e.g. .bin) or incomplete content.

 

 

Solution:

 

 

Instead of using the redirect URLs directly, I used the HubSpot v3 Files API to programmatically request a proper signed download URL using the file ID.

 

Here’s how it works:

 

  1. Extract the file ID from the signed URL (after /signed-url-redirect/).

  2. Use this endpoint to get a fresh signed URL:

                GET https://api.hubapi.com/files/v3/files/{fileId}/signed-url

 

  1. Download the file from the signed URL using requests.get(..., stream=True), making sure to handle binary data and preserve the file extension based on headers or the URL.

 

 

 

Why this works:

 

 

The v3 Files API bypasses the redirect logic and gives you a direct, reliable download link that can be used in automations and server scripts. 

 

Thanks to the community for pointing me in the right direction!

0 Upvotes
evaldas
Solution
Recognized Expert | Platinum Partner
Recognized Expert | Platinum Partner

Form Submission Files

SOLVE

Hi @MalteKupzok,

 

When setting up a file property, you can select whether the file is public or private. This ultimately controls the access for the file that was uploaded through the form

 

evaldas_0-1749135794658.png

I assume your file property is set to "Private" and by changing it to "Public", you should be able to retrieve a link that would allow accessing the file directly.

 

If you need to keep it private, then to access a file that was uploaded to a form, you will need to perform a few API calls and add some logic in between :

 

1) GET Contact and retrieve the value of the file property

 

2) The file property uploaded through a form will be a URL, so you will need to use some logic to extract the ID of that file

 

In this case it would be the number after "/signed-url-redirect/", the number "123456789"

 

https://api-na1.hubspot.com/form-integrations/v1/uploaded-files/signed-url-redirect/123456789?portalId=........etc....

 

3) Use the extracted ID to make a call to Get signed URL endpoint that will create a temporary link to publicly access the file 

 

Hope this helps!

✔️ Did this post help answer your query? Help the community by marking it as a solution.

MalteKupzok
Participant

Form Submission Files

SOLVE

Thank you for the reply! I extracted the file ID and I was able to download the file with a short script. However the pdf files or image files are corrupted. They dont contain any information. Screenshot 2025-06-10 at 10.56.24.png

The property rules allow everyone to view and edit the property. I also changed the file from being private to being available publicy. But still the files are corrupted.

Thank you for the help so far! 🙂

0 Upvotes