{
  "openapi": "3.0.1",
  "info": {
    "title": "Image Converter & Compressor: WebP, AVIF, JPEG, PNG in Bulk",
    "description": "Image converter and compressor: convert JPEG, PNG, GIF, TIFF and WebP images from links or dataset fields to WebP, AVIF, JPEG or PNG, resized, with GPS/EXIF removed, plus one ZIP link. Responsive sizes and a KB target. $0.002 per image up to 16 MP, lossless +$0.0025 per started 4 MP; failed free.",
    "version": "0.1",
    "x-build-id": "j4bj3mUAvdjcRbIuu"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/klarto~image-converter/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-klarto-image-converter",
        "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/klarto~image-converter/runs": {
      "post": {
        "operationId": "runs-sync-klarto-image-converter",
        "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/klarto~image-converter/run-sync": {
      "post": {
        "operationId": "run-sync-klarto-image-converter",
        "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": {
          "images": {
            "title": "Images",
            "type": "array",
            "description": "Direct links to images, one per line: JPEG, PNG, WebP, GIF, TIFF, BMP, AVIF or ICO. HEIC, SVG and RAW files are not supported. Repeated links are converted once. Only images you own or may process.",
            "items": {
              "type": "string"
            }
          },
          "datasets": {
            "title": "Datasets with image links",
            "type": "array",
            "description": "Optional: datasets whose rows hold image links, e.g. the output of a scraper or of Bulk File Downloader (field fileUrl). Picking a dataset gives this Actor read access to it (limited permissions). Through the API pass dataset IDs or 'username~name'."
          },
          "imageFields": {
            "title": "Image link fields",
            "type": "array",
            "description": "Fields of the dataset rows that hold the links: imageUrl, media.url, images.0, images.*.url (* = every item of a list). A field may hold one link, a list of links, or objects with a url, src or href key. Ignored without 'Datasets with image links'.",
            "default": [
              "url"
            ],
            "items": {
              "type": "string"
            }
          },
          "format": {
            "title": "Output format",
            "enum": [
              "webp",
              "avif",
              "jpeg",
              "png",
              "same"
            ],
            "type": "string",
            "description": "WebP is the usual choice for websites. AVIF is smaller still but slower to encode. JPEG has no transparency: transparent areas get the background color. 'Same as the source' keeps JPEG/PNG/WebP/AVIF and turns GIF, TIFF, BMP and ICO into PNG. PNG output adds $0.0025 per started 4 MP.",
            "default": "webp"
          },
          "quality": {
            "title": "Quality",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Encoder quality for WebP, AVIF and JPEG (1-100). 75-85 suits photos on the web. Ignored for PNG and lossless WebP.",
            "default": 80
          },
          "maxKb": {
            "title": "Max output size",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Optional size target in KB (1 KB = 1,024 bytes): if a WebP (not lossless), AVIF or JPEG file is bigger, the quality is lowered, never below 20, until it fits. A quality of 20 or less is kept as it is. 0 = no target. The row's 'note' says when the target could not be reached.",
            "default": 0
          },
          "maxWidth": {
            "title": "Max width",
            "minimum": 0,
            "maximum": 20000,
            "type": "integer",
            "description": "Shrink wider images to this width, keeping the aspect ratio. 0 = no limit. Smaller images are never enlarged.",
            "default": 0
          },
          "maxHeight": {
            "title": "Max height",
            "minimum": 0,
            "maximum": 20000,
            "type": "integer",
            "description": "Shrink taller images to this height, keeping the aspect ratio. 0 = no limit. Smaller images are never enlarged.",
            "default": 0
          },
          "fit": {
            "title": "Resize mode",
            "enum": [
              "inside",
              "cover",
              "contain"
            ],
            "type": "string",
            "description": "How 'Max width' and 'Max height' apply. Cover crops the center to the box's shape; contain adds a background-colored border to reach the exact box size. Cover and contain need both values.",
            "default": "inside"
          },
          "widths": {
            "title": "Responsive widths",
            "type": "array",
            "description": "Optional: make several sizes of each image, e.g. [480, 960, 1600] for a srcset. Each size is one output file, charged as one image (plus its 16 MP and lossless blocks). Widths not smaller than the image are made once at the original size. Replaces 'Max width' and 'Max height'."
          },
          "stripMetadata": {
            "title": "Remove metadata",
            "type": "boolean",
            "description": "Remove EXIF, XMP and JPEG comments (camera, GPS location, dates) from the output. The photo is turned upright first, and the color profile is kept so colors stay right (CMYK is turned into sRGB with its own profile).",
            "default": true
          },
          "keepAnimation": {
            "title": "Keep animation",
            "type": "boolean",
            "description": "Animated GIF, WebP, PNG or AVIF stay animated in WebP, AVIF or PNG (APNG) output, up to 300 frames within the memory budget. JPEG output, this option off, multi-page TIFF and MPO keep the first picture.",
            "default": true
          },
          "lossless": {
            "title": "Lossless WebP",
            "type": "boolean",
            "description": "Encode WebP without any quality loss (bigger files; good for logos, screenshots and graphics). Used only with WebP output. Adds $0.0025 per started 4 MP of output (lossless-4mp).",
            "default": false
          },
          "background": {
            "title": "Background color",
            "type": "string",
            "description": "Hex color for transparent areas in JPEG output and for the border in 'contain' mode, e.g. #ffffff or #000.",
            "default": "#ffffff"
          },
          "maxImages": {
            "title": "Max images",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Stop after this many unique links (up to 10,000 per run).",
            "default": 1000
          },
          "maxFileSizeMb": {
            "title": "Max source size",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Bigger source files are not downloaded and are free. Large images also need memory: at the default 1 GB about 33 megapixels per image (16 for transparent images and lossless WebP) and about 19 megapixels per AVIF output; give the run more memory for bigger ones.",
            "default": 50
          },
          "timeoutSecs": {
            "title": "Timeout per image",
            "minimum": 10,
            "maximum": 900,
            "type": "integer",
            "description": "A conversion that takes longer is stopped and free. On Apify a run gets 1/8 of a CPU core per GB of memory; in our test at the default 1 GB a 16-megapixel photo took 53 s as WebP and 133 s as AVIF. Give the run 2-4 GB for AVIF, 'Max output size', lossless WebP or very large images (twice the memory, half the time), or raise this limit.",
            "default": 120
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 16,
            "type": "integer",
            "description": "Downloads at once (at most 2 per site). Conversion uses one process per full CPU core of the run, at least one (measured on Apify: one core per 8 GB of memory).",
            "default": 4
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}