Effortless Website Screenshot Uploads to Cloudflare R2 Storage

With the Screenshot API, effortlessly capture website screenshots and seamlessly upload them directly to your Cloudflare R2 storage bucket. Simplify the task of generating screenshots in bulk from various URLs, sitemaps, text files, or even entire domains with automation. A single call to the Screenshot API empowers you to save valuable time and streamline the process by automatically transferring all your screenshots to your Cloudflare R2 storage.

This efficient workflow ensures your website screenshots are organized and easily accessible from a centralized location.

Cloudflare's R2 storage offers a secure and reliable solution for storing your screenshots, providing peace of mind that your data is safeguarded and readily available whenever you require it. Effortlessly capture website screenshots and seamlessly upload them to your Cloudflare R2 storage bucket with the Screenshot API, simplifying your workflow and enhancing accessibility.

How to upload images to your Cloudflare R2 Bucket

The following parameters are available when uploading screenshots to your R2 bucket.
Parameter Required Description
r2 Required The name of the bucket
r2_account_id Required Your Cloudflare account ID.
Refer to Cloudflare's Find zone and account IDs documentation.
For example: https://YOUR_ACCOUNT_ID.r2.cloudflarestorage.com
r2_access_id Required Your R2 Access ID (Secret Access ID).
Refer to Cloudflare's R2 Authentication documentation.
r2_access_key Required Your R2 Access Key (Secret Access Key).
Refer to Cloudflare's R2 Authentication documentation.
file Optional The name or pattern for the file without the extension
The default is a unique identifier (see pattern examples)
folder Optional The folder name or pattern for the file (see pattern examples)
html Optional When set to true, the HTML markup will be uploaded too

How to setup a Cloudflare R2 Bucket and Access

Login to Cloudflare and create a new bucket such as "my-demo-screenshots" from the R2 left side menu: Create R2 Bucket

Create an API token such as "Add Screenshots API" with the "Object Read & Write" permission: Create R2 API Key

Record the Access Key ID, Secret Access Key and Account ID (from the URL): R2 API Key

Upload a single screenshot to Cloudflare's R2 Storage (real-time GET request)

The example below shows how to take a real-time website screenshot and store the image in an R2 bucket "my-demo-screenshots" in the "images" folder with the file name "website.png". The optional &html=true parameter will upload the "website.html" file to the R2 bucket as well.

// Line breaks added for readability https://api.addscreenshots.com/screenshots

Your API key can be found on the API Keys page. Need an API Key? Sign up to get started.
For internal applications, replace YOUR_API_KEY with your own unique API Key.
For public facing websites or hotlinks, generate a signed URL.

The API response will include a link to the screenshot in your S3 bucket as shown below:

  "success": true,
  "message": "Screenshots completed.",
  "storage_provider": "r2",
  "images": [
      "folder": "images",
      "file": "website.png",
      "request_url": "https://www.youtube.com",
      "page_url": "https://www.youtube.com/",
      "image_url": "https://my-demo-screenshots.1234567890qwertyuiopasdfgh.r2.cloudflarestorage.com/images/website.png",
      "html_url": "https://my-demo-screenshots.1234567890qwertyuiopasdfgh.r2.cloudflarestorage.com/images/website.html"

The folders and file names as they appear in R2 storage: Screenshot Images in R2