POST
javascript
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); } })();
RESPONSE
image/jpeg
HTTP Response Codes
200 - OKImage Generated
401 - UnauthorizedUser authentication failed
404 - Not FoundThe requested URL does not exist
405 - Method Not AllowedThe requested HTTP method is not allowed
406 - Not AcceptableNot enough credits
500 - Server ErrorServer had some issue with processing

Attributes


imagestr *

Source image URL (JPEG/PNG). Use high-resolution for best fill quality.


maskstr *

Mask URL highlighting regions to erase. White areas are removed and refilled.


mask_typeenum:str ( default: manual )

manual for brush-defined masks; automatic for AI-detected object removal.

Allowed values:


visual_input_content_moderationboolean ( default: true )

Screens input image for inappropriate content. Enable for compliance pipelines.


visual_output_content_moderationboolean ( default: true )

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 — AI Object Removal API

What is Bria Eraser?

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.

Key Features

  • Precision Object Removal: Supply a manual mask for pixel-perfect control or use automatic masking for fast, AI-detected region removal.
  • Context-Aware Fill: The model replicates surrounding lighting, texture, and tone when regenerating the erased area — no visible seams.
  • Original Pixel Preservation: Only the masked region is modified; all other pixels remain untouched.
  • Content Moderation: Optional input and output moderation flags for compliance-sensitive pipelines in healthcare, finance, and regulated industries.
  • Flat Per-Inference Pricing: $0.04 per call, regardless of image size or complexity.

Best Use Cases

  • E-Commerce Catalogs: Strip watermarks, cables, dust spots, or stray props from product photography at scale.
  • Marketing Asset Production: Remove outdated logos, seasonal elements, or background distractions from hero images without a reshooting budget.
  • Photo Restoration: Erase scratches, date stamps, or blemishes from archive images.
  • Creative App Integration: Embed object removal into consumer or enterprise photo editors with a single API call.
  • Content Localization: Remove region-specific text or branding from master assets before repurposing for other markets.

Prompt Tips and Output Quality

  1. Use high-resolution source images — the model preserves fine texture detail in the filled region.
  2. For manual masks, paint slightly larger than the object to help the model blend fill edges cleanly.
  3. Use mask_type=automatic for quick edits on well-defined objects like logos or isolated props.
  4. Enable both content moderation flags for public-facing or client-delivery pipelines.
  5. If the fill contains visible artifacts at the mask boundary, re-run with a slightly expanded mask.

FAQs

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.