{
  "openapi": "3.0.1",
  "info": {
    "title": "Bulk Image Downloader & Optimizer: URLs/Dataset to WebP/JPG+ZIP",
    "description": "Download images in bulk from a list of URLs or any Apify dataset, then resize, convert to WebP, JPEG, PNG or AVIF, strip metadata, remove duplicates and get everything in ZIP files. Works as an integration after any scraper.",
    "version": "1.0",
    "x-build-id": "tfkreefbUQiFAQSBM"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/zubayer01~bulk-image-downloader-optimizer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-zubayer01-bulk-image-downloader-optimizer",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/zubayer01~bulk-image-downloader-optimizer/runs": {
      "post": {
        "operationId": "runs-sync-zubayer01-bulk-image-downloader-optimizer",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/zubayer01~bulk-image-downloader-optimizer/run-sync": {
      "post": {
        "operationId": "run-sync-zubayer01-bulk-image-downloader-optimizer",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "imageUrls": {
            "title": "Image URLs",
            "type": "array",
            "description": "Direct links to the images you want to download, one per line (http or https only). Leave empty if you only want to use a dataset below. Example: https://example.com/photos/red-shoe.jpg",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Dataset with image URLs",
            "type": "string",
            "description": "Pick a dataset from your Apify account, for example the results of a scraper run. The Actor reads every item and downloads the images it finds (see \"Image URL fields\"). Only read access to this one dataset is requested. When this Actor runs as an integration after another Actor, you can leave this empty: the dataset of the run that triggered it is used automatically."
          },
          "imageFields": {
            "title": "Image URL fields",
            "type": "array",
            "description": "Names of the dataset fields that contain image links. Use dots for nested fields; lists are searched automatically. Examples: \"image\", \"images\", \"gallery.url\", \"media[].src\", \"photos[0]\". Leave empty to detect image links in every field automatically.",
            "items": {
              "type": "string"
            }
          },
          "itemIdFields": {
            "title": "Fields to copy into each result",
            "type": "array",
            "description": "Dataset fields copied into every result row under \"sourceItem\", so you can match each image back to its product or listing (for example \"sku\", \"id\", \"url\"). Leave empty to copy these fields automatically when they exist: id, sku, productId, asin, code, handle, url, title.",
            "items": {
              "type": "string"
            }
          },
          "maxImages": {
            "title": "Maximum number of images",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many images (duplicates and failures count too). Useful to try the Actor on a sample of a big dataset. Leave empty for no limit."
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "original",
              "webp",
              "jpeg",
              "png",
              "avif"
            ],
            "type": "string",
            "description": "File format of the saved images. \"Original\" keeps each file's own format and re-encodes it only when it has to be resized or its metadata removed. WebP gives small files that work in every modern browser; AVIF is even smaller but slower to create. SVG files and animated GIFs are converted only when you pick a format here; with \"Original\" they are kept unchanged. Animated images stay animated when converted to WebP.",
            "default": "original"
          },
          "quality": {
            "title": "Quality",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Compression quality for JPEG, WebP and AVIF, from 1 (smallest file) to 100 (best quality). 75-85 is a good balance for websites and shops. PNG is always lossless and ignores this setting.",
            "default": 82
          },
          "maxWidth": {
            "title": "Maximum width",
            "minimum": 1,
            "type": "integer",
            "description": "Shrink images that are wider than this, keeping their proportions. Images are never enlarged. Leave empty to keep the original width."
          },
          "maxHeight": {
            "title": "Maximum height",
            "minimum": 1,
            "type": "integer",
            "description": "Shrink images that are taller than this, keeping their proportions. Images are never enlarged. Leave empty to keep the original height."
          },
          "stripMetadata": {
            "title": "Remove metadata (EXIF, GPS, camera data)",
            "type": "boolean",
            "description": "Remove hidden data such as GPS location, camera model and editing history (EXIF, XMP, IPTC). Photos are rotated the right way up before the data is removed. Turn off to keep the metadata, for example for photo archives.",
            "default": true
          },
          "minWidth": {
            "title": "Minimum width",
            "minimum": 0,
            "type": "integer",
            "description": "Skip images narrower than this, such as icons, tracking pixels and tiny thumbnails. Skipped images are not charged. 0 = no minimum.",
            "default": 0
          },
          "minHeight": {
            "title": "Minimum height",
            "minimum": 0,
            "type": "integer",
            "description": "Skip images shorter than this. Skipped images are not charged. 0 = no minimum.",
            "default": 0
          },
          "deduplicate": {
            "title": "Skip duplicates",
            "type": "boolean",
            "description": "Skip an image when the same link appeared earlier in the run, or when its file is identical to an image already saved (compared by the SHA-256 fingerprint of the downloaded bytes). Duplicates are not charged.",
            "default": true
          },
          "fileNameTemplate": {
            "title": "File name template",
            "type": "string",
            "description": "How saved files are named; the extension is added automatically. Placeholders: {index} = position of the image in the input (00001, 00002, ...), {originalName} = file name from the link without extension, {hash8} = first 8 characters of the file's SHA-256 fingerprint, and any dataset field such as {sku} or {title} (use dots for nested fields, e.g. {product.sku}). Characters other than letters, digits, dot, dash and underscore become dashes. When two files get the same name, -2, -3 ... is added.",
            "default": "{index}-{originalName}"
          },
          "folderTemplate": {
            "title": "Folder template",
            "type": "string",
            "description": "Optional folders inside the ZIP file, using the same placeholders as the file name, for example {brand} or {category}/{sku}. Leave empty for no folders. In the key-value store the folder becomes part of the file key (slashes become underscores)."
          },
          "createZip": {
            "title": "Create ZIP files",
            "type": "boolean",
            "description": "Also pack all saved images into ZIP files that you can download in one click. Single files are always saved as well.",
            "default": true
          },
          "zipMaxSizeMb": {
            "title": "Maximum ZIP file size",
            "minimum": 10,
            "maximum": 2000,
            "type": "integer",
            "description": "Start a new ZIP file (archive-002.zip, ...) when the current one would get bigger than this. With 512 MB of Actor memory, ZIP files are limited to 409 MB because of disk space.",
            "default": 500
          },
          "concurrency": {
            "title": "Parallel downloads",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "How many images are downloaded at the same time. Lower it if a website limits fast downloads; raise it for many small images from fast servers.",
            "default": 10
          },
          "maxRetries": {
            "title": "Retries per image",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "How many times a download is tried again, with growing pauses, when the error looks temporary (timeout, connection error, HTTP 429 or 5xx). Permanent errors such as 404 Not Found are not retried.",
            "default": 3
          },
          "requestTimeoutSecs": {
            "title": "Download timeout",
            "minimum": 5,
            "maximum": 300,
            "type": "integer",
            "description": "Give up one download attempt after this many seconds.",
            "default": 30
          },
          "maxFileSizeMb": {
            "title": "Maximum file size",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Skip files larger than this. Protects the run from huge files. Skipped images are not charged.",
            "default": 25
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}