# Erase Object by Text

[**Try out this capability in Bria's sandbox**](https://platform.bria.ai/image-editing/erase-object-by-text)
**Description**
Remove specific objects or unwanted elements from an image using natural language descriptions.
This route runs the same pipeline as [Remove Object](/image-editing/editing/remove-object): the object named in `object_name` is found and segmented, then erased by the [Eraser](/image-editing/editing/erase). It takes the same `composite` modes. The only difference is the field name: this route reads `object_name`, and `/remove_object` reads `prompt`.
If nothing in the image matches `object_name`, the request still succeeds and returns the input image unchanged.
**Content Moderation**
- **Prompt Moderation** - Checks `object_name` and stops processing if it contains inappropriate or restricted content. On by default.
- **Input Image Moderation** - Scans the uploaded image and stops processing if inappropriate or restricted content is detected.
- **Output Image Moderation** - Evaluates the generated image and blocks the response if it violates safety guidelines.

**Constraints**
The Bria API supports JPEG, PNG and WEBP 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.
**Example:** object_name: "table"
<table>
<tr>
<th style="text-align: center;">Input Image</th>
<th style="text-align: center;">Output Image</th>
</tr>
<tr>
<td align="center" style="vertical-align: middle;">
<img src="https://bria-datasets.s3.us-east-1.amazonaws.com/Liza/an_empty_table_in_living_room.png" width="300" style="border-radius: 8px;">
</td>
<td align="center" style="vertical-align: middle;">
<img src="https://bria-datasets.s3.us-east-1.amazonaws.com/Liza/hq-RlUr_t6xqVk8j7HU7G_2a39319420e6403f9d4e01c70beaa076.png" width="300" style="border-radius: 8px;">
</td>
</tr>
</table>

Endpoint: POST /erase_by_text
Security: api_token

## Request fields (application/json):

  - `image` (string, required)
    The source image to be handled by the API.
Supported input types:
- **Base64-encoded string** - **URL** pointing to an image file that is publicly accessible and available at the time of processing.

Accepted formats: **JPEG**, **JPG**, **PNG**, **WEBP**.

  - `object_name` (string, required)
    The name of the object to remove (e.g., "the lamp").

  - `composite` (boolean)
    Selects the erase mode.
- **`true` (default), pixel perfect:** Only the object's area is rebuilt and blended into the original. Everything else stays as it was.
- **`false`, context aware:** The model also removes what the object casts outside its outline, such as its shadow or its reflection.

  - `sync` (boolean)
    Specifies the response mode.
- When `false` (default), the request is processed asynchronously: the API immediately returns a status URL to track progress.
- When `true`, the request is processed synchronously: the API holds the connection open until the process is complete and then returns the final image URL in the response.

  - `webhook_url` (string)
    Optional URL for receiving the result via webhook when the async job completes. See [webhooks](/getting-started/async-requests#webhooks).

  - `prompt_content_moderation` (boolean)
    When enabled, applies content moderation to `object_name`.
Expected behavior:
- Processing stops if `object_name` fails moderation.
- Returns a 422 error with details about which parameter failed.

  - `visual_input_content_moderation` (boolean)
    When enabled, applies content moderation to input visual.
Expected behavior:
- Processing stops if the image fails moderation.
- Returns a 422 error with details about which parameter failed.

  - `visual_output_content_moderation` (boolean)
    When enabled, applies content moderation to result visual.
Expected behavior:
- If the modified image fails moderation, returns a 422 error.

## Response 200 fields (application/json):

  - `result` (object, required)

  - `result.image_url` (string, required)

  - `request_id` (string, required)

## Response 202 fields (application/json):

  - `request_id` (string, required)

  - `status_url` (string, required)

## Response 400 fields (application/json):

  - `error` (object, required)

  - `error.code` (integer, required)
    Example: 123

  - `error.message` (string, required)

  - `error.details` (string, required)

  - `request_id` (string, required)

## Response 401 fields (application/json):

  - `error` (object, required)

  - `error.code` (integer, required)
    Example: 123

  - `error.message` (string, required)

  - `error.details` (string, required)

  - `request_id` (string, required)

## Response 403 fields (application/json):

  - `error` (object, required)

  - `error.code` (integer, required)
    Example: 123

  - `error.message` (string, required)

  - `error.details` (string, required)

  - `request_id` (string, required)

## Response 404 fields (application/json):

  - `error` (object, required)

  - `error.code` (integer, required)
    Example: 123

  - `error.message` (string, required)

  - `error.details` (string, required)

  - `request_id` (string, required)

## Response 415 fields (application/json):

  - `error` (object, required)

  - `error.code` (integer, required)
    Example: 123

  - `error.message` (string, required)

  - `error.details` (string, required)

  - `request_id` (string, required)

## Response 422 fields (application/json):

  - `error` (object, required)

  - `error.code` (integer, required)
    Example: 123

  - `error.message` (string, required)

  - `error.details` (string, required)

  - `request_id` (string, required)

## Response 429 fields (application/json):

  - `error` (object, required)

  - `error.code` (integer, required)
    Example: 123

  - `error.message` (string, required)

  - `error.details` (string, required)

  - `request_id` (string, required)

## Response 460 fields (application/json):

  - `error` (object, required)

  - `error.code` (integer, required)
    Example: 123

  - `error.message` (string, required)

  - `error.details` (string, required)

  - `request_id` (string, required)

## Response 5XX fields (application/json):

  - `error` (object, required)

  - `error.code` (integer, required)
    Example: 123

  - `error.message` (string, required)

  - `error.details` (string, required)

  - `request_id` (string, required)

