I have a requirement where i have to download archived content from external system. However, salesforce does not allow to get archived content from REST API.

The way i can download the archived content is using servlet.shepherd url (/sfc/servlet.shepherd/document/download/0691g00000abcde). For this, I have to be logged in the system and then only i can download which is not possible when trying to retrieve content from external application.

So, I thought of creating a site in salesforce that can be accessed by any guest user. A vf page is associated with the site called TestVFPage.

<apex:page action="{!haveContent}" controller="SQX_TEST_APX">

The controller method is

public class SQX_TEST_APX {
    public PageReference haveContent(){
return new PageReference('/sfc/servlet.shepherd/document/download/0691g000000ABCDEF');

Using above code, I can download the content in incognito mode in browser. However, I want to get the content as api call from external system. I get the following response using POSTMAN,

   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


        function redirectOnLoad() {
if (this.SfdcApp && this.SfdcApp.projectOneNavigator) { SfdcApp.projectOneNavigator.handleRedirect('/sfc/servlet.shepherd/document/download/0691g000000dXzNAAU'); }  else 
if (window.location.replace){ 
} else {
window.location.href ='/sfc/servlet.shepherd/document/download/0691g000000dXzNAAU';



So, Is it possible to get archive content from external system as api calls (or sth similar).

I understand that unarchived content can be retrieved using REST calls. I want archived content and feed it to a system.


You might want to check this video explaining how to "Download Attachments & Files from Salesforce using NodeJs application"

The script uses jsforce to connect to salesforce and runs a query to download files.

Its about downloading attachments but you can adapt the query for ContentDocument with isArchived = true and other filters for your use case.

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.