{
  "openapi": "3.0.1",
  "info": {
    "title": "Image Compressor & Resizer API: Target KB, WebP",
    "description": "Image compressor and resizer: shrink images from URLs or base64, resize by width or height, compress to a target size in KB, and convert to WebP or AVIF. EXIF stripped. Before/after bytes per file. $0.002 per image.",
    "version": "1.0",
    "x-build-id": "8LcvypS9kkPfGYUWv"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ferrolark~image-compress-resize/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ferrolark-image-compress-resize",
        "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/ferrolark~image-compress-resize/runs": {
      "post": {
        "operationId": "runs-sync-ferrolark-image-compress-resize",
        "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/ferrolark~image-compress-resize/run-sync": {
      "post": {
        "operationId": "run-sync-ferrolark-image-compress-resize",
        "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": "Public image URLs: PNG, JPEG, WebP, AVIF, HEIC/HEIF, GIF (first frame), TIFF, BMP or SVG. Up to 50 files and 100 MB per run.",
            "items": {
              "type": "string"
            }
          },
          "files": {
            "title": "Files as base64 (optional)",
            "type": "array",
            "description": "For n8n/Make binaries: a list of {\"base64\": \"...\", \"name\": \"photo.heic\"} objects (or {\"url\": ...}). Keep the whole input under about 9 MB; use URLs for bigger batches."
          },
          "width": {
            "title": "Width (px)",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Target width. With only width or only height, the aspect ratio is kept."
          },
          "height": {
            "title": "Height (px)",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Target height."
          },
          "fit": {
            "title": "Fit",
            "enum": [
              "inside",
              "cover",
              "contain",
              "fill"
            ],
            "type": "string",
            "description": "How to fit the image into width x height.",
            "default": "inside"
          },
          "allowUpscale": {
            "title": "Allow upscaling",
            "type": "boolean",
            "description": "By default images are never enlarged.",
            "default": false
          },
          "targetKB": {
            "title": "Target size (KB)",
            "minimum": 1,
            "maximum": 50000,
            "type": "number",
            "description": "Find the highest quality that fits under this size (JPEG, WebP, AVIF, HEIC). Example: 200 for a 200 KB cap."
          },
          "quality": {
            "title": "Quality / max quality",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Quality for lossy formats; with a target size, the upper bound of the search.",
            "default": 82
          },
          "format": {
            "title": "Output format",
            "enum": [
              "keep",
              "webp",
              "avif",
              "jpeg",
              "png",
              "heic",
              "tiff",
              "gif",
              "bmp"
            ],
            "type": "string",
            "description": "Keep the original format, or convert while compressing (WebP and AVIF usually save the most).",
            "default": "keep"
          },
          "onlyIfSmaller": {
            "title": "Keep the original if not smaller",
            "type": "boolean",
            "description": "When no resize or format change is requested and re-encoding would not shrink the file, return the original bytes.",
            "default": true
          },
          "keepColorProfile": {
            "title": "Keep the color profile (ICC)",
            "type": "boolean",
            "description": "Keeps colors accurate for wide-gamut photos. EXIF metadata (GPS, camera) is always removed.",
            "default": true
          },
          "backgroundColor": {
            "title": "Background for transparency",
            "type": "string",
            "description": "Used when transparent images are saved as JPEG/BMP, and for 'contain' padding.",
            "default": "#ffffff"
          },
          "createZip": {
            "title": "Also create a ZIP",
            "type": "boolean",
            "description": "Bundle all outputs in one ZIP (free).",
            "default": true
          },
          "createShareableUrl": {
            "title": "Create shareable download links",
            "type": "boolean",
            "description": "Also return signed links that work without an Apify token. Anyone with a link can download that file.",
            "default": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}