{
  "openapi": "3.0.1",
  "info": {
    "title": "Image Downloader: Bulk Images to ZIP, WebP & Audit",
    "description": "Download every image from pages, sitemaps, CSV/Shopify exports or datasets. ZIP, WebP/AVIF, renaming by SKU, alt-text and size audit. GPS data always removed. Failed, blocked and duplicate images are free.",
    "version": "1.1",
    "x-build-id": "0LmImDEzAUnLfLCGF"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/urlwright~image-downloader/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-urlwright-image-downloader",
        "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/urlwright~image-downloader/runs": {
      "post": {
        "operationId": "runs-sync-urlwright-image-downloader",
        "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/urlwright~image-downloader/run-sync": {
      "post": {
        "operationId": "run-sync-urlwright-image-downloader",
        "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": {
          "startUrls": {
            "title": "Page URLs",
            "type": "array",
            "description": "HTML pages to scan for images (img, srcset, picture, lazy attrs, og/twitter, CSS, icons, image links).",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "title": "URL",
                  "type": "string",
                  "description": "Page URL to scan for images."
                }
              },
              "required": [
                "url"
              ]
            }
          },
          "imageUrls": {
            "title": "Direct image URLs",
            "type": "array",
            "description": "Image URLs to download without page discovery.",
            "items": {
              "type": "string"
            }
          },
          "csvUrl": {
            "title": "CSV / XLSX / Google Sheets URL",
            "type": "string",
            "description": "Public URL of a CSV, TSV, XLSX file, or a public Google Sheets document (rewritten to CSV export)."
          },
          "csvText": {
            "title": "CSV / TSV text",
            "type": "string",
            "description": "Inline CSV or TSV with a header row. Use with csvUrlColumn or csvPreset."
          },
          "csvUrlColumn": {
            "title": "CSV URL column",
            "type": "string",
            "description": "Column name containing image URLs. Leave empty to auto-detect (Image Src, url, image, src, …).",
            "default": ""
          },
          "csvPreset": {
            "title": "CSV preset",
            "enum": [
              "none",
              "shopify"
            ],
            "type": "string",
            "description": "Shopify: uses Image Src / Variant Image and carries Handle, Variant SKU, Image Alt Text, Image Position into template vars.",
            "default": "none"
          },
          "datasetId": {
            "title": "Apify dataset ID",
            "type": "string",
            "description": "Dataset whose rows supply image or page URLs (field from datasetField)."
          },
          "datasetField": {
            "title": "Dataset URL field",
            "type": "string",
            "description": "Field name on dataset rows that holds the URL.",
            "default": "url"
          },
          "sitemapUrls": {
            "title": "Sitemap URLs",
            "type": "array",
            "description": "Sitemap or sitemap-index URLs (XML or .gz). Image sitemaps yield image URLs directly.",
            "items": {
              "type": "string"
            }
          },
          "domains": {
            "title": "Domains",
            "type": "array",
            "description": "Discover sitemaps via robots.txt Sitemap: lines, then /sitemap.xml fallback.",
            "items": {
              "type": "string"
            }
          },
          "sitemapDatasetId": {
            "title": "Sitemap URL Extractor dataset ID",
            "type": "string",
            "description": "Dataset from urlwright/sitemap-url-extractor. Uses field url; skips changeStatus=removed and statusCode≥400."
          },
          "includePathGlobs": {
            "title": "Include page path globs",
            "type": "array",
            "description": "Only crawl/scan page paths matching these globs (e.g. /products/**).",
            "items": {
              "type": "string"
            }
          },
          "excludePathGlobs": {
            "title": "Exclude page path globs",
            "type": "array",
            "description": "Skip page paths matching these globs.",
            "items": {
              "type": "string"
            }
          },
          "maxPages": {
            "title": "Max pages",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on HTML pages scanned (sitemap + crawl + startUrls).",
            "default": 1000
          },
          "crawl": {
            "title": "Same-domain crawl",
            "type": "object",
            "description": "Optional bounded crawl from startUrls on the same registrable domain.",
            "properties": {
              "enabled": {
                "title": "Enable crawl",
                "type": "boolean",
                "description": "Follow same-domain links from startUrls.",
                "editor": "checkbox",
                "default": false
              },
              "maxDepth": {
                "title": "Max depth",
                "type": "integer",
                "description": "Link depth from each start URL (0 = start URLs only).",
                "editor": "number",
                "minimum": 0,
                "default": 1
              },
              "maxPages": {
                "title": "Crawl max pages",
                "type": "integer",
                "description": "Max pages discovered by crawl (still subject to global maxPages).",
                "editor": "number",
                "minimum": 1,
                "default": 50
              }
            }
          },
          "renderJs": {
            "title": "Render JavaScript",
            "type": "boolean",
            "description": "Load pages with Playwright (DOM only; images/fonts/media blocked). Recommend 4096 MB memory. Charges page-rendered instead of page-scanned.",
            "default": false
          },
          "renderScroll": {
            "title": "Scroll while rendering",
            "type": "boolean",
            "description": "Scroll the page to trigger lazy-loaded images when renderJs is on.",
            "default": true
          },
          "renderWaitMs": {
            "title": "Render wait (ms)",
            "minimum": 0,
            "type": "integer",
            "description": "Extra wait after load/scroll before reading the DOM.",
            "default": 500
          },
          "allSrcsetVariants": {
            "title": "Keep all srcset variants",
            "type": "boolean",
            "description": "If false (default), only the largest srcset/picture candidate is kept per element.",
            "default": false
          },
          "formats": {
            "title": "Allowed formats",
            "type": "array",
            "description": "Empty = all supported. Values: jpeg, png, webp, avif, gif, svg, ico, heic, bmp, tiff.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "minWidth": {
            "title": "Min width (px)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip images narrower than this after measurement.",
            "default": 0
          },
          "minHeight": {
            "title": "Min height (px)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip images shorter than this after measurement.",
            "default": 0
          },
          "minBytes": {
            "title": "Min file size (bytes)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip smaller files after download.",
            "default": 0
          },
          "maxBytes": {
            "title": "Max file size filter (bytes)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip larger files after download (0 = no filter). Separate from maxFileMB abort.",
            "default": 0
          },
          "includeUrlPatterns": {
            "title": "Include image URL patterns",
            "type": "array",
            "description": "Glob or /regex/ patterns. Empty = include all.",
            "items": {
              "type": "string"
            }
          },
          "excludeUrlPatterns": {
            "title": "Exclude image URL patterns",
            "type": "array",
            "description": "Glob or /regex/ patterns to skip.",
            "items": {
              "type": "string"
            }
          },
          "skipIcons": {
            "title": "Skip icons and pixels",
            "type": "boolean",
            "description": "Drop favicons, ≤2×2 pixels, known tracking-pixel paths and placeholders.",
            "default": true
          },
          "dedupeSimilar": {
            "title": "Perceptual dedupe",
            "type": "boolean",
            "description": "Drop near-duplicates via dHash; keep the largest variant.",
            "default": true
          },
          "similarityThreshold": {
            "title": "dHash Hamming threshold",
            "minimum": 0,
            "maximum": 64,
            "type": "integer",
            "description": "Max Hamming distance for perceptual duplicates (default 4).",
            "default": 4
          },
          "maxImagesPerPage": {
            "title": "Max images per page",
            "minimum": 0,
            "type": "integer",
            "description": "Cap discoveries kept from a single page (0 = unlimited).",
            "default": 0
          },
          "maxImages": {
            "title": "Max images",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on images processed in this run.",
            "default": 500
          },
          "maxTotalMB": {
            "title": "Max total download MB",
            "minimum": 0,
            "type": "integer",
            "description": "Stop downloading when cumulative stored bytes reach this (0 = unlimited).",
            "default": 0
          },
          "maxFileMB": {
            "title": "Max single file MB",
            "minimum": 1,
            "type": "integer",
            "description": "Abort a download exceeding this size (skipReason too-large, free).",
            "default": 50
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "download",
              "audit"
            ],
            "type": "string",
            "description": "download stores files; audit lists images (image-listed) without full download.",
            "default": "download"
          },
          "auditDimensions": {
            "title": "Audit: header dimensions",
            "type": "boolean",
            "description": "In audit mode, fetch the first 64 KB (Range) to read pixel size via image-size.",
            "default": false
          },
          "onlyNew": {
            "title": "Only new / changed (diff)",
            "type": "boolean",
            "description": "Compare against previous state in named KV store image-downloader-state. Unchanged → image-listed; removed rows reported free.",
            "default": false
          },
          "stateKey": {
            "title": "Diff state key",
            "type": "string",
            "description": "Record key inside image-downloader-state. Required when onlyNew is true.",
            "default": "default"
          },
          "output": {
            "title": "Output",
            "enum": [
              "files",
              "zip",
              "both"
            ],
            "type": "string",
            "description": "files = KV records only; zip = ZIP parts only; both = files + ZIP.",
            "default": "both"
          },
          "zipGroupBy": {
            "title": "ZIP group by",
            "enum": [
              "none",
              "page",
              "domain",
              "product"
            ],
            "type": "string",
            "description": "Folder layout inside ZIP archives.",
            "default": "none"
          },
          "zipPartMB": {
            "title": "ZIP part size MB",
            "minimum": 1,
            "maximum": 1024,
            "type": "integer",
            "description": "Split ZIP when a part would exceed this (max 1024).",
            "default": 1024
          },
          "fileNameTemplate": {
            "title": "File name template",
            "type": "string",
            "description": "Vars: {domain} {pathSlug} (image URL file stem) {pageSlug} (page path) {index} {position} (Shopify Image Position or 1-based order) {hash8} {width} {height} {altSlug} {ext} {sku} {handle} {csv:Column Name}. Case and Unicode letters are kept in file names; only / \\ : * ? \" < > | and control chars are replaced (whitespace → -). Extension is appended automatically.",
            "default": "{domain}/{pathSlug}"
          },
          "keepOrientation": {
            "title": "Keep EXIF orientation",
            "type": "boolean",
            "description": "When stripping EXIF, write a minimal Orientation tag if present (default true). GPS/author/serial are always removed.",
            "default": true
          },
          "convertTo": {
            "title": "Convert to",
            "enum": [
              "none",
              "webp",
              "avif",
              "jpeg",
              "png"
            ],
            "type": "string",
            "description": "Derive a converted file (charges image-processed). none = no conversion.",
            "default": "none"
          },
          "quality": {
            "title": "Conversion quality",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Quality for lossy convertTo (1–100).",
            "default": 80
          },
          "keepOriginal": {
            "title": "Keep original when converting",
            "type": "boolean",
            "description": "If true, store both the original and the converted file. If false, store only the converted file (fileKey points to it).",
            "default": true
          },
          "resizeMaxWidth": {
            "title": "Resize max width",
            "minimum": 0,
            "type": "integer",
            "description": "Downscale so width ≤ this (0 = no resize).",
            "default": 0
          },
          "resizeMaxHeight": {
            "title": "Resize max height",
            "minimum": 0,
            "type": "integer",
            "description": "Downscale so height ≤ this (0 = no resize).",
            "default": 0
          },
          "thumbnails": {
            "title": "Thumbnail widths",
            "type": "array",
            "description": "Extra thumbnail widths in px (first frame for animated GIF/WebP). Each thumbnail charges image-processed.",
            "items": {
              "type": "integer"
            },
            "default": []
          },
          "rasterizeSvg": {
            "title": "Rasterize SVG to PNG",
            "type": "boolean",
            "description": "After sanitising SVG, also store a PNG raster (safe, no external refs).",
            "default": false
          },
          "requestTimeoutSecs": {
            "title": "Request timeout (seconds)",
            "minimum": 5,
            "maximum": 120,
            "type": "integer",
            "description": "Per-request timeout for pages and images.",
            "default": 20
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}