Source Code Bundles
Downloads one file from B2.
The response contains the following headers, which contain the same information they did when the file was uploaded:
The response also includes a header with the timestamp from when the upload began:
If the bucket containing the file is set to require authorization, then you must supply the account's auth token in the Authorization header.
Because errors can happen in network transmission, you should check the SHA1 of the data you receive against the SHA1 returned in the X-Bz-Content-Sha1 header.
Request HTTP Headers
An account authorization token, obtained from
which will return just part of the stored file.
If this is present, B2 will use it as the
value of the 'Content-Disposition' header, overriding any
'b2-content-disposition' specified when the file was uploaded.
The URL to use for downloading starts with the
As with normal API calls, the request information can either be posted as JSON, or put in the URL query parameters. Unlike the other API calls, the response is not JSON, but is the contents of the file.
Request HTTP Message Body Parameters
The file ID that was returned from b2_upload_file. It can also be found using b2_list_files or b2_list_file_versions.
GET /api/b2_download_file_by_id?fileId=4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0104 HTTP/1.1 User-Agent: curl/7.41.0 Host: f001.backblazeb2.com Authorization: 1_20100215141633_18d3a718d3a718d3a718d3a7_1d148b2427e9aff1364898aae20246802ec9733d
Response HTTP Status 200
The response headers include the Content-Type that was specified when the file was uploaded. They also include the X-Bz-FileName and X-Bz-Content-Sha1 headers, plus X-Bz-Info-* headers for any custom file info that was provided with the upload. The X-Bz-FileName uses percent-encoding, as if it were a URL parameter.
HTTP/1.1 200 OK Content-Length: 46 Content-Type: text/plain X-Bz-File-Id: 4_h4a48fe8875c6214145260818_f000000000000472a_d20140104_m032022_c001_v0000123_t0104 X-Bz-File-Name: typing-test.txt X-Bz-Content-Sha1: bae5ed658ab3546aee12f23f36392f35dba1ebdd X-Bz-Info-author: unknown The quick brown fox jumped over the lazy dog.
File not returned.
If possible the server will return a JSON error structure. Errors include: