---
title: "Remove Background"
method: POST
path: "/background/remove"
tags: ["Image Editing"]
---

# Remove Background

`POST /background/remove`

**Description**

The *Remove BG* Route can be used to remove the background of an image. This route leverages Bria's newest model, RMBG 2.0. For more details and to explore the model, check out the [Hugging Face demo](https://huggingface.co/spaces/briaai/BRIA-RMBG-2.0).

**The main difference between the regular and this isolated background removal endpoint is that you can use this endpoint without uploading or registering the image to Bria.**


**Constraints**

The Bria API currently supports only JPEG and PNG files in RGB, RGBA, or CMYK color modes. When the file is of a different type or color mode, the status code 415 will be returned.

**Remove the background from an image using the image file**


  In our documentation request example, we demonstrate how to remove the background from an image using the image URL.
  
  
  If you want to use an image from a file, follow the example below:


      import requests

      url = "https://engine.prod.bria-api.com/v1/background/remove"

      payload = {}
      files=[
        ('file',('image_name.jpeg',open('/path_to_local_file/image_name.jpeg','rb'),'image/jpeg'))
      ]
      headers = {
        'api_token': 'xxxx'
      }

      response = requests.request("POST", url, headers=headers, data=payload, files=files)

      print(response.text)

## Headers

- `api_token` string, required

## Response `200`

Successful operation.

- object
  - `result_url` string — URL that represents the updated visual created in the request. It is a temporary URL that will expire.

## Other responses

- `206` — File value was not provided.
- `400` — Request doesn't contain file part.
- `405` — Method not allowed.
- `415` — Unsupported media type.
- `429` — Request limit exceeded. Your account has reached its maximum allowed requests. Please upgrade your plan or try again later.
- `460` — Failed to download image.
- `500` — Internal server error.
- `506` — Insufficient data. The given input is not supported by the Bria API.

---

[API](https://skmtc.net/bria-ai/apis/the-bria-api.md) · [All operations](https://skmtc.net/bria-ai/apis/the-bria-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/bria-ai/the-bria-api/versions/2768230345a5/schema)
