Skip to content

Changelog

New updates and improvements at Cloudflare.

hero image

Manage hosted images with the Images binding

Use the Images binding to upload, list, retrieve, update, and delete images stored in Images directly from your Worker without managing API tokens or making HTTP requests.

The env.IMAGES.hosted namespace supports the following storage and management operations:

For example, you can upload an image from a request body and return its metadata:

TypeScript
const image = await env.IMAGES.hosted.upload(request.body, {
filename: "upload.jpg",
metadata: { source: "worker" },
});
return Response.json(image);

Or retrieve and serve the original bytes of a hosted image:

TypeScript
const bytes = await env.IMAGES.hosted.image("IMAGE_ID").bytes();
return new Response(bytes);

For more information, refer to the Images binding.