I have some data on the ContentVersion object. I want to update the field VersionData in the ContentVersion object using REST API. Here is some more detail about the API.

Endpoint: https://mysite.my.salesforce.com/services/data/v51.0/sobjects/ContentVersion/ID


{ "Title": "Update TEST", 
 "ReasonForChange":"Marketing materials updated",
 "PathOnClient" : "Q1 Sales Brochure.pdf", 
"versionData":"[...]" }

Please help me out.

  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Sep 12, 2022 at 15:37
  • By definition, ContentVersion is an instance of each file version so it can't be updated, only created as a new version
    – cropredy
    Sep 12, 2022 at 18:18

1 Answer 1


As discussed in this SFSE link, It seems ContentVersion can't be updated.

But you can create a new ContentVersion and attach to the same ContentDocument as below with the ContentVersion API.

URL - /services/data/vXX.0/sobjects/ContentVersion

Method - POST

Body :

    "ContentDocumentId" : "069.....",
    "PathOnClient" : "sfdclogo.jpg",
    "ReasonForChange" : "New Version",
    "VersionData": "/9j/4AAQSkZJRgABAQAAAQABAAD/4gIcSUNDX1BST0ZJ...//The content or body of the file (Base64 encoded) 

Reference - https://www.linkedin.com/pulse/how-upload-document-salesforce-files-using-rest-api-subhajit-goswami

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .