{
  "openapi": "3.0.1",
  "info": {
    "title": "Background Remover - Image Converter, Compressor & Resizer",
    "description": "Remove image backgrounds in bulk with AI (hair and fur kept): transparent PNG/WebP or any color, crop to subject. Plus resize, convert to WebP/AVIF/JPEG and compress.",
    "version": "0.1",
    "x-build-id": "E3DYsh2IXeHzghzRD"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/tidytools~ai-image-toolkit/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-tidytools-ai-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/tidytools~ai-image-toolkit/runs": {
      "post": {
        "operationId": "runs-sync-tidytools-ai-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/tidytools~ai-image-toolkit/run-sync": {
      "post": {
        "operationId": "run-sync-tidytools-ai-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",
        "properties": {
          "operation": {
            "title": "What to do",
            "enum": [
              "removeBackground",
              "resize",
              "convert",
              "compress"
            ],
            "type": "string",
            "description": "removeBackground = cut out the subject with AI (transparent or colored background). resize = change the size. convert = change the format. compress = make files smaller. Background removal costs more than the other three.",
            "default": "removeBackground"
          },
          "imageUrls": {
            "title": "Image URLs",
            "type": "array",
            "description": "Main input (fill this, or one of the optional sources below). Direct links to images (JPEG, PNG, WebP or GIF), up to 10 MB, 50 megapixels and 12,000 px per side each, one per line. Google Drive, Dropbox and OneDrive share links work. Lines that are not a URL are reported as invalid and not charged; the same URL twice is processed once.",
            "items": {
              "type": "string"
            }
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "auto",
              "png",
              "webp",
              "jpeg",
              "avif"
            ],
            "type": "string",
            "description": "auto = background removal: PNG (JPEG when a background color is set); resize and compress: the input's format; convert: WebP. PNG and WebP keep transparency. AVIF is limited to 1,200 px per side (larger results are written as WebP). Compress cannot output PNG.",
            "default": "auto"
          },
          "backgroundColor": {
            "title": "Background color (optional)",
            "type": "string",
            "description": "Background removal: color behind the subject instead of transparency, e.g. #ffffff, f5f5f5, rgb(0,0,0) or white. Resize with fit \"pad\", and JPEG output of transparent images: the fill color (default white for JPEG)."
          },
          "cropToSubject": {
            "title": "Crop to the subject",
            "type": "boolean",
            "description": "Background removal only: trim the empty margin around the cut-out subject.",
            "default": false
          },
          "cropMargin": {
            "title": "Margin around the subject (px)",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "With \"Crop to the subject\": pixels of margin kept around the subject.",
            "default": 0
          },
          "maxSize": {
            "title": "Max size (longest side, px)",
            "minimum": 16,
            "maximum": 8000,
            "type": "integer",
            "description": "Background removal, convert and compress: scale results down so the longest side is at most this many pixels (never up). Empty = keep the size."
          },
          "width": {
            "title": "Width (px)",
            "minimum": 1,
            "maximum": 8000,
            "type": "integer",
            "description": "Resize only: target width. Give width, height or both."
          },
          "height": {
            "title": "Height (px)",
            "minimum": 1,
            "maximum": 8000,
            "type": "integer",
            "description": "Resize only: target height."
          },
          "fit": {
            "title": "Fit",
            "enum": [
              "contain",
              "scale-down",
              "cover",
              "crop",
              "pad",
              "squeeze"
            ],
            "type": "string",
            "description": "Resize only. contain = fit inside the box, keep the aspect ratio (may enlarge); scale-down = like contain, never enlarges; cover = fill the box and crop; crop = like cover, never enlarges; pad = fit inside and fill the rest with the background color (transparent by default); squeeze = stretch to the exact size.",
            "default": "contain"
          },
          "gravity": {
            "title": "Crop focus",
            "enum": [
              "center",
              "auto",
              "top",
              "bottom",
              "left",
              "right"
            ],
            "type": "string",
            "description": "Resize with fit cover or crop: which part to keep. auto = the most interesting area.",
            "default": "center"
          },
          "quality": {
            "title": "Quality (1-100)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "JPEG, WebP and AVIF quality (PNG is lossless). Empty = 90 for background removal, 85 for resize and convert, 75 for compress."
          },
          "imageUrlSources": {
            "title": "Image URL list or file (optional)",
            "type": "array",
            "description": "The same as \"Image URLs\", in the URL list editor: you can also upload or link a text/CSV file of image links.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "datasetId": {
            "title": "Dataset ID (optional)",
            "type": "string",
            "description": "Take image URLs from another Actor run's dataset (e.g. a product scraper's image field)."
          },
          "datasetField": {
            "title": "Dataset field",
            "type": "string",
            "description": "Field with the image URL, e.g. \"imageUrl\", or an array of image URLs such as \"images\" (up to 100 per item). Empty = the first URL field found."
          },
          "keyValueStoreId": {
            "title": "Key-value store with images (optional)",
            "type": "string",
            "description": "Process image files stored in a key-value store (for example files you uploaded). All records are used unless you list keys below; records that are not images are reported as failed and not charged."
          },
          "keyValueStoreKeys": {
            "title": "Keys in that store (optional)",
            "type": "array",
            "description": "Only these records of the key-value store. Empty = all records.",
            "items": {
              "type": "string"
            }
          },
          "imagesBase64": {
            "title": "Base64 images (optional)",
            "type": "array",
            "description": "Images as base64 strings, data URLs (data:image/png;base64,...) or objects {\"id\": \"sku-17\", \"fileName\": \"shoe.jpg\", \"data\": \"<base64>\"} (id and file name are kept in the results). Mainly for API and AI-agent use."
          },
          "maxImages": {
            "title": "Max images",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Stop after this many images (a cost cap; the rest are listed in SUMMARY).",
            "default": 1000
          },
          "maxConcurrency": {
            "title": "Parallel images",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many images are processed at the same time.",
            "default": 4
          },
          "proxyConfiguration": {
            "title": "Proxy (optional)",
            "type": "object",
            "description": "Only used when an image host refuses our servers and the Actor downloads the image itself. Apify proxy usage is billed to your Apify account."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}