{
  "openapi": "3.0.0",
  "info": {
    "title": "Background Removal API",
    "description": "Remove the background of any image",
    "version": "1.0.0",
    "x-jentic-source-url": "https://www.remove.bg/api/swagger.yaml"
  },
  "servers": [
    {
      "url": "https://api.remove.bg/v1.0"
    }
  ],
  "security": [
    {
      "APIKeyHeader": []
    }
  ],
  "paths": {
    "/removebg": {
      "post": {
        "tags": [
          "Background Removal"
        ],
        "summary": "Remove the background of an image",
        "description": "Removes the background of a JPG/PNG/WebP image.\n\n* File size: up to 22 MB\n* Input resolution: up to 50 megapixels\n* Image source: File upload (binary or as base64 encoded string) or download from URL\n* Image Content: Any photo with a foreground [(e.g. people, products, animals, cars, etc.)](/supported-images)\n* Output resolutions available: Preview (up to 0.25 megapixels), Full (up to 25 megapixels), 50MP (up to 50 megapixels)\n\nRequires either an API Key to be provided in the `X-API-Key` request header or an OAuth 2.0 access token to be provided in the `Authorization` request header.\n",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/RemoveBgMultipart"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RemoveBgJson"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/RemoveBgJson"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image background removed",
            "content": {
              "image/*": {
                "schema": {
                  "type": "string",
                  "format": "binary",
                  "example": "(binary image data)"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RemoveBgJsonResponse"
                }
              }
            },
            "headers": {
              "X-Type": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "person",
                    "product",
                    "animal",
                    "car",
                    "car_interior",
                    "car_part",
                    "transportation",
                    "graphics",
                    "other"
                  ]
                },
                "description": "Detected foreground type (How specific this classification is depends on the type_level parameter sent in the request)"
              },
              "X-Width": {
                "schema": {
                  "type": "integer"
                },
                "description": "Width of the result image"
              },
              "X-Height": {
                "schema": {
                  "type": "integer"
                },
                "description": "Height of the result image"
              },
              "X-Credits-Charged": {
                "schema": {
                  "type": "float"
                },
                "description": "Amount of credits charged for this call"
              },
              "X-Foreground-Top": {
                "schema": {
                  "type": "integer"
                },
                "description": "Top position of the foreground image along the vertical axis. In case the input image resolution is higher than the limit (> 50 megapixels) this value is expressed with respect to the input image resolution."
              },
              "X-Foreground-Left": {
                "schema": {
                  "type": "integer"
                },
                "description": "Left position of the foreground image along the horizontal axis. In case the input image resolution is higher than the limit (> 50 megapixels) this value is expressed with respect to the input image resolution."
              },
              "X-Foreground-Width": {
                "schema": {
                  "type": "integer"
                },
                "description": "Width of the foreground image. In case the input image resolution is higher than the limit (> 50 megapixels) this value is expressed with respect to the input image resolution."
              },
              "X-Foreground-Height": {
                "schema": {
                  "type": "integer"
                },
                "description": "Height of the foreground image. In case the input image resolution is higher than the limit (> 50 megapixels) this value is expressed with respect to the input image resolution."
              }
            }
          },
          "400": {
            "description": "Error: Invalid parameters or input file unprocessable (no credits charged)",
            "content": {
              "*/*": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "code": {
                            "type": "string",
                            "description": "Error code",
                            "example": "file_too_large"
                          },
                          "title": {
                            "type": "string",
                            "description": "Error message",
                            "example": "File too large"
                          },
                          "detail": {
                            "type": "string",
                            "description": "Detailed description of the error",
                            "example": "File exceeds limit of 22MB"
                          }
                        }
                      }
                    }
                  }
                },
                "examples": {
                  "multiple_sources": {
                    "value": {
                      "errors": [
                        {
                          "code": "multiple_sources",
                          "title": "Multiple image sources given: Please provide either the image_url, image_file or image_file_b64 parameter."
                        }
                      ]
                    }
                  },
                  "missing_source": {
                    "value": {
                      "errors": [
                        {
                          "code": "missing_source",
                          "title": "No image given",
                          "detail": "Please provide the source image in the image_url, image_file or image_file_b64 parameter."
                        }
                      ]
                    }
                  },
                  "invalid_image_url": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_image_url",
                          "title": "Invalid image_url: Please provide a valid URL."
                        }
                      ]
                    }
                  },
                  "invalid_format": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_format",
                          "title": "Invalid format parameter given"
                        }
                      ]
                    }
                  },
                  "invalid_roi": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_roi",
                          "title": "Invalid roi parameter given"
                        }
                      ]
                    }
                  },
                  "invalid_semitransparency": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_semitransparency",
                          "title": "Invalid semitransparency parameter given"
                        }
                      ]
                    }
                  },
                  "invalid_crop_margin": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_crop_margin",
                          "title": "Invalid crop_margin parameter given"
                        }
                      ]
                    }
                  },
                  "invalid_scale": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_scale",
                          "title": "Invalid scale parameter given"
                        }
                      ]
                    }
                  },
                  "invalid_position": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_position",
                          "title": "Invalid position parameter given"
                        }
                      ]
                    }
                  },
                  "invalid_bg_color": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_bg_color",
                          "title": "Invalid bg_color parameter given"
                        }
                      ]
                    }
                  },
                  "invalid_bg_image_url": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_bg_image_url",
                          "title": "Invalid bg_image_url: Please provide a valid URL."
                        }
                      ]
                    }
                  },
                  "multiple_bg_sources": {
                    "value": {
                      "errors": [
                        {
                          "code": "multiple_bg_sources",
                          "title": "Multiple background sources given: Please provide either the bg_color, the bg_image_url or the bg_image_file parameter."
                        }
                      ]
                    }
                  },
                  "failed_bg_download": {
                    "value": {
                      "errors": [
                        {
                          "code": "failed_bg_download",
                          "title": "Failed to download background image from given image_url: https://unsplash.com/"
                        }
                      ]
                    }
                  },
                  "failed_image_download": {
                    "value": {
                      "errors": [
                        {
                          "code": "failed_image_download",
                          "title": "Failed to download image from given image_url: https://unsplash.com/"
                        }
                      ]
                    }
                  },
                  "file_too_large": {
                    "value": {
                      "errors": [
                        {
                          "code": "file_too_large",
                          "title": "File too large",
                          "detail": "File exceeds limit of 22MB"
                        }
                      ]
                    }
                  },
                  "invalid_file_type": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_file_type",
                          "title": "Invalid file type",
                          "detail": "Expected jpg/png/webp, received mp4"
                        }
                      ]
                    }
                  },
                  "invalid_dimensions": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_dimensions",
                          "title": "Failed to read image dimensions",
                          "detail": "The dimensions of the given image could not be read."
                        }
                      ]
                    }
                  },
                  "resolution_too_high": {
                    "value": {
                      "errors": [
                        {
                          "code": "resolution_too_high",
                          "title": "Image resolution too high",
                          "detail": "Input image has 60 megapixels, maximum supported input resolution is 50 megapixels"
                        }
                      ]
                    }
                  },
                  "roi_exceeds_bounds": {
                    "value": {
                      "errors": [
                        {
                          "code": "roi_exceeds_bounds",
                          "title": "ROI exceeds image bounds",
                          "detail": "The given roi parameter defines a region that exceeds the image bounds"
                        }
                      ]
                    }
                  },
                  "roi_region_empty": {
                    "value": {
                      "errors": [
                        {
                          "code": "roi_region_empty",
                          "title": "ROI region is empty",
                          "detail": "The given roi parameter defines an empty region"
                        }
                      ]
                    }
                  },
                  "unknown_foreground": {
                    "value": {
                      "errors": [
                        {
                          "code": "unknown_foreground",
                          "title": "Could not identify foreground in image. For details and recommendations see https://www.remove.bg/supported-images."
                        }
                      ]
                    }
                  },
                  "failed_to_read_image": {
                    "value": {
                      "errors": [
                        {
                          "code": "failed_to_read_image",
                          "title": "There was an error reading the image."
                        }
                      ]
                    }
                  },
                  "invalid_size": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_size",
                          "title": "Invalid value for parameter 'size'"
                        }
                      ]
                    }
                  },
                  "invalid_channels": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_channels",
                          "title": "Invalid value for parameter 'channels'"
                        }
                      ]
                    }
                  },
                  "multiple_shadow_params": {
                    "value": {
                      "errors": [
                        {
                          "code": "multiple_shadow_params",
                          "title": "Multiple shadow parameters given: Please provide either the add_shadow or the shadow_type parameter."
                        }
                      ]
                    }
                  },
                  "invalid_shadow_opacity": {
                    "value": {
                      "errors": [
                        {
                          "code": "invalid_shadow_opacity",
                          "title": "Invalid shadow_opacity parameter given"
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Error: Insufficient credits (no credits charged)",
            "content": {
              "*/*": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string",
                            "description": "Error message",
                            "example": "Insufficient credits"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Error: Authentication failed (no credits charged)",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/AuthFailed"
                }
              }
            }
          },
          "429": {
            "description": "Error: Rate limit exceeded (no credits charged)",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimit"
                }
              }
            }
          }
        }
      }
    },
    "/improve": {
      "post": {
        "tags": [
          "Improvement Program"
        ],
        "description": "Submit an image to the remove.bg Improvement program\n* Contribute an image that remove.bg is currently not able to remove the background from properly\n* Help us make remove.bg better\n* Get better results for similiar images in the future\n\nNotes:\n  * By submitting images through the API you agree to the <a target=\"_blank\" rel=\"noopener\" href=\"/ipc\">Improvement Program Conditions</a>\n  * File size: up to 22MB\n  * Input resolution: up to 50 megapixels\n  * up to 100 files per day. <br> Higher rate limits are only available to high-volume solution users; get in touch <a href=\"/enterprise/contact\">here</a>.\n\nRequires either an API Key to be provided in the `X-API-Key` request header or an OAuth 2.0 access token to be provided in the `Authorization` request header.\n\nPlease note that submissions are used on a best-effort basis and the extent of expected improvement varies depending on many factors, including the number of provided images, their complexity and visual similarity. Improvements usually take several weeks to become effective.\n",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/ImprovementProgramMultipart"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ImprovementProgramJson"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/ImprovementProgramJson"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image submitted",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ImprovementProgramJsonResponse"
                }
              }
            }
          },
          "400": {
            "description": "Error: Invalid parameters or input file unprocessable",
            "content": {
              "*/*": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "title": {
                            "type": "string",
                            "description": "Error message",
                            "example": "File too large"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Error: Authentication failed",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/AuthFailed"
                }
              }
            }
          },
          "429": {
            "description": "Error: Rate limit exceeded",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimit"
                }
              }
            }
          }
        }
      }
    },
    "/account": {
      "get": {
        "tags": [
          "Fetch account info"
        ],
        "summary": "Fetch credit balance and free API calls.",
        "description": "Get the current credit balance and number of free API calls.\n\nNotes:\n\n* Balance changes may be delayed by several seconds. To locally keep track of your credit balance, you should therefore only call this endpoint initially (or e.g. when the user manually triggers a refresh), then use the `X-Credits-Charged` response header returned with each image processing response to adjust the local balance.\n* The \"*sizes*\" field is always \"all\", is deprecated and will soon be removed.\n",
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "attributes": {
                          "type": "object",
                          "properties": {
                            "credits": {
                              "type": "object",
                              "properties": {
                                "total": {
                                  "type": "float",
                                  "example": 200
                                },
                                "subscription": {
                                  "type": "float",
                                  "example": 150
                                },
                                "payg": {
                                  "type": "float",
                                  "example": 50
                                },
                                "enterprise": {
                                  "type": "float",
                                  "example": 0
                                }
                              }
                            },
                            "api": {
                              "type": "object",
                              "properties": {
                                "free_calls": {
                                  "type": "integer",
                                  "example": 50
                                },
                                "sizes": {
                                  "type": "string",
                                  "example": "all"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Error: Authentication failed",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/AuthFailed"
                }
              }
            }
          },
          "429": {
            "description": "Error: Rate limit exceeded",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/RateLimit"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "APIKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "RemoveBgMultipart": {
        "type": "object",
        "properties": {
          "image_file": {
            "type": "string",
            "format": "binary",
            "description": "Source image file (binary). (If this parameter is present, the other image source parameters must be empty.)"
          },
          "image_file_b64": {
            "type": "string",
            "example": "",
            "description": "Source image file (base64-encoded string). (If this parameter is present, the other image source parameters must be empty.)"
          },
          "image_url": {
            "type": "string",
            "example": "https://www.remove.bg/example-hd.jpg",
            "description": "Source image URL. (If this parameter is present, the other image source parameters must be empty.)"
          },
          "size": {
            "type": "string",
            "enum": [
              "preview",
              "full",
              "auto"
            ],
            "default": "preview",
            "description": "Maximum output image resolution:\n\n- **\"preview\"** (default) = Resize image to 0.25 megapixels (e.g., 625×400 pixels) – 0.25 credits per image\n- **\"full\"** = Use original image resolution, up to 25 megapixels (e.g., 6250×4000) with formats ZIP / JPG / WebP, or up to 10 megapixels (e.g., 4000×2500) with PNG – 1 credit per image\n- **\"50MP\"** = Use original image resolution, up to 50 megapixels (e.g., 8000×6250) with formats ZIP / JPG / WebP, or up to 10 megapixels (e.g., 4000×2500) with PNG – 1 credit per image\n- **\"auto\"** = Use highest available resolution, up to 25 megapixels (e.g. 6250×4000) (based on image size and available credits).\n\nFor backwards-compatibility this parameter also accepts the values \"medium\" (up to 1.5 megapixels) and \"hd\" (up to 4 megapixels) for 1 credit per image. The value \"full\" is also available under the name \"4k\" and the value \"preview\" is aliased as \"small\" and \"regular\".\n"
          },
          "type": {
            "type": "string",
            "enum": [
              "auto",
              "car",
              "product",
              "person",
              "animal",
              "graphic",
              "transportation"
            ],
            "default": "auto",
            "description": "Detect or set a foreground **type**.\n\nWe recommend using  **type = auto** to automatically detect the **type** of foreground.\n\nTo specify only one type of foreground, set **type** to one of these values:<br>\n**car,  product, person, animal, graphic, transportation**.\n"
          },
          "type_level": {
            "type": "string",
            "enum": [
              "none",
              1,
              2,
              "latest"
            ],
            "default": 1,
            "description": "Classification level of the detected foreground type:\n\n- **\"none\"** = No classification (X-Type Header won't bet set on the response)\n- **\"1\"** = Use coarse classification classes: [person, product, animal, car, other]\n- **\"2\"** = Use more specific classification classes: [person, product, animal, car, car_interior, car_part, transportation, graphics, other]\n- **\"latest\"** = Always use the latest classification classes available\n"
          },
          "format": {
            "type": "string",
            "enum": [
              "auto",
              "png",
              "jpg",
              "zip",
              "webp"
            ],
            "default": "auto",
            "description": "Result image format:\n\n- **\"auto\"** = Use PNG format if transparent regions exist, otherwise use JPG format (default),\n- **\"png\"** = PNG format with alpha transparency,\n- **\"webp\"** = WebP format with alpha transparency,\n- **\"jpg\"** = JPG format, no transparency,\n- **\"zip\"** = ZIP format, contains color image and alpha matte image, supports transparency (recommended for fastest processing).\n"
          },
          "roi": {
            "type": "string",
            "description": "Region of interest: Only contents of this rectangular region can be detected as foreground. Everything outside is considered background and will be removed. The rectangle is defined as two x/y coordinates in the format \"x1 y1 x2 y2\". The coordinates can be in absolute pixels (suffix 'px') or relative to the width/height of the image (suffix '%'). By default, the whole image is the region of interest (\"0% 0% 100% 100%\").\n",
            "default": "0% 0% 100% 100%"
          },
          "crop": {
            "type": "boolean",
            "description": "Whether to crop off all empty regions (default: false).<br>\n_Note_: Cropping has no effect on the amount of charged credits.\n",
            "default": "false"
          },
          "crop_margin": {
            "type": "string",
            "description": "Adds a margin around the cropped subject (default: 0). Can be an absolute value (e.g. \"30px\") or relative to the subject size (e.g. \"10%\"). Can be a single value (all sides), two values (top/bottom and left/right) or four values (top, right, bottom, left). This parameter only has an effect when \"crop=true\". The maximum margin that can be added on each side is 50% of the subject dimensions or 500 pixels.\n",
            "default": "0"
          },
          "scale": {
            "type": "string",
            "description": "Scales the subject relative to the total image size. Can be any value from \"10%\" to \"100%\", or \"original\" (default). Scaling the subject implies \"position=center\" (unless specified otherwise).\n",
            "default": "original"
          },
          "position": {
            "type": "string",
            "description": "Positions the subject within the image canvas. Can be \"original\" (default unless \"scale\" is given), \"center\" (default when \"scale\" is given) or a value from \"0%\" to \"100%\" (both horizontal and vertical) or two values (horizontal, vertical).\n",
            "default": "original"
          },
          "channels": {
            "type": "string",
            "enum": [
              "rgba",
              "alpha"
            ],
            "default": "rgba",
            "description": "Request either the finalized image (\"rgba\", default) or an alpha mask (\"alpha\").<br>\n_Note_: Since remove.bg also applies RGB color corrections on edges, using only the alpha mask often leads to a lower final image quality. Therefore \"rgba\" is recommended.\n"
          },
          "add_shadow": {
            "type": "boolean",
            "description": "Warning: **add_shadow** is deprecated and will be removed in the next major release, version 2.0. Please use **shadow_type** instead.<br>\n\nSetting **add_shadow = true** will set the **shadow_type** parameter to **shadow_type [car] = car**. A **car** shadow will only be generated if the foreground type is detected or specified as **car**.\n"
          },
          "shadow_type": {
            "type": "string",
            "description": "Generate shadows based on your foreground **type**. remove.bg supports four different shadow types: [**car, 3D, drop, none**](/help/a/enhance-your-images-with-the-ai-shadow-feature).\n\nUse **shadow_type = auto** to automatically assign the most suitable **shadow_type** for each foreground **type**. See the default assignments below. Use **shadow_type = $shadow_type** to specify a single type of shadow for all foreground types.\n\nReplace **shadow_type = auto** with **shadow_type [$type] = $shadow_type** to assign specific shadow types per foreground **type**. Unmentioned foreground **type(s)** will return no shadow.\n\nDefault assignments:<br>\n**shadow_type [car] = car,**<br>\n**shadow_type [product] = drop,**<br>\n**shadow_type [person] = 3D,**<br>\n**shadow_type [animal] = drop,**<br>\n**shadow_type [transportation] = 3D,**<br>\n**shadow_type [graphic] = drop,**<br>\n**shadow_type [other] = drop**\n"
          },
          "shadow_opacity": {
            "type": "string",
            "description": "Set a shadow's opacity, i.e. darkness. Can be set to any value from **0** (lightest) to **100** (darkest) or auto for default values, shown below.\n\n**shadow_opacity = n (0 - 100), auto**\n\nReplace **shadow_opacity = auto** with **shadow_opacity [$type] = $n** to assign specific opacity values per foreground **type**. Unmentioned foreground type(s) with set shadows will fall back on default opacity assignments.\n\nDefault values:<br>\n**shadow_opacity [car] = 90**<br>\n**shadow_opacity [product] = 50**<br>\n**shadow_opacity [person] = 50**<br>\n**shadow_opacity [animal] = 50**<br>\n**shadow_opacity[transportation] = 50**<br>\n**shadow_opacity [graphic] = 50**<br>\n**shadow_opacity [other] = 50**<br>\n"
          },
          "semitransparency": {
            "type": "boolean",
            "description": "Whether to have semi-transparent regions in the result (default: true).<br>\n_Note_: Semitransparency is currently only supported for car windows (this might change in the future). Other objects are returned without semitransparency, even if set to true.\n",
            "default": "true"
          },
          "bg_color": {
            "type": "string",
            "example": "",
            "description": "Adds a solid color background. Can be a hex color code (e.g. 81d4fa, fff) or a color name (e.g. green). For semi-transparency, 4-/8-digit hex codes are also supported (e.g. 81d4fa77). (If this parameter is present, the other bg_ parameters must be empty.)\n"
          },
          "bg_image_url": {
            "type": "string",
            "example": "",
            "description": "Adds a background image from a URL. The image is centered and resized to fill the canvas while preserving the aspect ratio, unless it already has the exact same dimensions as the foreground image. (If this parameter is present, the other bg_ parameters must be empty.)"
          },
          "bg_image_file": {
            "type": "string",
            "format": "binary",
            "description": "Adds a background image from a file (binary). The image is centered and resized to fill the canvas while preserving the aspect ratio, unless it already has the exact same dimensions as the foreground image. (If this parameter is present, the other bg_ parameters must be empty.)"
          }
        }
      },
      "RemoveBgJson": {
        "type": "object",
        "properties": {
          "image_file_b64": {
            "type": "string",
            "example": "",
            "description": "Source image file (base64-encoded string). (If this parameter is present, the other image source parameters must be empty.)"
          },
          "image_url": {
            "type": "string",
            "example": "https://www.remove.bg/example-hd.jpg",
            "description": "Source image URL. (If this parameter is present, the other image source parameters must be empty.)"
          },
          "size": {
            "type": "string",
            "enum": [
              "preview",
              "full",
              "auto"
            ],
            "default": "preview",
            "description": "Maximum output image resolution:\n\n- **\"preview\"** (default) = Resize image to 0.25 megapixels (e.g., 625×400 pixels) – 0.25 credits per image\n- **\"full\"** = Use original image resolution, up to 25 megapixels (e.g., 6250×4000) with formats ZIP / JPG / WebP, or up to 10 megapixels (e.g., 4000×2500) with PNG – 1 credit per image\n- **\"50MP\"** = Use original image resolution, up to 50 megapixels (e.g., 8000×6250) with formats ZIP / JPG / WebP, or up to 10 megapixels (e.g., 4000×2500) with PNG – 1 credit per image\n- **\"auto\"** = Use highest available resolution, up to 25 megapixels (e.g. 6250×4000) (based on image size and available credits).\n\nFor backwards-compatibility this parameter also accepts the values \"medium\" (up to 1.5 megapixels) and \"hd\" (up to 4 megapixels) for 1 credit per image. The value \"full\" is also available under the name \"4k\" and the value \"preview\" is aliased as \"small\" and \"regular\".\n"
          },
          "type": {
            "type": "string",
            "enum": [
              "auto",
              "car",
              "product",
              "person",
              "animal",
              "graphic",
              "transportation"
            ],
            "default": "auto",
            "description": "Detect or set a foreground **type**.\n\nWe recommend using  **type = auto** to automatically detect the **type** of foreground.\n\nTo specify only one type of foreground, set **type** to one of these values:<br>\n**car,  product, person, animal, graphic, transportation**.\n"
          },
          "type_level": {
            "type": "string",
            "enum": [
              "none",
              1,
              2,
              "latest"
            ],
            "default": 1,
            "description": "Classification level of the detected foreground type:\n\n- **\"none\"** = No classification (X-Type Header won't bet set on the response)\n- **\"1\"** = Use coarse classification classes: [person, product, animal, car, other]\n- **\"2\"** = Use more specific classification classes: [person, product, animal, car, car_interior, car_part, transportation, graphics, other]\n- **\"latest\"** = Always use the latest classification classes available\n"
          },
          "format": {
            "type": "string",
            "enum": [
              "auto",
              "png",
              "jpg",
              "zip",
              "webp"
            ],
            "default": "auto",
            "description": "Result image format:\n\n- **\"auto\"** = Use PNG format if transparent regions exist, otherwise use JPG format (default),\n- **\"png\"** = PNG format with alpha transparency,\n- **\"webp\"** = WebP format with alpha transparency,\n- **\"jpg\"** = JPG format, no transparency,\n- **\"zip\"** = ZIP format, contains color image and alpha matte image, supports transparency (recommended for fastest processing).\n"
          },
          "roi": {
            "type": "string",
            "description": "Region of interest: Only contents of this rectangular region can be detected as foreground. Everything outside is considered background and will be removed. The rectangle is defined as two x/y coordinates in the format \"x1 y1 x2 y2\". The coordinates can be in absolute pixels (suffix 'px') or relative to the width/height of the image (suffix '%'). By default, the whole image is the region of interest (\"0% 0% 100% 100%\").\n",
            "default": "0% 0% 100% 100%"
          },
          "crop": {
            "type": "boolean",
            "description": "Whether to crop off all empty regions (default: false).<br>\n_Note_: Cropping has no effect on the amount of charged credits.\n",
            "default": "false"
          },
          "crop_margin": {
            "type": "string",
            "description": "Adds a margin around the cropped subject (default: 0). Can be an absolute value (e.g. \"30px\") or relative to the subject size (e.g. \"10%\"). Can be a single value (all sides), two values (top/bottom and left/right) or four values (top, right, bottom, left). This parameter only has an effect when \"crop=true\". The maximum margin that can be added on each side is 50% of the subject dimensions or 500 pixels.\n",
            "default": "0"
          },
          "scale": {
            "type": "string",
            "description": "Scales the subject relative to the total image size. Can be any value from \"10%\" to \"100%\", or \"original\" (default). Scaling the subject implies \"position=center\" (unless specified otherwise).\n",
            "default": "original"
          },
          "position": {
            "type": "string",
            "description": "Positions the subject within the image canvas. Can be \"original\" (default unless \"scale\" is given), \"center\" (default when \"scale\" is given) or a value from \"0%\" to \"100%\" (both horizontal and vertical) or two values (horizontal, vertical).\n",
            "default": "original"
          },
          "channels": {
            "type": "string",
            "enum": [
              "rgba",
              "alpha"
            ],
            "default": "rgba",
            "description": "Request either the finalized image (\"rgba\", default) or an alpha mask (\"alpha\").<br>\n_Note_: Since remove.bg also applies RGB color corrections on edges, using only the alpha mask often leads to a lower final image quality. Therefore \"rgba\" is recommended.\n"
          },
          "add_shadow": {
            "type": "boolean",
            "description": "Warning: **add_shadow** is deprecated and will be removed in the next major release, version 2.0. Please use **shadow_type** instead.<br>\n\nSetting **add_shadow = true** will set the **shadow_type** parameter to **shadow_type [car] = car**. A **car** shadow will only be generated if the foreground type is detected or specified as **car**.\n"
          },
          "shadow_type": {
            "type": "string",
            "description": "Generate shadows based on your foreground **type**. remove.bg supports four different shadow types: [**car, 3D, drop, none**](/help/a/enhance-your-images-with-the-ai-shadow-feature).\n\nUse **shadow_type = auto** to automatically assign the most suitable **shadow_type** for each foreground **type**. See the default assignments below. Use **shadow_type = $shadow_type** to specify a single type of shadow for all foreground types.\n\nReplace **shadow_type = auto** with **shadow_type [$type] = $shadow_type** to assign specific shadow types per foreground **type**. Unmentioned foreground **type(s)** will return no shadow.\n\nDefault assignments:<br>\n**shadow_type [car] = car,**<br>\n**shadow_type [product] = drop,**<br>\n**shadow_type [person] = 3D,**<br>\n**shadow_type [animal] = drop,**<br>\n**shadow_type [transportation] = 3D,**<br>\n**shadow_type [graphic] = drop,**<br>\n**shadow_type [other] = drop**\n"
          },
          "shadow_opacity": {
            "type": "string",
            "description": "Set a shadow's opacity, i.e. darkness. Can be set to any value from **0** (lightest) to **100** (darkest) or auto for default values, shown below.\n\n**shadow_opacity = n (0 - 100), auto**\n\nReplace **shadow_opacity = auto** with **shadow_opacity [$type] = $n** to assign specific opacity values per foreground **type**. Unmentioned foreground type(s) with set shadows will fall back on default opacity assignments.\n\nDefault values:<br>\n**shadow_opacity [car] = 90**<br>\n**shadow_opacity [product] = 50**<br>\n**shadow_opacity [person] = 50**<br>\n**shadow_opacity [animal] = 50**<br>\n**shadow_opacity[transportation] = 50**<br>\n**shadow_opacity [graphic] = 50**<br>\n**shadow_opacity [other] = 50**<br>\n"
          },
          "semitransparency": {
            "type": "boolean",
            "description": "Whether to have semi-transparent regions in the result (default: true).<br>\n_Note_: Semitransparency is currently only supported for car windows (this might change in the future). Other objects are returned without semitransparency, even if set to true.\n",
            "default": "true"
          },
          "bg_color": {
            "type": "string",
            "example": "",
            "description": "Adds a solid color background. Can be a hex color code (e.g. 81d4fa, fff) or a color name (e.g. green). For semi-transparency, 4-/8-digit hex codes are also supported (e.g. 81d4fa77). (If this parameter is present, the other bg_ parameters must be empty.)\n"
          },
          "bg_image_url": {
            "type": "string",
            "example": "",
            "description": "Adds a background image from a URL. The image is centered and resized to fill the canvas while preserving the aspect ratio, unless it already has the exact same dimensions as the foreground image. (If this parameter is present, the other bg_ parameters must be empty.)"
          }
        }
      },
      "RemoveBgJsonResponse": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "result_b64": {
                "type": "string",
                "description": "Base64 encoded string of result image",
                "example": "iVBORw0KGgoAAAANSUhEUgAAAIsAAACFC..."
              },
              "foreground_top": {
                "type": "integer",
                "description": "Top position of the foreground image along the vertical axis. In case the input image resolution is higher than the limit (> 50 megapixels) this value is expressed with respect to the input image resolution.",
                "example": 0
              },
              "foreground_left": {
                "type": "integer",
                "description": "Left position of the foreground image along the horizontal axis. In case the input image resolution is higher than the limit (> 50 megapixels) this value is expressed with respect to the input image resolution.",
                "example": 0
              },
              "foreground_width": {
                "type": "integer",
                "description": "Width of the foreground image. In case the input image resolution is higher than the limit (> 50 megapixels) this value is expressed with respect to the input image resolution.",
                "example": 100
              },
              "foreground_height": {
                "type": "integer",
                "description": "Height of the foreground image. In case the input image resolution is higher than the limit (> 50 megapixels) this value is expressed with respect to the input image resolution.",
                "example": 100
              }
            }
          }
        }
      },
      "ImprovementProgramMultipart": {
        "type": "object",
        "properties": {
          "image_file": {
            "type": "string",
            "format": "binary",
            "description": "Source image file (binary). (If this parameter is present, the other image source parameters must be empty.)"
          },
          "image_file_b64": {
            "type": "string",
            "example": "",
            "description": "Source image file (base64-encoded string). (If this parameter is present, the other image source parameters must be empty.)"
          },
          "image_url": {
            "type": "string",
            "example": "https://www.remove.bg/example-hd.jpg",
            "description": "Source image URL. (If this parameter is present, the other image source parameters must be empty.)"
          },
          "image_filename": {
            "type": "string",
            "description": "Filename of the image, if not provided it will be autodetected form the submitted data."
          },
          "tag": {
            "type": "string",
            "description": "Images with the same tag are grouped together."
          }
        }
      },
      "ImprovementProgramJson": {
        "type": "object",
        "properties": {
          "image_file_b64": {
            "type": "string",
            "example": "",
            "description": "Source image file (base64-encoded string). (If this parameter is present, the other image source parameters must be empty.)"
          },
          "image_url": {
            "type": "string",
            "example": "https://www.remove.bg/example-hd.jpg",
            "description": "Source image URL. (If this parameter is present, the other image source parameters must be empty.)"
          },
          "image_filename": {
            "type": "string",
            "description": "Filename of the image, if not provided it will be autodetected form the submitted data.",
            "example": "car.jpg"
          },
          "tag": {
            "type": "string",
            "description": "Images with the same tag are grouped together.",
            "example": "batch_1_2020"
          }
        }
      },
      "ImprovementProgramJsonResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID of the submitted image",
            "example": "fe09820b-be79-4511-8836-679583529882"
          }
        }
      },
      "RateLimit": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string",
                  "description": "Error message",
                  "example": "Rate limit exceeded"
                }
              }
            }
          }
        }
      },
      "AuthFailed": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "title": {
                  "type": "string",
                  "description": "Error message",
                  "example": "Missing API Key"
                }
              }
            }
          }
        }
      }
    }
  }
}