How to download a file using SharePoint REST API?

The following document doesn't contain the downloading related information

Refer: https://msdn.microsoft.com/en-us/library/office/dn292553.aspx

Kindly provide your inputs for downloading a file from SharePoint REST API.

  • 1
    So what data did you get back when you called a One File endpoint? And what other related information did you expect? Commented Mar 14, 2017 at 13:27

2 Answers 2


You can set the binaryStringResponseBody to true to downstream a file from SharePoint.

var info = {
    url: appwebUrl + "/_api/SP.AppContextSite(@target)/web/GetFileByServerRelativeUrl('/sites/Test/Shared Documents/" + sourcefile.get_name() + "')/$value?@target='myhosturl'",

    binaryStringResponseBody: true,
    success: function (data) {
    error: function () { alert('error'); }


If you're facing any issue please follow the below link: http://www.techmikael.com/2013/07/how-to-copy-files-between-sites-using.html

  • Please mark this as the answer, if you're satisfied with the response.
    – Arut
    Commented Oct 26, 2017 at 11:52
  • To simplify the URL and assuming you're not going from the Add-In Web to the Hostweb but call SharePoint directly using an oAuth Bearer Token you could also just go for: /_api/web/GetFileByServerRelativeUrl('/sites/Test/Shared%20Documents/test.jpg')/$value Commented Dec 27, 2017 at 23:09

I personally prefer to pass this work to sharepoint. With the answer of Arut you can use the following path once you get the file endpoint http://spsite/_layouts/download.aspx?SourceUrl=http://spsite/Documents/sample.docx

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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