Welcome to the new Box Support website. Check out all the details here on what’s changed.

Is there an API endpoint to generate a URL to download or view file versions?

Answered
New post

Comments

1 comment

  • mwiller

     You can get the download URL for a previous file version by calling the file download API endpoint and passing the file version ID to the "version" query parameter to specify which file version you want a download URL for.  The endpoint should return a 302 status code and have the download URL in the Location header of the response.  See an abbreviated example below:

     

    23:06 $ curl -v https://api.box.com/2.0/files/FILE_ID/content?version=FILE_VERSION_ID -H"Authorization: Bearer MY_ACCESS_TOKEN"
    
    > GET /2.0/files/FILE_ID/content?version=FILE_VERSION_ID HTTP/1.1
    > Host: api.box.com
    > User-Agent: curl/7.58.0
    > Accept: */*
    > Authorization: Bearer MY_ACCESS_TOKEN
    > 
    < HTTP/1.1 302 Found
    < Date: Fri, 16 Mar 2018 06:07:28 GMT
    < Content-Length: 0
    < Strict-Transport-Security: max-age=31536000
    < Cache-Control: no-cache, no-store
    < Location: https://dl3.boxcloud.com/d/1/...really long download URL.../download
    < Vary: Accept-Encoding
    < Age: 2
    < Connection: keep-alive
    0
    Comment actions Permalink

Please sign in to leave a comment.