Retrieve Files

Once a file has been uploaded you can use the retrieve method to get file metadata or the file itself.

Syntax

Note: Security policies and signatures should be included as options when the client is initialized with your API key if your account has security enabled.

<script src="https://static.filestackapi.com/v3/filestack-0.4.1.js"></script>
<script type="text/javascript">
  var client = filestack.init('yourApiKey', { policy: 'policy', signature: 'signature' });
  client.retrieve(handle, options);
</script>

Example Retrieve Code

Get the Metadata for an existing Filestack Handle
var filestackHandle = 'H4Y1If7sT5CptunlLypo' var log = function(result) { console.log(JSON.stringify(result)) } client.retrieve(filestackHandle, { metadata: true }).then(log)

Parameters

Client Initialization Options
An optional dictionary of key-value pairs that influence the Filestack client.
Security
Object
{ policy: POLICY, signature: SIGNATURE }

If you have security enabled, you will need to initialize the client with a valid Filestack policy and signature in order to perform the requested call. This allows you to select who can and cannot perform certain actions on your site. Read more about security and how to generate policies and signatures

handle
the file to retrieve
Handle
String
'handle'

The Filestack handle for the file to fetch or retrieve data about.

options
An optional dictionary of key-value pairs that specify how the read function behaves
Metadata
Boolean
{ metadata: true }

Specifies that you want the metadata of the file returned as a JSON object.

Head
Boolean
{ head: true }

Specify that you would like to perform a "head" request instead of the standard "get".

Download
Boolean
{ dl: true }

Specify that you would like the entire file to be returned.

Extension
String
{ extensions: '.jpg' }

Add an extension to the handle when making the "get" request.