Download contents of a DriveItemVersion resource

Retrieve the contents of a specific version of a DriveItem.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Files.Read, Files.ReadWrite, Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All
Delegated (personal Microsoft account) Files.Read, Files.ReadWrite, Files.Read.All, Files.ReadWrite.All
Application Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All

HTTP request

GET /drives/{drive-id}/items/{item-id}/versions/{version-id}/content
GET /groups/{group-id}/drive/{item-id}/versions/{version-id}/content
GET /me/drive/items/{item-id}/versions/{version-id}/content
GET /sites/{site-id}/drive/items/{item-id}/versions/{version-id}/content
GET /users/{user-id}/drive/items/{item-id}/versions/{version-id}/content

Response

Returns a 302 Found response redirecting to a pre-authenticated download URL for the bytes of the file.

To download the contents of the file your application will need to follow the Location header in the response. Many HTTP client libraries will automatically follow the 302 redirection and start downloading the file immedately.

Pre-authenticated download URLs are only valid for a short period of time (a few minutes) and do not require an Authorization header to download.

Example

This example retrieves a version of a file in the current user's drive.

HTTP request

GET /me/drive/items/{item-id}/versions/{version-id}/content

Response

This returns a redirect to where the contents of the version can be downloaded.

HTTP/1.1 302 Found
Location: https://onedrive.com/34FF49D6...

Remarks

OneDrive does not preserve the complete metadata for previous versions of a file.

When your app retrieves the list of available versions for a file, a DriveItemVersion resource is returned that provides the available information about the specific version.