{
  "openapi": "3.0.1",
  "info": {
    "title": "Image Compressor – Compress JPG, PNG & WebP to Target KB",
    "description": "Compress images in bulk without visible quality loss: optimised JPG, palette PNG, WebP or AVIF, or squeeze each file under a target size in KB. Strips metadata, keeps the original when it is already smaller, and reports savings per image. Bulk URLs or a dataset. $0.80 per 1,000.",
    "version": "0.1",
    "x-build-id": "GG9YnWu2W1vLdns98"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/gazidev~image-compressor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-gazidev-image-compressor",
        "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/gazidev~image-compressor/runs": {
      "post": {
        "operationId": "runs-sync-gazidev-image-compressor",
        "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/gazidev~image-compressor/run-sync": {
      "post": {
        "operationId": "run-sync-gazidev-image-compressor",
        "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 JPG, PNG, WebP, AVIF, HEIC/HEIF, TIFF, GIF or BMP files. Duplicates are removed; invalid values and failed downloads are reported for free.",
            "items": {
              "type": "string"
            }
          },
          "bulkText": {
            "title": "Bulk list (paste text or CSV)",
            "type": "string",
            "description": "One URL per line, or a CSV with a `url` / `image` column."
          },
          "sourceFileUrl": {
            "title": "Load URLs from a file (URL)",
            "type": "string",
            "description": "Public .txt or .csv link (Google Sheets 'Publish to web → CSV' works)."
          },
          "datasetId": {
            "title": "Read URLs from an Apify dataset",
            "type": "string",
            "description": "Chain after a scraper (e.g. product images) or our Image Downloader."
          },
          "datasetField": {
            "title": "Dataset field with the image URL",
            "type": "string",
            "description": "Arrays of URLs are accepted too.",
            "default": "url"
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "same",
              "jpg",
              "webp",
              "avif",
              "png"
            ],
            "type": "string",
            "description": "'Same as input' keeps each file's format. HEIC/HEIF become JPG and BMP becomes PNG. Animated GIF/WebP/PNG files are returned unchanged (free).",
            "default": "same"
          },
          "quality": {
            "title": "Quality",
            "type": "string",
            "description": "`auto` (default): for JPG, WebP and AVIF finds the lowest quality between 60 and 90 that keeps SSIM at or above the threshold below (measured on a native-resolution 512 px crop). Or a fixed number 1–100.",
            "default": "auto"
          },
          "minSsim": {
            "title": "Visual quality threshold (SSIM, auto mode)",
            "enum": [
              "0.95",
              "0.97",
              "0.98",
              "0.99",
              "0.995"
            ],
            "type": "string",
            "description": "Used by `auto` quality and by the automatic palette PNG decision.",
            "default": "0.98"
          },
          "targetKb": {
            "title": "Target file size (KB, optional)",
            "minimum": 0,
            "type": "integer",
            "description": "Squeeze each file under this size (1 KB = 1,000 bytes). Lowers quality first (JPG, WebP, AVIF) or switches PNG to a palette, then shrinks the dimensions step by step. Overrides the quality threshold. 0 = off.",
            "default": 0
          },
          "maxDimension": {
            "title": "Max width/height (px, optional)",
            "minimum": 0,
            "type": "integer",
            "description": "Downscale images whose longest side is larger than this before compressing (aspect ratio kept, never enlarged). Runs before the target size. 0 = off.",
            "default": 0
          },
          "pngPalette": {
            "title": "PNG palette compression (like TinyPNG)",
            "enum": [
              "auto",
              "always",
              "never"
            ],
            "type": "string",
            "description": "Palette PNGs are often 60–80% smaller. Auto keeps full colour for photos and gradients where the palette would show banding.",
            "default": "auto"
          },
          "keepOriginalIfSmaller": {
            "title": "Keep the original when it is already smaller",
            "type": "boolean",
            "description": "On (default): the result is never larger than the original. Those images are returned unchanged and are not charged.",
            "default": true
          },
          "minSavingsPercent": {
            "title": "Minimum saving to count (%)",
            "minimum": 0,
            "maximum": 50,
            "type": "integer",
            "description": "With 'Keep the original' on, an image that shrinks by less than this is returned unchanged and not charged. 0 = keep any saving.",
            "default": 2
          },
          "keepMetadata": {
            "title": "Keep EXIF metadata",
            "type": "boolean",
            "description": "Off (default) strips EXIF, GPS location and camera data for privacy and smaller files; the colour profile is kept. Orientation is always applied to the pixels.",
            "default": false
          },
          "backgroundColor": {
            "title": "Background colour for transparency",
            "type": "string",
            "description": "Used when a transparent image is saved as JPG.",
            "default": "#ffffff"
          },
          "maxImages": {
            "title": "Max images",
            "minimum": 0,
            "type": "integer",
            "description": "0 = no limit.",
            "default": 0
          },
          "maxFileSizeMb": {
            "title": "Max download size per file (MB)",
            "minimum": 1,
            "maximum": 200,
            "type": "integer",
            "description": "Larger files are skipped for free.",
            "default": 50
          },
          "maxConcurrency": {
            "title": "Parallel downloads",
            "minimum": 1,
            "maximum": 16,
            "type": "integer",
            "description": "Lower it for slow or rate-limited hosts.",
            "default": 6
          },
          "proxyConfiguration": {
            "title": "Proxy (optional)",
            "type": "object",
            "description": "Only needed if an image host blocks datacenter IPs."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}