Generate, edit, and create visual assets using Bria's commercially-safe AI models (FIBO, RMBG-2.0, GenFill, and more). Remove or replace backgrounds, create product lifestyle shots, generate transparent PNGs, batch generate images, and build pipeline workflows. Unlike black-box generators, Bria gives you fine-grained control: edit by text instruction, mask specific regions, add/replace/remove individual objects, change lighting or season independently.
Before making any Bria API call, check for the API key and help the user set it up if missing:
bash
echo $BRIA_API_KEY
If the output is not empty, skip to the next section.
Tell the user exactly this:
To use image generation, you need a free Bria API key.
- Go to https://platform.bria.ai/console/account/api-keys
- Sign up or log in
- Click Create API Key
Wait for the user to provide their API key. Do not proceed until they give you the key.
Do not proceed with any image generation or editing until the API key is confirmed set.
NeedCapabilityUse CaseGenerate images from textFIBO GenerateHero images, product shots, illustrations, social media images, bannersEdit images by text instructionFIBO-EditChange colors, modify objects, transform scenesEdit image region with maskGenFill/ErasePrecise inpainting, add/replace specific regionsAdd/Replace/Remove objectsText-based editingAdd vase, replace apple with pear, remove tableRemove background (transparent PNG)RMBG-2.0Extract subjects for overlays, logos, cutoutsReplace/blur/erase backgroundBackground opsChange, blur, or remove backgroundsExpand/outpaint imagesOutpaintingExtend boundaries, change aspect ratiosUpscale image resolutionSuper ResolutionIncrease resolution 2x or 4xEnhance image qualityEnhancementImprove lighting, colors, detailsRestyle imagesRestyleOil painting, anime, cartoon, 3D renderChange lightingRelightGolden hour, spotlight, dramatic lightingChange seasonReseasonSpring, summer, autumn, winterComposite/blend imagesImage BlendingApply textures, logos, merge imagesRestore old photosRestorationFix old/damaged photosColorize imagesColorizationAdd color to B&W, or convert to B&WSketch to photoSketch2ImageConvert drawings to realistic photosCreate product lifestyle shotsLifestyle ShotPlace products in scenes for e-commerceIntegrate products into scenesProduct IntegrateEmbed products at exact coordinates
bash
curl -X POST "https://engine.prod.bria-api.com/v2/image/generate" \
-H "api_token: $BRIA_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: BriaSkills/1.2.5" \
-d '{
"prompt": "your description",
"aspect_ratio": "16:9",
"resolution": "1MP",
"sync": true
}'
Aspect ratios: 1:1 (square), 16:9 (hero/banner), 4:3 (presentation), 9:16 (mobile/story), 3:4 (portrait)
Resolution: 1MP (default) or 4MP (improved details for photorealism, adds ~30s latency)
Sync mode: Pass "sync": true in the request body for single image generation to get the result directly in the response. For batch/multiple image generation, omit sync (or set false) and use polling instead.
Advanced: For precise, deterministic control over generation, use VGL structured prompts instead of natural language. VGL defines every visual attribute (objects, lighting, composition) as explicit JSON.
bash
curl -X POST "https://engine.prod.bria-api.com/v2/image/edit/remove_background" \
-H "api_token: $BRIA_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: BriaSkills/1.2.5" \
-d '{"image": "https://..."}'
Returns PNG with transparency.
bash
curl -X POST "https://engine.prod.bria-api.com/v2/image/edit" \
-H "api_token: $BRIA_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: BriaSkills/1.2.5" \
-d '{
"images": ["https://..."],
"instruction": "change the mug to red"
}'
bash
curl -X POST "https://engine.prod.bria-api.com/v2/image/edit/gen_fill" \
-H "api_token: $BRIA_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: BriaSkills/1.2.5" \
-d '{
"image": "https://...",
"mask": "https://...",
"prompt": "what to generate in masked area"
}'
bash
curl -X POST "https://engine.prod.bria-api.com/v2/image/edit/expand" \
-H "api_token: $BRIA_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: BriaSkills/1.2.5" \
-d '{
"image": "base64-or-url",
"aspect_ratio": "16:9",
"prompt": "coffee shop background, wooden table"
}'
bash
curl -X POST "https://engine.prod.bria-api.com/v2/image/edit/increase_resolution" \
-H "api_token: $BRIA_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: BriaSkills/1.2.5" \
-d '{"image": "https://...", "scale": 2}'
bash
curl -X POST "https://engine.prod.bria-api.com/v1/product/lifestyle_shot_by_text" \
-H "api_token: $BRIA_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: BriaSkills/1.2.5" \
-d '{
"image": "https://product-with-transparent-bg.png",
"prompt": "modern kitchen countertop, natural morning light"
}'
Place one or more products at exact coordinates in a scene. Products are automatically cut out and matched to the scene's lighting and perspective.
bash
curl -X POST "https://engine.prod.bria-api.com/image/edit/product/integrate" \
-H "api_token: $BRIA_API_KEY" \
-H "Content-Type: application/json" \
-H "User-Agent: BriaSkills/1.2.5" \
-d '{
"scene": "https://scene-image-url",
"products": [
{
"image": "https://product-image-url",
"coordinates": {"x": 100, "y": 200, "width": 300, "height": 400}
}
]
}'
For single image requests, pass "sync": true in the request body. The response returns the result directly — no polling needed.
For batch or multiple image generation, omit sync (or set "sync": false). The response returns a status URL to poll:
json
{
"request_id": "uuid",
"status_url": "https://engine.prod.bria-api.com/v2/status/uuid"
}
Poll the status_url until status: "COMPLETED", then get result.image_url.
python
import requests, time
def get_result(status_url, api_key):
while True:
r = requests.get(status_url, headers={"api_token": api_key, "User-Agent": "BriaSkills/1.2.5"})
data = r.json()
if data["status"] == "COMPLETED":
return data["result"]["image_url"]
if data["status"] == "FAILED":
raise Exception(data.get("error"))
time.sleep(2)
See references/api-endpoints.md for complete endpoint documentation.
Image Generation
EndpointPurposePOST /v2/image/generateGenerate images from text (FIBO)
Edit by Text (No Mask)
EndpointPurposePOST /v2/image/editEdit image with natural language instructionPOST /v2/image/edit/add_object_by_textAdd objects to imagePOST /v2/image/edit/replace_object_by_textReplace objects in imagePOST /v2/image/edit/erase_by_textRemove objects by name
Edit with Mask
EndpointPurposePOST /v2/image/edit/gen_fillInpaint/generate in masked regionPOST /v2/image/edit/eraseErase masked region
Background Operations
EndpointPurposePOST /v2/image/edit/remove_backgroundRemove background (RMBG-2.0)POST /v2/image/edit/replace_backgroundReplace with AI-generated backgroundPOST /v2/image/edit/blur_backgroundApply blur to backgroundPOST /v2/image/edit/erase_foregroundRemove foreground, fill backgroundPOST /v2/image/edit/crop_foregroundCrop tightly around subject
Image Transformation
EndpointPurposePOST /v2/image/edit/expandOutpaint to new aspect ratioPOST /v2/image/edit/enhanceEnhance quality and detailsPOST /v2/image/edit/increase_resolutionUpscale 2x or 4xPOST /v2/image/edit/blendBlend/merge images or texturesPOST /v2/image/edit/reseasonChange season/weatherPOST /v2/image/edit/restyleTransform artistic stylePOST /v2/image/edit/relightModify lighting
Restoration
EndpointPurposePOST /v2/image/edit/sketch_to_colored_imageConvert sketch to photoPOST /v2/image/edit/restoreRestore old/damaged photosPOST /v2/image/edit/colorizeColorize B&W or convert to B&W
Product Photography
EndpointPurposePOST /v1/product/lifestyle_shot_by_textCreate product lifestyle shots by textPOST /image/edit/product/integrateIntegrate products into scene at exact coordinates
Utilities
EndpointPurposePOST /v2/structured_instruction/generateGenerate JSON instruction (no image)GET /v2/status/{id}Check async request status
All requests need api_token header:
text
api_token: YOUR_BRIA_API_KEY
User-Agent: BriaSkills/<version>
Required: Always include the
User-Agent: BriaSkills/<version>header (where<version>is the current skill version frompackage.json, e.g.BriaSkills/1.2.5) in every API call, including status polling requests.