---
title: "Eraser"
method: POST
path: "/eraser"
tags: ["Image Editing"]
---

# Eraser

`POST /eraser`

**Description**

The *Eraser Route* enables the removal of elements or specific areas from a given image.

You can define the area to be removed by providing a mask that outlines the region to be erased. There are two main ways recommended to generate these masks:
1. Masks can be created by allowing users to draw directly on the image with a brush, for example. To access the SDK that demonstrates how to implement a brush feature in your interface, please refer to the following <a href="https://github.com/Bria-AI/js-api-sdk/blob/main/manual_brush_ui" target="_blank">link</a>.
2. By using the `/objects/mask_generator` route, which will generate all the possible masks for an image.

This capability is powered by our fast ControlNet inpainting model. HF model card is available <a href="https://huggingface.co/briaai/BRIA-2.3-ControlNet-Inpainting" target="_blank">here</a>, and the HF demo space can be found <a href="https://huggingface.co/spaces/briaai/BRIA-2.3-ControlNet-Eraser-API" target="_blank">here</a>

Additionally, ComfyUI nodes that enable running this API route can be found <a href="https://github.com/Bria-AI/ComfyUI-BRIA-API" target="_blank">here</a>

## Headers

- `api_token` string, required

## Request body

- object
  - `image_url` string — The URL of the input image. If both image_url and image_file are provided, image_url will be used. Accepted formats are jpeg, jpg, png, webp.
  - `file` string — The file of the input image, in base64 format. Used if image_url is not provided. Accepted formats are jpeg, jpg, png, webp.
  - `mask_url` string — The URL of the binary mask image that represents the area that will be cleaned. If both mask_url and mask_file are provided, mask_url will be used. Accepted formats - jpeg, jpg, png, webp. The area to be removed should have the value 255 (white), while the rest of the image should have the value 0 (black). **Note:** The input image and mask must have the same aspect ratio.
  - `mask_file` string — The file of the binary mask image that represents the area that will be cleaned, in base64 format. This parameter is used if mask_url is not provided. Accepted formats - jpeg, jpg, png, webp. The area to be removed should have the value 255 (white), while the rest of the image should have the value 0 (black). **Note:** The input image and mask must have the same aspect ratio.
  - `mask_type` 'manual' | 'automatic' — You can use this parameter to specify the type of the input mask from the list. 'manual' opttion should be used in cases in which the mask had been generated by a user (e.g. with a brush tool), and 'automatic' mask type should be used when mask had been generated by an algorithm like 'SAM'.

## 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

- `400` — Bad request. Missing or invalid parameters.
- `401` — Unauthorized. Invalid API key or authentication token.
- `404` — Not found. Image could not be found at the provided URL.
- `415` — Unsupported media type. Invalid file type. Supported file types are jpeg, jpg, png, webp.
- `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. An error occurred on the server.

---

[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/revisions/2768230345a5/schema)
