{
  "openapi": "3.0.1",
  "info": {
    "title": "Image Toolkit: Resize, Convert, Compress, Crop, Watermark",
    "description": "Resize, convert (PNG, JPG, WebP, AVIF), compress, crop, rotate, thumbnail, watermark or strip EXIF/GPS metadata from a list of image links. One result row per image, files in the key-value store. USD 0.005 per image; failures are free.",
    "version": "0.1",
    "x-build-id": "gC6PaNTRs5gyB72yq"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tanod~image-toolkit/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tanod-image-toolkit",
        "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/tanod~image-toolkit/runs": {
      "post": {
        "operationId": "runs-sync-tanod-image-toolkit",
        "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/tanod~image-toolkit/run-sync": {
      "post": {
        "operationId": "run-sync-tanod-image-toolkit",
        "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",
        "required": [
          "operation",
          "urls"
        ],
        "properties": {
          "operation": {
            "title": "Operation",
            "enum": [
              "resize",
              "convert",
              "compress",
              "crop",
              "rotate",
              "thumbnail",
              "strip-metadata",
              "watermark"
            ],
            "type": "string",
            "description": "What to do to every image. The options below apply to the operation they are named after and are ignored otherwise.",
            "default": "resize"
          },
          "urls": {
            "title": "Image links",
            "type": "array",
            "description": "Public http(s) links to the images (PNG, JPEG, WebP, GIF, TIFF, BMP, ICO or AVIF; at most 10 MB and 40 megapixels each; at most 200 per run). Private, internal and IP-address hosts are refused. SVG, HEIC, PSD and PDF are not supported.",
            "items": {
              "type": "string"
            }
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "png",
              "jpeg",
              "webp",
              "gif",
              "tiff",
              "bmp",
              "ico",
              "avif"
            ],
            "type": "string",
            "description": "Convert: the format to convert to (required). Other operations: leave empty to keep the input format; compress can write jpeg, png, webp or avif."
          },
          "quality": {
            "title": "Quality",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Quality for lossy output formats (1-100). Leave empty for the service default."
          },
          "width": {
            "title": "Resize: width (px)",
            "minimum": 1,
            "maximum": 32768,
            "type": "integer",
            "description": "Resize: target width in pixels. Give width, height or scale."
          },
          "height": {
            "title": "Resize: height (px)",
            "minimum": 1,
            "maximum": 32768,
            "type": "integer",
            "description": "Resize: target height in pixels."
          },
          "scale": {
            "title": "Resize: scale factor",
            "minimum": 0.01,
            "maximum": 10,
            "type": "number",
            "description": "Resize: scale factor instead of width and height, e.g. 0.5 for half size. Images are not enlarged beyond their original size."
          },
          "fit": {
            "title": "Resize: fit",
            "enum": [
              "inside",
              "contain",
              "cover",
              "fill"
            ],
            "type": "string",
            "description": "Resize: inside (keep ratio, fit in the box), contain (letterbox), cover (centre crop to fill) or fill (stretch).",
            "default": "inside"
          },
          "maxBytes": {
            "title": "Compress: byte budget",
            "minimum": 1000,
            "maximum": 15000000,
            "type": "integer",
            "description": "Compress: find the highest quality that gives a file of at most this many bytes. Leave empty to use Quality."
          },
          "cropLeft": {
            "title": "Crop: left (px)",
            "minimum": 0,
            "maximum": 32768,
            "type": "integer",
            "description": "Crop: left edge of the box. Default 0 when a box is used."
          },
          "cropTop": {
            "title": "Crop: top (px)",
            "minimum": 0,
            "maximum": 32768,
            "type": "integer",
            "description": "Crop: top edge of the box. Default 0 when a box is used."
          },
          "cropWidth": {
            "title": "Crop: width (px)",
            "minimum": 1,
            "maximum": 32768,
            "type": "integer",
            "description": "Crop: box width. Give both width and height, or an aspect ratio."
          },
          "cropHeight": {
            "title": "Crop: height (px)",
            "minimum": 1,
            "maximum": 32768,
            "type": "integer",
            "description": "Crop: box height."
          },
          "aspect": {
            "title": "Crop: aspect ratio",
            "type": "string",
            "description": "Crop to an aspect ratio such as 16:9 or 1:1 instead of a box."
          },
          "gravity": {
            "title": "Crop / thumbnail: anchor",
            "enum": [
              "center",
              "north",
              "south",
              "east",
              "west",
              "northwest",
              "northeast",
              "southwest",
              "southeast"
            ],
            "type": "string",
            "description": "Where the crop (aspect ratio) or thumbnail crop is anchored.",
            "default": "center"
          },
          "angle": {
            "title": "Rotate: angle (degrees)",
            "minimum": -360,
            "maximum": 360,
            "type": "number",
            "description": "Rotate: degrees clockwise. Multiples of 90 are lossless.",
            "default": 90
          },
          "flip": {
            "title": "Rotate: flip",
            "enum": [
              "none",
              "horizontal",
              "vertical",
              "both"
            ],
            "type": "string",
            "description": "Rotate: also flip the image.",
            "default": "none"
          },
          "thumbnailSizes": {
            "title": "Thumbnail sizes",
            "type": "array",
            "description": "Thumbnails: 1 to 8 sizes as WIDTHxHEIGHT, e.g. 128x128. Each size becomes its own file; the whole image counts as one charged event.",
            "items": {
              "type": "string"
            }
          },
          "thumbnailFit": {
            "title": "Thumbnail: fit",
            "enum": [
              "cover",
              "contain"
            ],
            "type": "string",
            "description": "Thumbnails: cover (smart centre crop) or contain (whole image inside the size).",
            "default": "cover"
          },
          "watermarkText": {
            "title": "Watermark: text",
            "type": "string",
            "description": "Watermark: the text to stamp (1 to 200 characters)."
          },
          "watermarkPosition": {
            "title": "Watermark: position",
            "enum": [
              "center",
              "top",
              "bottom",
              "left",
              "right",
              "top-left",
              "top-right",
              "bottom-left",
              "bottom-right"
            ],
            "type": "string",
            "description": "Watermark: where the text goes (ignored when tiled).",
            "default": "bottom-right"
          },
          "watermarkOpacity": {
            "title": "Watermark: opacity",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "Watermark: 0 (invisible) to 1 (solid).",
            "default": 0.5
          },
          "watermarkColor": {
            "title": "Watermark: colour",
            "type": "string",
            "description": "Watermark: text colour as #rrggbb.",
            "default": "#ffffff"
          },
          "watermarkTile": {
            "title": "Watermark: tile across the image",
            "type": "boolean",
            "description": "Watermark: repeat the text in a staggered grid instead of a single mark.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}