NAV Navbar
  • Introduction
  • Authentication
  • Installation
  • Initialization
  • Security
  • Upload
  • Delete
  • Download
  • Overwrite
  • Get Content
  • Get MetaData
  • Zip
  • URL Screenshot
  • Transformations
  • Audio/Video Conversion
  • Filetype Conversions
  • Tags
  • Safe-for-Work (SFW)
  • Introduction

    The Filestack SDKs allow developers to easily integrate the Filestack API and content management system into existing web or mobile applications. Filestack provides powerful APIs to upload, transform, store, and deliver files to accelerate site speed and performance.

    # GLOSSARY
    
    FILELINK - An object containing the properties of your file after a successful upload //
    
    FILE_HANDLE - A random hash generated on upload to identify a specific file that is returned in the FILELINK object // https://cdn.filestackcontent.com/vA9vFnjRVGmEbNPy3beQ where vA9vFnjRVGmEbNPy3beQ is the File Handle
    
    API_KEY - An assigned code used by our severs to identify your account and instantiate the Filestack client // AQKknKwJRDmnP5eL5tSTAz
    
    APP_SECRET - A string that can be found in the Security section of the developer portal under App Secret //
    
    EXTERNAL_URL - Any external URL which points to a file that can be used in our system // https://www.exampleurl.com/an_external_image.jpg || https://upload.wikimedia.org/wikipedia/commons/b/b5/'.'Op.14%2C_Scherzo_No.2_in_C_minor_for_piano%2C_C._Schumann.ogg
    
    STORAGE_OPTION - The configured storage option that has be set in the developer portal //  S3, Azure, Backspace, Dropbox or GoogleCloud
    
    POLICY - A string defining what actions can be taken on a file uploaded with security enabled
    
    SIGNATURE  -  An encoded string required for files uploaded with security enabled and requires APP_SECRET
    

    Authentication

    You’ll need an API Key to get started with Filestack. If you don’t have one, you can sign-up for a free account by clicking the button below:

    Get API Key

    Once you have your API key, hold onto it. You’ll be using it to initiate file uploading with your SDK of choice.

    Installation

    We offer installation for:

    Please select a language to the right for installation instructions.

    Use cURL and our REST API with any filelink or handle for uploading and retrieving files from your configured storage option.
    
    # Install filestack with pip
    
    pip install filestack-python
    
    # or directly from GitHub
    
    pip install git+https://github.com/filestack/filestack-python.git
    
    # Add this line to your application's Gemfile:
    gem 'filestack'
    
    # And then execute:
    bundle
    
    # Or install it yourself as:
    gem install filestack
    
    <?php
    
        /* Install ``filestack`` with composer, either run */
    
        $ composer require --prefer-dist filestack/filestack-php
    
        /* or add */
    
        "filestack/filestack-php": ">=1.1.9"
    
        /* or download from GitHub */
    
        "https://github.com/filestack/filestack-php.git"
    
    ?>
    
    // Add to your build.gradle as a compile dependency
    // Check version at https://bintray.com/filestack/maven/filestack-java
    compile 'com.filestack:filestack-java:x.y.z'
    

    Initialization

    The Filestack SDKs are intialized through a main client, which can then be used to upload files, transform existing URLs, create zip files, and more.

    from filestack import Client, Filelink
    
    client = Client("<API_KEY>")
    
    # if you already have a handle, you can initialize a Filelink
    filelink = Filelink("YOUR_HANDLE", apikey="API_KEY")
    
    require 'filestack'
    
    client = FilestackClient.new('API_KEY');
    
    # if you already have a handle, you can initialize a Filelink
    filelink = FilestackFilelink.new("YOUR_HANDLE", apikey: "API_KEY")
    
    <?php
    use Filestack\FilestackClient;
    
    $client = new FilestackClient('API_KEY');
    
    // Create a client to make new uploads or perform external transformations
    FilestackClient client = new FilestackClient("API_KEY");
    // Or with security enabled
    client = new FilestackClient("API_KEY", security);
    
    // Create a FileLink if you already have a file handle
    FileLink fileLink = new FileLink("API_KEY", "FILE_HANDLE");
    // Or with security enabled
    fileLink = new FileLink("API_KEY", "FILE_HANDLE", security);
    

    Security

    Security is passed into the client upon initialization, and each SDK offers a model or function to create a Filestack Security object. Please see Filestack's documentation for creating security policies.

    >>> curl -X GET "https://www.filestackapi.com/api/file/FILE_HANDLE?signature=YOUR_SECURITY_SIGNATURE&policy=YOUR_SECURITY_POLICY"
    
    # OR
    
    >>> curl -X POST -d "https://www.filestackapi.com/api/file/FILE_HANDLE?policy=YOUR_SECURITY_POLICY&signature=YOUR_SECURITY_SIGNATURE"
    
    from filestack import Client, security
    
    # a policy requires at least an expiry
    policy = {'expiry': 56589012, 'call': ['read', 'store', 'pick']}
    sec = security(policy, 'APP_SECRET')
    
    client =  Client('API_KEY', security=sec)
    
    require 'filestack'
    
    # expiry is automatically set for one hour
    security = FilestackSecurity.new('APP_SECRET', options: {call: %w[read store pick]})
    client = FilestackClient.new('API_KEY', security: security)
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\FilestackSecurity;
    
    $security = new FilestackSecurity('APP_SECRET');
    $client = new FilestackClient($test_api_key, $security);
    
    // To create a security object using your app secret
    // This creates a new policy and signature pair
    // BACKEND ONLY, DO NOT INCLUDE YOUR APP SECRET IN CLIENT CODE
    
    // 7 day expiry
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(new Date());
    calendar.add(Calendar.DATE, 7);
    Date expiry = calendar.getTime();
    
    Policy policy = new Policy.Builder()
            .expiry(expiry.getTime())
            .addCall("read")
            .addCall("write")
            .build();
    
    Security security = Security.createNew(policy, "APP_SECRET");
    
    // You can get the encoded policy and signature from the security object
    // These could be sent from a backend to a client
    String encodePolicy = security.getPolicy();
    String signature = security.getSignature();
    
    // To create a security object using an existing policy and signature pair
    // For client code or cases where you don't want to include your app secret
    Security security = Security.fromExisting("ENCODED_POLICY", "SIGNATURE");
    

    Upload

    You can upload a file through the client from your local file system or through an external URL, which returns a Filelink object upon success. Filelink objects can be used to get the URL, metadata, and perform a variety of file operations. If you have Filestack Intelligent Ingestion enabled, the SDKs will use it by default. To disable this behavior, you can pass in a boolean to the upload operation.

    >>> curl -X POST -F fileUpload=@filename.txt "https://www.filestackapi.com/api/store/YOUR_STORAGE_OPTION?key=API_KEY"
    
    # OR
    
    >>> curl -X POST -d url="YOUR_FILE_URL" "https://www.filestackapi.com/api/store/YOUR_STORAGE_OPTION?key=API_KEY"
    
    # OR
    
    >>> curl  -X POST  -d  url="YOUR_FILE_URL"  "https://www.filestackapi.com/api/store/YOUR_STORAGE_OPTION?key=API_KEY&path=/myfiles/1234.png&mimetype=image/png"
    
    from filestack import Client
    
    client = Client("<API_KEY>")
    filelink = client.upload(filepath='/path/to/file')
    
    # to use different storage:
    
    client = FilestackClient.new('API_KEY', storage='dropbox')
    filelink = client.upload(filepath='/path/to/file', params={'container': 'my-container'})
    
    # to use an external URL:
    
    filelink = client.upload(external_url='https://www.example.com')
    
    # to disable intelligent ingestion:
    
    filelink = client.upload(filepath='/path/to/file', intelligent=False)
    
    
    require 'filestack'
    
    client = FilestackClient.new('API_KEY')
    filelink = client.upload(filepath: '/path/to/file')
    
    # to use different storage and upload options
    client = FilestackClient.new('API_KEY')
    filelink = client.upload(filepath: '/path/to/file', storage: 'dropbox', options: {'container' => 'my-container'})
    
    # to use an external URL:
    
    filelink = client.upload(external_url: 'https://www.example.com')
    
    # to disable intelligent ingestion:
    
    filelink = client.upload(filepath: '/path/to/file', intelligent: false)
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\Filelink;
    
    $client = new FilestackClient("API_KEY");
    
    $filelink = $client->upload('/path/to/file/foo.jpg');
    
    # OR
    
    $filelink = $client->uploadUrl('https://some-domain.com/some-image.jpg');
    
    # use Intelligent Ingestion
    
    $filelink = $client->upload($test_filepath, ['intelligent' => true]);
    
    // Configure (optional) storage settings
    UploadOptions options = new UploadOptions.Builder()
            .container("my-bucket")
            .path("/path/in/container/")
            .build();
    
    // Synchronous
    try {
        FileLink fileLink = client.upload("/path/to/file/foo.ext", options);
    } catch (FilestackException | IOException e) {
        // Handle error...
    }
    
    // Asynchronous
    client.uploadAsync("/path/to/file/foo.ext", options).subscribe(new SingleObserver<FileLink>() {
        @Override
        public void onSubscribe(@NonNull Disposable d) {
    
        }
    
        @Override
        public void onSuccess(@NonNull FileLink fileLink) {
    
        }
    
        @Override
        public void onError(@NonNull Throwable e) {
    
        }
    });
    

    Delete

    Note: This feature requires security to be enabled on your account. To use security on your account, login to your developer portal, go to the App Secret section under the Security tab, and click "Use Security"

    You may delete any file you have uploaded, either through a Filelink returned from the client or one you have initialized yourself. This returns a response of success or failure.

    >>> curl -X DELETE 'https://www.filestackapi.com/api/file/FILE_HANDLE?key=API_KEY&policy=POLICY=&signature=SIGNATURE'
    
    # OR
    
    >>> curl -X POST "https://www.filestackapi.com/api/file/FILE_HANDLE/remove?key=API_KEY&policy=POLICY=&signature=SIGNATURE"
    
    # use the app secret - LEAST SECURE
    
    >>> curl -u "app:APP_SECRET" -X DELETE 'https://www.filestackapi.com/api/file/FILE_HANDLE?key=API_KEY'
    
    # use a base64 encoded app secret
    
    >>> curl -H "Authorization: Basic BASE_64_ENCODED_APP_SECRET" -X DELETE 'https://www.filestackapi.com/api/file/FILE_HANDLE?key=API_KEY'
    
    from filestack import Client, security
    
    # a policy requires at least an expiry
    policy = {'expiry': 56589012}
    sec = security(policy, 'APP_SECRET')
    
    client =  Client('API_KEY', security=sec)
    filelink = client.upload(filepath='/path/to/file/foo.txt')
    response = filelink.delete()
    
    require 'filestack'
    
    # expiry is automatically set for one hour
    security = FilestackSecurity.new('APP_SECRET', options: {call: %w[read store pick]})
    client = FilestackClient.new('API_KEY', security: security)
    filelink = client.upload(filepath: '/path/to/file/foo.txt')
    
    response = filelink.delete()
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\FilestackSecurity;
    use Filestack\Filelink;
    use Filestack\FilestackException;
    
    $security = new FilestackSecurity('APP_SECRET');
    
    $filelink = new Filelink('FILE_HANDLE',
        $security);
    
    $result = $filelink->delete();
    
    # OR
    
    $client = new FilestackClient('API_KEY', $security);
    $client->delete('FILE_HANDLE');
    
    // Synchronous
    try {
        fileLink.delete();
    } catch (FilestackException | IOException e) {
        // Handle error...
    }
    
    // Asynchronous
    fileLink.deleteAsync().subscribe(new CompletableObserver() {
        @Override
        public void onSubscribe(@NonNull Disposable d) {
    
        }
    
        @Override
        public void onComplete() {
    
        }
    
        @Override
        public void onError(@NonNull Throwable e) {
    
        }
    });
    

    Download

    You can download any Filelink to your local system by calling this function and passing in the local destination for the file.

    >>> curl -i -X HEAD "https://www.filestackapi.com/api/file/FILE_HANDLE?dl=true"
    
    from filestack import Client
    
    client =  Client('API_KEY', security=sec)
    filelink = client.upload(filepath='/path/to/file')
    # if successful, returns size of downloaded file in bytes
    response = filelink.download('path/to/file')
    
    require 'filestack'
    
    client = FilestackClient.new('API_KEY')
    filelink = client.upload(filepath: '/path/to/file')
    # if successful, returns size of downloaded file in bytes
    response = filelink.download('path/to/file')
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\Filelink;
    use Filestack\FilestackException;
    
    $filelink = new Filelink('FILE_HANDLE');
    
    $result = $filelink->download('/path/to/destination');
    
    # OR
    
    $client = new FilestackClient('API_KEY');
    $result = $client->download('FILE_HANDLE', '/path/to/destination');
    
    # OR
    
    $result = $client->download('https://somedomain.com/somefile', '/path/to/destination');
    
    // Synchronous
    try {
        File file = fileLink.download("/path/to/directory/");
    } catch (FilestackException | IOException e) {
        // Handle error...
    }
    
    // Asynchronous
    fileLink.downloadAsync("/path/to/directory/").subscribe(new SingleObserver<File>() {
        @Override
        public void onSubscribe(@NonNull Disposable d) {
    
        }
    
        @Override
        public void onSuccess(@NonNull File file) {
    
        }
    
        @Override
        public void onError(@NonNull Throwable e) {
    
        }
    });
    

    Overwrite

    Note: This feature requires security to be enabled on your account. To use security on your account, login to your developer portal, go to the App Secret section under the Security tab, and click "Use Security"

    You may overwrite any Filelink by supplying a new file. The Filehandle will remain the same.

    >>> curl -X POST -d @filename.txt --header "Content-Type:text/plain" "https://www.filestackapi.com/api/file/FILE_HANDLE?policy=YOUR_SECURITY_POLICY&signature=YOUR_SECURITY_SIGNATURE"
    
    # OR
    
    >>> curl -X POST -d "url=EXTERNAL_URL"  "https://www.filestackapi.com/api/file/FILE_HANDLE?policy=YOUR_SECURITY_POLICY&signature=YOUR_SECURITY_SIGNATURE"
    
    # OR
    
    >>> curl -u "app:APP_SECRET" -X POST -d @filename.txt --header "Content-Type:text/plain" "https://www.filestackapi.com/api/file/FILE_HANDLE?key=YOUR_SECRET_KEY"
    
    # OR
    
    >>> curl -u "app:APP_SECRET" -X POST -d "url=EXTERNAL_URL" "https://www.filestackapi.com/api/file/FILE_HANDLE?key=YOUR_SECRET_KEY"
    
    from filestack import Client, security
    
    # a policy requires at least an expiry
    policy = {'expiry': 56589012}
    sec = security(policy, 'APP_SECRET')
    
    client =  Client('API_KEY', security=sec)
    
    require 'filestack'
    
    # expiry is automatically set for one hour
    security = FilestackSecurity.new('APP_SECRET', options: {call: %w[read store pick]})
    client = FilestackClient.new('API_KEY', security: security)
    filelink.overwrite('/path/to/new/file/foo.txt')
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\FilestackSecurity;
    use Filestack\Filelink;
    use Filestack\FilestackException;
    
    $security = new FilestackSecurity('APP_SECRET');
    
    $filelink = new Filelink('FILE_HANDLE', $security);
    
    // overwrite remote file with local file
    $result = $filelink->overwrite('/path/to/file/foo.txt');
    
    # OR
    
    $client = new FilestackClient('API_KEY', $security);
    $result = $client->overwrite('/path/to/file', 'FILE_HANDLE');
    
    // Synchronous
    try {
        fileLink.overwrite("/path/to/file.ext");
    } catch (FilestackException | IOException e) {
        // Handle error...
    }
    
    // Asynchronous
    fileLink.overwriteAsync("/path/to/file.ext").subscribe(new CompletableObserver() {
        @Override
        public void onSubscribe(@NonNull Disposable d) {
    
        }
    
        @Override
        public void onComplete() {
    
        }
    
        @Override
        public void onError(@NonNull Throwable e) {
    
        }
    });
    

    Get Content

    This returns the byte content of a Filelink.

    >>> curl -X GET "YOUR_FILE_LINK/metadata?size=true"
    
    # OR
    
    >>> curl -i -X HEAD "YOUR_FILE_LINK"
    
    from filestack import Client
    
    client =  Client('API_KEY')
    filelink = client.upload(filepath='/path/to/file/foo.jpg')
    byte_content = filelink.get_content()
    
    require 'filestack'
    
    client = FilestackClient.new('API_KEY')
    filelink = client.upload(filepath: '/path/to/file/foo.jpg')
    byte_content = filelink.get_content()
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\Filelink;
    use Filestack\FilestackException;
    
    $filelink = new Filelink('FILE_HANDLE');
    
    $content = $filelink->getContent();
    
    # OR
    
    $client = new FilestackClient('API_KEY');
    
    $content = $client->getContent('FILE_HANDLE');
    
    // Synchronous
    try {
        byte[] bytes = fileLink.getContent();
    } catch (FilestackException | IOException e) {
        // Handle error...
    }
    
    // Asynchronous
    fileLink.getContentAsync().subscribe(new SingleObserver<byte[]>() {
        @Override
        public void onSubscribe(@NonNull Disposable d) {
    
        }
    
        @Override
        public void onSuccess(@NonNull byte[] bytes) {
    
        }
    
        @Override
        public void onError(@NonNull Throwable e) {
    
        }
    });
    

    Get MetaData

    Metadata provides certain information about a Filehandle, and you can specify which pieces of information you will receive back by passing in optional parameters. Read more on how to extract metadata from files.

    >>> curl -X GET "https://www.filestackapi.com/api/file/FILE_HANDLE/metadata"
    
    # OR
    
    >>> curl -X GET "https://www.filestackapi.com/api/file/FILE_HANDLE/metadata?filename=true"
    
    from filestack import Client
    
    client =  Client('API_KEY')
    filelink = client.upload(filepath='/path/to/file/foo.jpg')
    metadata = filelink.get_metadata()
    # or define specific metadata to receive
    metadata = filelink.get_metadata({'filename': true})
    
    
    require 'filestack'
    
    client = FilestackClient.new('API_KEY')
    filelink = client.upload(filepath: '/path/to/file/foo.jpg')
    metadata = filelink.metadata()
    # or
    metadata = filelink.metadata({'filename': true})
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\Filelink;
    use Filestack\FilestackException;
    
    $filelink = new Filelink('FILE_HANDLE');
    
    $metadata = $filelink->getMetaData();
    
    # OR
    
    $client = new FilestackClient('API_KEY');
    
    $metadata = $client->getMetaData($filelink->handle, $fields);
    
    // Not implemented in Java SDK yet
    

    Zip

    You can export a zip file through the client, using an array of Filestack handles, URLs or a combination of both.

    >>> curl -X GET "https://process.filestackapi.com/zip/[ARRAY_OF_HANDLES_OR_URLS]"
    
    # OR
    
    >>> curl -X GET "https://process.filestackapi.com/API_KEY/zip/[ARRAY_OF_HANDLES_OR_URLS]"
    
    # OR
    
    >>> curl -X POST -g "https://process.filestackapi.com/API_KEY/zip/store=container:YOUR_CONTAINER,location:YOUR_STORAGE_LOCATION,region:YOUR_STORAGE_REGION,filename:my_zip_file.zip/[ARRAY_OF_HANDLES_OR_URLS]"
    
    from filestack import Client
    
    client = Client("<API_KEY>")
    client.zip('/path/to/file/destination', ['files'])
    
    require 'filestack'
    
    client = FilestackClient.new('API_KEY')
    client.zip('/path/to/file/destination', ['files'])
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\Filelink;
    use Filestack\FilestackException;
    
    $client = new FilestackClient('API_KEY');
    
    $sources = [
      'https://d1wtqaffaaj63z.cloudfront.net/images/20150617_143146.jpg',
      $this->test_file_handle
    ];
    
    $store_options = ['filename' => 'foo.png'];
    $filelink = $client->zip($sources);
    
    // Not implemented in Java SDK yet
    

    URL Screenshot

    The URL screenshot provides an image "snapshot" of a provided URL. This returns a transformation object that you can then use or store as a new Filelink. Read more about the parameters you can pass in to create a URL screenshot.

    >>> curl -X GET "https://process.filestackapi.com/API_KEY/urlscreenshot/EXTERNAL_URL"
    
    from filestack import Client
    
    client = Client("<API_KEY>")
    # returns a Transform object
    screenshot = client.url_screenshot('https://www.example.com', width=100, height=100, agent="desktop")
    filelink = screenshot.store()
    
    require 'filestack'
    
    client = FilestackClient.new('API_KEY')
    # returns a transform object
    # (only works on external URLs)
    transform = client.transform_external('https://www.example.com', width: 100, height:100, agent: "desktop")
    new_filelink = transform.urlscreenshot.store()
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\FilestackException;
    
    $url = 'https://en.wikipedia.org/wiki/Main_Page';
    
    $client = new FilestackClient('API_KEY');
    $filelink = $client->screenshot($url);
    
    # With Options
    $store_options = ['filename' => 'myscreenshot_file.png'];
    $agent = 'mobile';
    $mode = 'window';
    $width = 102400;
    $height = 768;
    $delay = 2000;  // 2 seconds
    
    $filelink = $client->screenshot($url, $store_options, $agent,
                                    $mode, $width, $height, $delay);
    
    // Configure task
    UrlScreenshotTask screenshotTask = new UrlScreenshotTask.Builder()
            .agent("desktop")
            .mode("window")
            .width(1280)
            .height(800)
            .delay(3000)
            .build();
    
    // Create transform
    ImageTransform screenshotTransform = client
            .imageTransform("https://example.com")
            .addTask(screenshotTask);
    

    Transformations

    Transformations can be chained together to create Transform objects, which can then be used to retrieve and store transformed URLs. You can find a list of all options and parameters in Filestack's image transformation documentation. You can download and store transformations from either Filehandles or external URLs.

    Filestack offers the following transformations:

    • resize
    • crop
    • rotate
    • flip
    • flop
    • watermark
    • detect_faces
    • crop_faces
    • pixelate_faces
    • round_corners
    • vignette
    • polaroid
    • torn_edges
    • shadow
    • circle
    • border
    • sharpen
    • blur
    • monochrome
    • blackwhite
    • sepia
    • pixelate
    • oil_paint
    • negative
    • modulate
    • partial_pixelate
    • partial_blur
    • collage
    • upscale
    • enhance
    • redeye
    • ascii
    • filetype_conversion
    • quality
    >>> curl -X GET "https://process.filestackapi.com/resize=width:750/FILE_HANDLE"
    
    # OR
    
    >>> curl -X GET "https://process.filestackapi.com/API_KEY/crop_faces=faces:1,buffer:200,w:300/circle/URL_TO_TRANSFORM"
    
    from filestack import Client
    
    client = Client("<API_KEY>")
    filelink = client.upload(filepath='/path/to/file/foo.jpg')
    transform = filelink.resize(width=100, height=100).rotate(deg=90)
    
    new_filelink = transform.store()
    
    require 'filestack'
    
    client = FilestackClient.new('API_KEY')
    filelink = client.upload(filepath: '/path/to/file/foo.jpg')
    transform = filelink.transform.resize(width: 100, height: 100).rotate(deg: 90)
    
    puts transform.url
    new_filelink = transform.store
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\Filelink;
    use Filestack\FilestackException;
    
    $filelink = new Filelink('FILE_HANDLE');
    
    $width = 100;
    $height = 100;
    $fit='scale';
    $align='left';
    
    $filelink = $filelink->resize($width, $height, $fit, $align);
    
    # OR
    
    $client = new FilestackClient('API_KEY');
    
    $url = "https://cdn.filestackcontent.com/FILE_HANDLE";
    $transform_tasks = [
        'crop'      => ['dim' => '[10,20,200,250]'],
        'resize'    => ['w' => '100', 'h' => '100'],
        'rotate'    => ['b' => '00FF00', 'd' => '45']
    ];
    
    $filelink = $client->transform($url, $transform_tasks);
    
    // Create a transform object from a client (with URL) or FileLink
    ImageTransform externalTransform = client.imageTransform("https://example.com");
    ImageTransform fileLinkTransform = fileLink.imageTransform();
    
    // The actual transformations are represented by TransformTask objects
    
    // Simple tasks can just be constructed
    FlipTask flipTask = new FlipTask();
    CropTask cropTask = new CropTask(0, 0, 300, 300);
    
    // Tasks with several options use builders
    AsciiTask asciiTask = new AsciiTask.Builder()
            .background("black")
            .colored(true)
            .reverse(true)
            .build();
    
    // To add a task
    transform.addTask(flipTask);
    
    // To chain multiple tasks
    transform
            .addTask(flipTask)
            .addTask(cropTask)
            .addTask(asciiTask);
    
    // Debug a transform
    try {
        JsonObject response = transform.debug(); // Also has async version
    } catch (FilestackException | IOException e) {
        // Handle error...
    }
    
    // Store a transformation as a new FileLink
    StoreOptions options = new StoreOptions.Builder()
            .container("my-bucket")
            .path("/path/in/container/")
            .filename("filename.ext")
            .build();
    
    try {
        FileLink newFileLink = transform.store(options); // Also has async version
    } catch (FilestackException | IOException e) {
        // Handle error...
    }
    

    Audio/Video Conversion

    Audio and visual conversions take in a multitude of potential parameters and return an AudioVideo object, which allows you to check the status of your conversion and return a Filelink upon completion. Please refer to Filestack's audio conversion and video conversion documentation for more information.

    Note: Conversions to Filelinks are called explicitly, and a file's status must be polled in order to determine its time of completion

    >>> curl -X GET "https://process.filestackapi.com/API_KEY/video_convert=height:260,width:300,preset:webm/FILE_HANDLE"
    
    # OR
    
    >>> curl -X GET "https://process.filestackapi.com/API_KEY/video_convert=preset:mp3,clip_offset:00:00:05,clip_length:00:00:10/FILE_HANDLE"
    
    from filestack import Client
    
    client = Client("<API_KEY>")
    filelink = client.upload(filepath='path/to/file/doom.mp4')
    av_convert= filelink.av_convert(width=100, height=100)
    while av_convert.status != 'completed':
        print(av_convert.status)
    
    filelink = av_convert.to_filelink()
    print(filelink.url)
    
    filelink = client.upload(filepath: 'path/to/file/foo.mp4')
    video = filelink.transform.av_convert(width: 100, height: 100)
    while video.status != 'completed'
        puts video.status
    end
    filelink = video.to_filelink
    puts filelink.url
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\Filelink;
    use Filestack\FilestackException;
    
    $filelink = new Filelink('FILE_HANDLE');
    
    $output_options = [
        'access'                => 'public',
        'audio_bitrate'         => 256,
        'audio_channels'        => 2,
        'audio_sample_rate'     => 44100,
        'force'                 => true,
        'title'                 => 'test Filestack Audio conversion'
    ];
    
    $uuid = $filelink->convertAudio('mp3', $output_options);
    
    # OR
    
    $client = new FilestackClient('API_KEY');
    
    $external_url = 'https://upload.wikimedia.org/wikipedia/commons/b/b5/'.
                'Op.14%2C_Scherzo_No.2_in_C_minor_for_piano%2C_C._Schumann.ogg';
    $output_options = [
        'access'                => 'public',
        'audio_bitrate'         => 256,
        'audio_channels'        => 2,
        'audio_sample_rate'     => 44100,
        'force'                 => true,
        'title'                 => 'test Filestack Audio conversion'
    ];
    
    $uuid = $client->convertAudio($external_url, 'mp3', $output_options);
    
    
    // Not implemented in Java SDK yet
    

    Filetype Conversions

    Filestack provides conversions from and to many different file types. Please see our filetype conversion documentation for more information and a list of possible conversions.

    >>> curl -X GET "https://process.filestackapi.com/API_KEY/output=format:jpg/URL_TO_PROCESS"
    
    # OR
    
    >>> curl -X POST -d url="https://process.filestackapi.com/API_KEY/output=format:png/FILE_HANDLE" "https://www.filestackapi.com/api/store/YOUR_STORAGE_OPTION?key=API_KEY"
    
    from filestack import Client
    
    client =  Client('API_KEY')
    filelink = client.upload(filepath='/path/to/file')
    conversion = filelink.filetype_conversion(format='jpg')
    new_filelink = conversion.store()
    
    require 'filestack'
    
    client = FilestackClient.new('API_KEY')
    filelink = client.upload(filepath: '/path/to/file')
    conversion = filelink.transform.filetype_conversion(format: 'pdf')
    new_filelink = conversion.store
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\Filelink;
    use Filestack\FilestackException;
    
    $filelink = new Filelink('FILE_HANDLE');
    
    $output_options = [
      'background' => 'white',
      'density' => 50,
      'compress' => true,
      'colorspace' => 'input',
      'quality' => 80,
      'strip' => true,
      'pageformat' => 'letter',
      'pageorientation' => 'landscape'
    ];
    
    $result = $filelink->convertFile('pdf', $output_options);
    
    # OR
    
    $client = new FilestackClient('API_KEY');
    
    $output_options = [
      'background' => 'white',
      'density' => 50,
      'compress' => true,
      'colorspace' => 'input',
      'quality' => 80,
      'strip' => true,
      'pageformat' => 'letter',
      'pageorientation' => 'landscape'
    ];
    
    $filelink = $client->convertFile('FILE_HANDLE', 'pdf', $output_options);
    
    
    // Not implemented in Java SDK yet
    

    Tags

    Note: This feature requires security and image tagging to be enabled on your account. To use security on your account, login to your developer portal, go to the App Secret section under the Security tab, and click "Use Security"

    Image tags can be retrieved as JSON objects on both Filehandles and external URLs, with the following structure: { "auto": { "art": 73, "big cats": 79, "carnivoran": 80, "cartoon": 93, "cat like mammal": 92, "fauna": 86, "mammal": 92, "small to medium sized cats": 89, "tiger": 92, "vertebrate": 90}, "user": "" }

    The keys provide the potential label, with their values representing the model's confidence.

    >>> curl -X GET "https://cdn.filestackcontent.com/tags/security=policy:YOUR_SECURITY_POLICY,signature:YOUR_SECURITY_SIGNATURE/FILE_HANDLE"
    
    # OR
    
    >>> curl -X GET -u "app:APP_SECRET" "https://cdn.filestackcontent.com/tags/FILE_HANDLE"
    
    from filestack import Client
    
    client = Client("<API_KEY>")
    filelink = client.upload(filepath='/path/to/file/foo.jpg')
    tags = filelink.tags()
    
    require 'filestack'
    
    client = FilestackClient.new('API_KEY')
    filelink = client.upload(filepath: '/path/to/file/foo.jpg')
    tags = filelink.tags
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\Filelink;
    use Filestack\FilestackException;
    
    $filelink = new Filelink('FILE_HANDLE');
    
    $json = $filelink->getTags();
    
    # OR
    
    $client = new FilestackClient('API_KEY');
    
    $json = $client->getTags('FILE_HANDLE');
    
    // Not implemented in Java SDK yet
    

    Safe-for-Work (SFW)

    Note: This feature requires security and image tagging to be enabled on your account. To use security on your account, login to your developer portal, go to the App Secret section under the Security tab, and click "Use Security"

    Returns a boolean predicting whether or not an image is safe-for-work.

    >>> curl -X GET "https://cdn.filestackcontent.com/swf/security=policy:YOUR_SECURITY_POLICY,signature:YOUR_SECURITY_SIGNATURE/FILE_HANDLE"
    
    # OR
    
    >>> curl -X GET -u "app:APP_SECRET" "https://cdn.filestackcontent.com/swf/FILE_HANDLE"
    
    from filestack import Client
    
    client = Client("<API_KEY>")
    filelink = client.upload(filepath='/path/to/file/foo.jpg')
    # returns true if SFW and false if not
    sfw = filelink.sfw()
    
    require 'filestack'
    
    client = FilestackClient.new('API_KEY')
    filelink = client.upload(filepath: '/path/to/file/foo.jpg')
    # returns true if SFW and false if not
    sfw = filelink.sfw
    
    <?php
    use Filestack\FilestackClient;
    use Filestack\Filelink;
    use Filestack\FilestackException;
    
    $filelink = new Filelink('FILE_HANDLE');
    
    $json = $filelink->getSafeForWork();
    
    # OR
    
    $client = new FilestackClient('API_KEY');
    
    $json = $client->getSafeForWork('FILE_HANDLE');
    
    
    // Not implemented in Java SDK yet