{
  "openapi": "3.0.1",
  "info": {
    "title": "Background Remover API — Batch, Transparent PNG, Pay per Image",
    "description": "Remove the background from one or many image URLs and get, for each image, a dataset item with the transparent PNG or WebP cutout URL, width and height. AI background removal in batch, optional mask, no API key, pay per image.",
    "version": "0.2",
    "x-build-id": "0tGuSeMEwXUmmB5Uv"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sherwood~background-remover-batch/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sherwood-background-remover-batch",
        "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/sherwood~background-remover-batch/runs": {
      "post": {
        "operationId": "runs-sync-sherwood-background-remover-batch",
        "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/sherwood~background-remover-batch/run-sync": {
      "post": {
        "operationId": "run-sync-sherwood-background-remover-batch",
        "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 URLs of the images to process (JPG, PNG, WebP), as a list. One dataset item is returned per URL, with an index matching the input order. For a single URL, or several URLs in one comma- or newline-separated string, use imageUrl instead. Aliases merged into this list: imageUrl, urls, images, startUrls.",
            "default": [
              "https://storage.googleapis.com/falserverless/example_inputs/birefnet-input.jpeg",
              "https://storage.googleapis.com/falserverless/example_inputs/dog.png"
            ],
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Dataset with the images (instead of URLs)",
            "type": "string",
            "description": "Read the image URLs from an Apify dataset: the output of a scraper or of sherwood/image-generator-batch. When this Actor runs as an integration after another Actor, leave it empty: the dataset of the run that triggered it is used. The sample imageUrls are ignored when a dataset is given."
          },
          "urlField": {
            "title": "Image URL field",
            "type": "string",
            "description": "Field of each dataset item that holds the image URL. Dots for nested fields, [] for every element of a list, [0] for the first one: outputUrl, highResolutionImages, images[].url, photo.thumbnails[0].url. Several fields separated by commas are tried in order. Empty: detected automatically (outputUrl, highResolutionImages, imageUrls, images, imageUrl, image, photos, displayUrl, mainImage, thumbnailImage...)."
          },
          "maxImagesPerItem": {
            "title": "Images per dataset item",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many image URLs to take from each dataset item, in order. Default 1: the first one, usually the main image.",
            "default": 1
          },
          "keepFields": {
            "title": "Fields to keep from each item",
            "type": "array",
            "description": "Fields copied from each dataset item into its result, under source: asin, sku, url, title... Same path syntax as urlField.",
            "items": {
              "type": "string"
            }
          },
          "imageUrl": {
            "title": "Single image URL (alias)",
            "type": "string",
            "description": "A single image URL, or several URLs in one comma- or newline-separated string (they are split). Merged with imageUrls."
          },
          "urls": {
            "title": "urls (alias)",
            "type": "array",
            "description": "Alias of imageUrls.",
            "items": {
              "type": "string"
            }
          },
          "images": {
            "title": "images (alias)",
            "type": "array",
            "description": "Alias of imageUrls.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "startUrls (alias)",
            "type": "array",
            "description": "Alias of imageUrls. Accepts plain strings or {\"url\": \"...\"} objects.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "mode": {
            "title": "Subject type",
            "enum": [
              "general",
              "portrait",
              "matting",
              "heavy"
            ],
            "type": "string",
            "description": "general works for products, objects and most photos. portrait is tuned for people (hair, skin edges). matting keeps semi-transparent edges (hair, glass, fur). heavy is slower and more accurate for complex scenes.",
            "default": "general"
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "png",
              "webp"
            ],
            "type": "string",
            "description": "png keeps full transparency and is the safest choice. webp is smaller and also keeps transparency.",
            "default": "png"
          },
          "includeMask": {
            "title": "Also return the mask",
            "type": "boolean",
            "description": "When true, each item also carries maskUrl: a black-and-white PNG of the segmentation mask, useful for compositing.",
            "default": false
          },
          "highResolution": {
            "title": "High-resolution processing",
            "type": "boolean",
            "description": "Process at 2048×2048 instead of 1024×1024. More accurate edges on large images, about twice as slow.",
            "default": false
          },
          "maxImages": {
            "title": "Max images per run",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Stop after this many images. Protects against oversized lists. Default 100.",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}