{
  "openapi": "3.0.1",
  "info": {
    "title": "AI Image Upscaler & Background Remover (CPU)",
    "description": "Upscale images 2x-4x with Real-ESRGAN and remove backgrounds with U2-Net in one Actor. Bulk URLs in, downloadable PNG/WebP/JPEG out, one dataset row per image. Pay only for successfully processed images.",
    "version": "0.1",
    "x-build-id": "NbKYariPZjM1kHD8k"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/singgendarhan~ai-image-upscaler-background-remover/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-singgendarhan-ai-image-upscaler-background-remover",
        "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/singgendarhan~ai-image-upscaler-background-remover/runs": {
      "post": {
        "operationId": "runs-sync-singgendarhan-ai-image-upscaler-background-remover",
        "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/singgendarhan~ai-image-upscaler-background-remover/run-sync": {
      "post": {
        "operationId": "run-sync-singgendarhan-ai-image-upscaler-background-remover",
        "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 http(s) links to the images to process, one per line. Supported formats: JPEG, PNG (including transparent), WebP, GIF (first frame), BMP, TIFF, AVIF. Links to files in an Apify key-value store work too.",
            "items": {
              "type": "string"
            }
          },
          "operation": {
            "title": "Operation",
            "enum": [
              "upscale",
              "remove_background",
              "remove_background_and_upscale"
            ],
            "type": "string",
            "description": "What to do with each image. 'Upscale' makes it 2-4x larger and sharper (Real-ESRGAN). 'Remove background' cuts out the main subject onto a transparent (or solid-color) background (U2-Net). 'Remove background, then upscale' does both and returns one image.",
            "default": "upscale"
          },
          "scale": {
            "title": "Upscale factor",
            "minimum": 2,
            "maximum": 4,
            "type": "integer",
            "description": "How many times larger the output should be (2, 3 or 4). Used only when the operation includes upscaling. The price depends on the input size, not on the factor (2x and 4x run the same network).",
            "default": 4
          },
          "outputFormat": {
            "title": "Output format",
            "enum": [
              "png",
              "webp",
              "jpeg"
            ],
            "type": "string",
            "description": "File format of the processed images. PNG and WebP keep transparency. JPEG has no transparency, so a removed background is filled with the background color (white by default).",
            "default": "png"
          },
          "backgroundColor": {
            "title": "Background color",
            "pattern": "^(#?[0-9a-fA-F]{6})?$",
            "type": "string",
            "description": "Optional hex color (for example #FFFFFF for a pure white e-commerce background) to fill transparent areas with. Leave empty to keep transparency (PNG/WebP)."
          },
          "squareCanvas": {
            "title": "Center subject on a square canvas",
            "type": "boolean",
            "description": "E-commerce layout: crop to the cut-out subject and center it on a square canvas with a margin. Combine with background color #FFFFFF for marketplace-style main images. Needs an operation with background removal.",
            "default": false
          },
          "canvasMarginPercent": {
            "title": "Canvas margin",
            "minimum": 0,
            "maximum": 40,
            "type": "number",
            "description": "Empty space around the subject on each side of the square canvas, as a percentage of the canvas size (5 means the subject spans about 90% of the canvas).",
            "default": 5
          },
          "keyValueStoreId": {
            "title": "Key-value store with images",
            "type": "string",
            "description": "Optional. ID or name of an Apify key-value store that holds image files to process (use together with 'Record keys'). Leave empty if you only use image URLs."
          },
          "keyValueStoreKeys": {
            "title": "Record keys",
            "type": "array",
            "description": "Keys of the image records in the key-value store above, one per line (for example product-001.jpg).",
            "items": {
              "type": "string"
            }
          },
          "denoiseStrength": {
            "title": "Denoise strength",
            "minimum": 0,
            "maximum": 1,
            "type": "number",
            "description": "0 keeps grain and fine texture, 1 removes noise and JPEG artifacts most aggressively. 0.5 is the Real-ESRGAN default.",
            "default": 0.5
          },
          "outputQuality": {
            "title": "JPEG / WebP quality",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "Compression quality for JPEG and WebP outputs (1-100). 100 makes WebP lossless. Ignored for PNG.",
            "default": 90
          },
          "maxUpscaleInputMegapixels": {
            "title": "Max input size for upscaling",
            "minimum": 0.01,
            "maximum": 4,
            "type": "number",
            "description": "Images larger than this (width x height / 1,000,000) are not upscaled and get a clear error instead. Default 2 MP (e.g. 1600x1250), maximum 4 MP. Background removal works on images up to 40 MP regardless.",
            "default": 2
          },
          "maxFileSizeMb": {
            "title": "Max file size",
            "minimum": 0.1,
            "maximum": 100,
            "type": "number",
            "description": "Downloads larger than this are skipped with a FILE_TOO_LARGE error.",
            "default": 25
          },
          "downloadTimeoutSecs": {
            "title": "Download timeout",
            "minimum": 5,
            "maximum": 300,
            "type": "integer",
            "description": "Timeout for each download attempt. Failed downloads are retried up to 3 times with backoff (honoring Retry-After).",
            "default": 30
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}