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-blur-background"; const data = { "image": "https://segmind-resources.s3.amazonaws.com/input/d8806bf3-26b3-4fa7-bf06-818b4eb3494b-7f1198b9-2961-4dc1-ad67-e9c60013b44a.jpeg", "scale": 5, "preserve_alpha": true, "visual_input_content_moderation": false, "visual_output_content_moderation": false }; (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 *

Input an image URL for processing. Use clear, high-resolution images for best results.


scaleint ( default: 3 )

Set blur intensity from 1 to 5. Use 3 for moderate background blur.

min : 1,

max : 5


preserve_alphaboolean ( default: true )

Retains transparency if enabled. Useful for logos and overlays.


visual_input_content_moderationboolean ( default: 1 )

Enables moderation to filter input. Activate for sensitive operations.


visual_output_content_moderationboolean ( default: 1 )

Ensures moderated output. Enable for compliance requirements.

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 AI Image Editing API v2 – Image Editing API

What is Bria AI Image Editing API v2?

Bria AI’s Image Editing API v2 is a suite of generative image-manipulation models built for developers, creators, and product managers. It supports precise object removal, content-aware fills, background editing, canvas expansion, detail enhancement, and resolution upscaling. Leveraging advanced diffusion and transformer architectures, Bria AI v2 produces context-aware edits while preserving original image quality. With built-in moderation controls, it’s designed for safe, scalable integration into web, mobile, and desktop applications.

Key Features

  • Eraser (Object Removal): Remove unwanted objects with pixel-perfect masked edits.
  • Generative Fill: Create new elements or reconstruct masked areas using natural-language prompts.
  • Background Editing: Remove, replace, or blur backgrounds while maintaining foreground clarity.
  • Image Expansion: Widen canvases seamlessly by “outpainting” new content that matches the original style.
  • Enhance Image: Refine textures, boost detail, and sharpen subtle features.
  • Increase Resolution: Upscale images up to 4× without introducing artifacts or synthetic details.
  • Content Moderation: Optional visual_input_content_moderation and visual_output_content_moderation for compliance.

Best Use Cases

  • Photo retouching and restoration for photography platforms
  • E-commerce and retail: background removal, product spotlighting
  • Social media content: custom filters, branded overlays, dynamic backgrounds
  • Marketing assets: ad creatives, banners, hero images
  • Game development: asset cleanup, environment extension
  • Print and editorial: high-resolution upscaling, style-consistent extensions

Prompt Tips and Output Quality

  1. High-Resolution Inputs: Provide clear, high-res images (e.g., ≥ 1024×1024 px) for optimal edits.
  2. Mask Precision: Use accurate masks for Eraser and Generative Fill to guide context-aware content.
  3. Scale Setting: Adjust the scale parameter (1–5) to control blur intensity in background edits. Default is 3 for balanced blurring.
  4. Preserve Transparency: Enable preserve_alpha for logos or overlays to maintain alpha channels.
  5. Moderation Flags: Activate visual_input_content_moderation or visual_output_content_moderation when handling sensitive imagery.
  6. Iterative Refinement: Combine Enhance Image and Increase Resolution sequentially for crisp detailed outputs.

FAQs

Q: How do I remove an object from an image?
A: Use the Eraser model with a binary mask over the target area. The API will seamlessly fill the removed region based on surrounding context.

Q: Can I replace or blur a background automatically?
A: Yes. Invoke the background editing endpoint, set scale (1–5) for blur, or pass a replacement image/prompt for dynamic backgrounds.

Q: What is Generative Fill and how do I use it?
A: Generative Fill regenerates masked regions via text prompts. Supply a mask and descriptive prompt (e.g., “add a sunset over the lake”) to create new content.

Q: How can I upscale images without artifacts?
A: Call Increase Resolution after Enhance Image. The upscaler preserves edges and textures without fabricating new elements.

Q: How do I maintain transparency in output?
A: Enable preserve_alpha=true. This retains the original alpha channel, ideal for overlays, watermarks, and UI assets.