# File API return "Internal error" when upload a 4 mb pdf

**URL:** <https://community.hubspot.com/t/file-api-return-internal-error-when-upload-a-4-mb-pdf/140306>\
**Category:** APIs & Integrations\
**Tags:** timeline-and-extensions-apis\
**Created:** [September 30, 2025, 3:08am UTC](https://community.hubspot.com/t/file-api-return-internal-error-when-upload-a-4-mb-pdf/140306 "2025-09-30T03:08:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abbyxia](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/abbyxia/32/73373_2.png) [@abbyxia](https://community.hubspot.com/u/abbyxia)\
**Post date:** [September 30, 2025, 3:08am UTC](https://community.hubspot.com/t/file-api-return-internal-error-when-upload-a-4-mb-pdf/140306/1 "2025-09-30T03:08:19Z")

</div>

Hi everyone,

I’m trying to upload a file to **HubSpot File Manager** using the **Files API** : Here is my endpoint:

POST [https://api.hubapi.com/files/v3/files](https://api.hubapi.com/files/v3/files)

When I upload a file **smaller than 1MB** , everything works fine. For example, here’s a successful request/response:

 ![157028i0F8F13338C33DAD2.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/5/b/5b51e89cb5302b9c656dabd477e88ea6cae15fbc.png)

Once we receive a successful response, we can add the file ID to the record.

However, when I try to upload a larger file (e.g., a **4.6MB PDF** ), the request fails with an error:

 ![157029i193A577267E25626.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/4/4/44029b3cbd439904dc011db1bd6824665a8877a6.png)

My Questions:

Is there a documented **file size limit** for this endpoint?  
Is there a different method required for uploading files larger than 1MB?

Has anyone else run into this limitation, and how did you solve it?

Thanks in advance for your help!

Aby

---

<div class="post-metadata">

**Author:** ![d-lupo](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/d-lupo/32/31044_2.png) [@d-lupo](https://community.hubspot.com/u/d-lupo)\
**Post date:** [September 30, 2025, 1:43pm UTC](https://community.hubspot.com/t/file-api-return-internal-error-when-upload-a-4-mb-pdf/140306/2 "2025-09-30T13:43:59Z")

</div>

Hi @abbyxia

I checked your issue and I’m not sure where the request format you used came from. According to the official documentation [( **Upload file – HubSpot Docs** )](https://developers.hubspot.com/docs/api-reference/files-files-v3/files/post-files-v3-files), you should be using **multipart/form-data**.

Currently, you’re sending raw JSON data, which oddly seems to work in some cases. Maybe due to an older specification that I might have missed.

Try with the following format, which follows the official API reference:

curl --request POST \  
--url [https://api.hubapi.com/files/v3/files](https://api.hubapi.com/files/v3/files) \  
--header ‘Authorization: Bearer \<token\>’ \  
--header ‘Content-Type: multipart/form-data’ \  
--form ‘folderId=\<string\>’ \  
--form ‘folderPath=\<string\>’ \  
--form ‘fileName=\<string\>’ \  
--form ‘charsetHunch=\<string\>’ \  
--form ‘options=\<string\>’ \  
--form file=@example-file

This format should be the correct and supported way to upload files.  
Let me know, if it works this way 😄

---

<div class="post-metadata">

**Author:** ![abbyxia](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/abbyxia/32/73373_2.png) [@abbyxia](https://community.hubspot.com/u/abbyxia)\
**Post date:** [September 30, 2025, 10:18pm UTC](https://community.hubspot.com/t/file-api-return-internal-error-when-upload-a-4-mb-pdf/140306/3 "2025-09-30T22:18:18Z")

</div>

Hi @d-lupo, thanks for your support.

I attempted to upload a file using a serverless function with the `"multipart/form-data"` content type, but the request returned a **415 Unsupported Media Type** error.

I also trie d to upload a file in the API developer tools, but got the server error again.

 ![157118iB032B9C480739FB3.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/2/d242be2c79f4299e24fa5c0576e192bbd720991c.png)

Any idea what might be going wrong?

thanks

Abby

---

<div class="post-metadata">

**Author:** ![d-lupo](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/d-lupo/32/31044_2.png) [@d-lupo](https://community.hubspot.com/u/d-lupo)\
**Post date:** [October 1, 2025, 9:38am UTC](https://community.hubspot.com/t/file-api-return-internal-error-when-upload-a-4-mb-pdf/140306/4 "2025-10-01T09:38:04Z")

</div>

Hi Abby,  
I tested it myself, and everything seems to be working seamlessly.

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/1/a/1aff55ba5274975e4eeb5c91be545dbc3fd9183e.png)

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/d/3/d386981c23a7fa901cc7d6ac1e7d681085c149ef.png)  
The 415 error indicates that there’s still an issue with the data format. Please make sure you’ve included the Content-Type: multipart/form-data header in your request.

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/f/f/ffdfeb2529c84bff78d5146819519dff7074b7e9.png)  
Hope that helps 🙂  
Dennis

---

<div class="post-metadata">

**Author:** ![JBrake](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jbrake/32/76513_2.png) [@JBrake](https://community.hubspot.com/u/JBrake)\
**Post date:** [November 18, 2025, 12:16am UTC](https://community.hubspot.com/t/file-api-return-internal-error-when-upload-a-4-mb-pdf/140306/5 "2025-11-18T00:16:30Z")

</div>

HI there,

The issue here is the file is being sent to a serverless function to upload. Serverless function payloads are limited to 6MB (undocumented as far as I can tell).  
If you were to upload a document directly via the files API you won’t hit that limit - documented file upload limits apply (e.g. via postman).  
You cannot upload directly to the files API from a browser as the endpoint requires a secret which should not be stored on the client.  
The options are:  
- Sending the document as a field in a form (in this case it wont work as we need the files ID),  
- or; sending the upload request from a proxy service, which in turn uploads the file via the files API as per usual.

Regards,

Jonathan
