Skip to main content
Question

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

  • May 22, 2025
  • 1 reply
  • 14 views

Forum|alt.badge.img

I would like to show all file versions, with a view or download button.  Is there an API endpoint to generate the URL i need for this button?

1 reply

Forum|alt.badge.img

 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