1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const axios = require('axios');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/bria-eraser";
const data = {
"image": "https://segmind-resources.s3.amazonaws.com/input/eb8b89ca-9506-4e67-8356-6214f5f6162e-4d423914-87ba-4e92-8f28-21538c9c6154.jpeg",
"mask": "https://segmind-resources.s3.amazonaws.com/input/1c67466e-1ad5-42c9-afe4-cecb064dfa9e-4b0596ee-3575-4a58-a64e-37e4c9edf4b5.jpeg",
"mask_type": "manual",
"visual_input_content_moderation": true,
"visual_output_content_moderation": true
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();Source image URL (JPEG/PNG). Use high-resolution for best fill quality.
Mask URL highlighting regions to erase. White areas are removed and refilled.
manual for brush-defined masks; automatic for AI-detected object removal.
Allowed values:
Screens input image for inappropriate content. Enable for compliance pipelines.
Screens output image before return. Enable for public or regulated deliveries.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Bria Eraser is a production-grade image editing API that removes unwanted objects from photos and fills erased regions with contextually accurate, AI-generated pixels. Powered by Bria's inpainting foundation model, it analyzes surrounding lighting, texture, and composition to reconstruct the scene seamlessly — without disturbing original pixels outside the mask.
The API accepts a source image and a mask URL, then returns a clean, inpainted PNG in a single synchronous call at a flat cost of $0.04 per request.
mask_type=automatic for quick edits on well-defined objects like logos or isolated props.Q: What image formats does Bria Eraser support? A: The API accepts publicly accessible image URLs in JPEG or PNG format. High-resolution PNGs produce the cleanest inpainting results.
Q: What is the difference between manual and automatic mask types? A: Manual mask type uses a mask image you supply, giving pixel-level control over the removal area. Automatic mode lets Bria's segmentation model detect and mask the target object — faster for well-isolated elements.
Q: Does erasing an object affect the rest of the image? A: No. Bria Eraser only regenerates pixels inside the masked region. All original pixels outside the mask are preserved exactly.
Q: How does content moderation work?
A: Setting visual_input_content_moderation: true scans the source image before processing. Setting visual_output_content_moderation: true screens the result before it is returned — both can be enabled independently.
Q: Is this suitable for batch workflows? A: Yes. With a flat $0.04-per-inference rate and synchronous response, it integrates cleanly into automated pipelines for bulk catalog or asset processing.