{
  "openapi": "3.0.1",
  "info": {
    "title": "Image Compressor & Resizer: Compress Images in Bulk",
    "description": "Compress images in bulk: an image compressor and resizer API for lists of image URLs. Shrink JPG, PNG, WebP and AVIF, resize to a max width or height, strip EXIF, and get signed download links with the exact bytes saved.",
    "version": "0.1",
    "x-build-id": "AqQYI3FnVpWsHcykl"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/data-done-right~image-compressor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-data-done-right-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/data-done-right~image-compressor/runs": {
      "post": {
        "operationId": "runs-sync-data-done-right-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/data-done-right~image-compressor/run-sync": {
      "post": {
        "operationId": "run-sync-data-done-right-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": {
          "urls": {
            "title": "Image URLs",
            "type": "array",
            "description": "Direct links to the images to compress, one per line. JPG, PNG, WebP, AVIF, GIF, BMP, TIFF and HEIC work. Example: https://example.com/photo.jpg. Use only images you have the right to process.",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Dataset with image URLs (optional)",
            "type": "string",
            "description": "Optional. Pick an Apify dataset (for example the output of a scraper) and every image URL in the field below is compressed too. Example: a dataset ID such as aBcD1234eFgH5678i."
          },
          "datasetField": {
            "title": "Dataset field",
            "type": "string",
            "description": "Field of each dataset item that holds the image URL (or a list of URLs). Dotted paths work. Example: imageUrl or images.0.url. Default: url.",
            "default": "url"
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "original",
              "jpeg",
              "webp",
              "png",
              "avif"
            ],
            "type": "string",
            "description": "Convert every image to this format, or keep each one as it is. WebP and AVIF are usually the smallest. BMP, TIFF and HEIC become PNG or JPEG when you keep the original format. Example: webp.",
            "default": "original"
          },
          "quality": {
            "title": "Quality (1-100)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Lossy quality for JPEG, WebP and AVIF (it also sets how many colors a PNG may be reduced to). 75-85 looks near-identical for most photos. Lower is smaller. Example: 75.",
            "default": 80
          },
          "maxWidth": {
            "title": "Max width (px)",
            "minimum": 0,
            "maximum": 20000,
            "type": "integer",
            "description": "Shrink images wider than this so they fit. Never enlarges a smaller image. 0 means no limit. Example: 1600.",
            "default": 0
          },
          "maxHeight": {
            "title": "Max height (px)",
            "minimum": 0,
            "maximum": 20000,
            "type": "integer",
            "description": "Shrink images taller than this so they fit. Never enlarges a smaller image. 0 means no limit. Example: 1200.",
            "default": 0
          },
          "resizeMode": {
            "title": "Resize mode",
            "enum": [
              "fit",
              "cover",
              "contain"
            ],
            "type": "string",
            "description": "fit keeps the ratio and stays inside the box. cover and contain make every image exactly maxWidth x maxHeight (both required); cover crops from the center, contain pads with the background color. Example: fit.",
            "default": "fit"
          },
          "stripMetadata": {
            "title": "Strip metadata",
            "type": "boolean",
            "description": "Remove EXIF (camera, GPS location), XMP and other metadata to save bytes and protect privacy. The orientation is always applied to the pixels first, so photos are never rotated wrongly. Colors are converted to sRGB before the profile is dropped.",
            "default": true
          },
          "progressive": {
            "title": "Progressive JPEG",
            "type": "boolean",
            "description": "Write JPEGs as progressive (they load blurry to sharp and are usually a few percent smaller).",
            "default": true
          },
          "lossless": {
            "title": "Lossless mode",
            "type": "boolean",
            "description": "Never lose pixel data: PNG is only re-compressed (no color reduction), WebP and AVIF are written lossless. Files shrink less, and lossless WebP of a photo can even grow, in which case the original is returned.",
            "default": false
          },
          "pngQuantize": {
            "title": "Reduce PNG colors",
            "type": "boolean",
            "description": "Shrink PNGs by reducing them to a palette of up to 256 colors (keeps transparency) when that is smaller. Often cuts PNGs by 50-70%. Ignored when lossless is on.",
            "default": true
          },
          "backgroundColor": {
            "title": "Background color",
            "type": "string",
            "description": "Used instead of transparency when converting to JPEG, and to pad images in contain mode. Hex color. Example: #ffffff.",
            "default": "#ffffff"
          },
          "skipIfNotSmaller": {
            "title": "Return original if not smaller",
            "type": "boolean",
            "description": "When compression would not make a file smaller, return the original bytes (reduced: false) instead of a bigger file. Those rows are never charged.",
            "default": true
          },
          "maxImages": {
            "title": "Max images",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Most images processed in this run. URLs beyond this are skipped and not charged. Example: 100.",
            "default": 100
          },
          "maxFileSizeMb": {
            "title": "Max file size (MB)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Images larger than this are skipped before they are fully downloaded. Images above 64 megapixels are always refused (memory safety).",
            "default": 25
          },
          "concurrency": {
            "title": "Parallel downloads",
            "minimum": 1,
            "maximum": 16,
            "type": "integer",
            "description": "How many images are processed at the same time. Default 4.",
            "default": 4
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional. Download images through Apify Proxy or your own proxies. Usually not needed.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}