Skip to main content

How can I deliver an image as an attachment?



  • Billy Silva

    Perfect, exactly what I needed!  This stuff should all go into the documentation!

  • Yaka App

    Thanks, please, how to do same thing for non image document ?
    So, get an url like

  • Maor Gariv

    As raw files cannot be transformed, the default behaviour is to download the document. For example,

    For PDFs you can set the type to image and use the fl_attachment parameter, as usual.

  • Mukesh Saxena

    I'm using fl_attachment to download transformation but it is downloading in webp format. I want to download in jpg format. What should I need to do?

  • Aleksandar Kostadinov

    Hi Mukesh,

    If you're applying a specific fetch format (f_auto, f_webp) or changing the extension of the image in your URLs at the same time as requesting the fl_attachment transformation then that would explain why you're getting a WebP image when downloading.

    If your originals are already in JPG format then you should ensure that the extension for the public_id stays as JPG and that there aren't any explicit fetch format transformations.

    For example, the following "sample" image is already in JPG format within our Demo account.

    I can deliver the image as an attachment by just including the fl_attachment transformation in the URL and keeping the existing extension untouched:

    On the other hand, let's say the image was in a different (PNG) and I want to download it as a JPG, I can go ahead and set the fetch format (f param in URLs ) to JPG:,f_jpg/sample.png

  • Lucas Velasco

    Hi, can you confirm what characters are not accepted as <new_filename>?

    I was trying with single quotes (both unescaped as ' and escaped as %27) and I'm getting 400 Bad Request. Same for accented characters as á, é, í, ó, ú 

  • Lucas Velasco

    I received a confirmation that it currently only accept any word character (letter, number, underscore), hyphen, space and exclamation mark.


Please sign in to leave a comment.