Looking for best REST API to upload a file to a record with at least file size 100MB?

I have created custom REST API handles POST call, inserts both ContentVersion, ContentDocumentLink records (Base 64 content in request body) manually. But using custom API not able to upload(not able to test) file size more than 23 MB.

other way using with standard salesforce REST API, (/services/data/v35.0/chatter/feed-elements)issue is, It's not supporting Base 64 binary data conversion to normal format..

But in salesforce developer guide docs, mentioned that file size limit to upload REST API is 2 GB. (Copied same lines, links from the articles).

“maximum file size for uploads is 2 GB for ContentVersion objects”, “To upload a binary file up to 2 GB (including headers) ”, “Salesforce CRM Content Content and Libraries tabs in Salesforce Classic 2 GB 2 GB (including headers) when uploaded via Chatter REST API 2 GB (including headers) when uploaded via REST API ”




Let us know if you worked on the requirement “Upload file to record using REST API (file size should support atleast 100 MB)”

  • It would great if help on this, chatter API (Salesforce REST API) : /services/data/v35.0/chatter/feed-elements. accepts Base64 encoded binary data for upload file content. But it's not coverting or decoding back to normal format.. how it could be handle encoding & decoding file using thie standard REST API. – Mahesh Pasupuleti May 30 '18 at 11:49

You'll want to read Inputs and Binary File Uploads, but basically, you can't use base-64-encoded data, as far as I can tell. You could try setting Content-Transfer-Encoding to BASE64, but I'm not sure that's supported. That would look like this:

Content-Disposition: ...
Content-Type: ...
Content-Transfer-Encoding: BASE64


If that doesn't work, then presumably you'll need to use binary instead. Most languages include a way to post literal binary data to a data stream, so it shouldn't be too bad. However, I've never had a need to do this, so you may need to experiment a bit.

I hope this answer helps clarify what's going on.


I've been working on a related issue involving saving pdf files via Apex to the ContentVersion object. After a fair amount of trial and error, I was able to use Workbench to successfully insert a pdf - and actually am able to open the file and read it in Salesforce.

At least for the POST to /services/data/v39.0/sObjects/ContentVersion endpoint, the file definitely needs to be base64 encoded (which I did both in Apex code and in Workbench using cut & paste). Also, the docs below said that 50 MB is the maximum file size for ContentVersion.

The Force.com REST API sObject Resources (in Developer Preview) was actually very helpful here.

Reference: https://developer.salesforce.com/docs/api-explorer/sobject/ContentVersion/post-contentversion


Encoded file data. This field can't be set for links. The maximum file size you can upload via the SOAP API must be less than 50 MB. When a document is uploaded or downloaded via the API, it is converted to base64 and stored in VersionData. This conversion increases the document size by approximately 37%. You must account for the base64 conversion increase so that the file you plan to upload is less than 50 MB.

Interestingly, the above quotation is from the REST API Explorer. SF may want to update (or clarify) the verbiage about SOAP API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.