Cloudflare Docs
Cloudflare Image Optimization
Edit this page
Report an issue with this page
Log into the Cloudflare dashboard
Set theme to dark (⇧+D)

Get started

In this guide, you will get started with Cloudflare Images and make your first API request.

​​ Prerequisites

Before you make your first API request, ensure that you have a Cloudflare Account ID and an API token.

Refer to Find zone and account IDs for help locating your Account ID and Create an API token to learn how to create an access your API token.

​​ Make your first API request

curl --request POST \
--url<ACCOUNT_ID>/images/v1 \
--header 'Authorization: <API_TOKEN> \
--header 'Content-Type: multipart/form-data' \
--form file=@./<YOUR_IMAGE.IMG>

​​ Enable transformations

Transformations let you optimize images that are stored outside of Cloudflare Images. Cloudflare will automatically cache every transformed image on our global network so that you store only the original image at your origin.

Before you can enable transformations, you must purchase Cloudflare Images. To use transformations, you will need to enable the feature on each zone:

  1. Log in to the Cloudflare dashboard and select your account.
  2. Go to Images > Transformations.
  3. Select the zone where you want to enable transformations.
  4. Select Enable.
  5. To transform images only from the enabled zone, uncheck Resize images from any origin. This will prevent third parties from resizing images at any origin.