Bria Generative Fill Serverless API
Bria AI enables precise generative image editing for seamless creative enhancements and transformations.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/bria-gen-fill"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "mask": "sample text",
12 "mask_type": "manual",
13 "prompt": "Place a wooden bench on the grass",
14 "prompt_content_moderation": true,
15 "negative_prompt": "No skyscrapers or ground vehicles",
16 "preserve_alpha": true,
17 "seed": 42,
18 "visual_input_content_moderation": false,
19 "visual_output_content_moderation": false
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/bria-gen-fill"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "mask": "sample text",
12 "mask_type": "manual",
13 "prompt": "Place a wooden bench on the grass",
14 "prompt_content_moderation": true,
15 "negative_prompt": "No skyscrapers or ground vehicles",
16 "preserve_alpha": true,
17 "seed": 42,
18 "visual_input_content_moderation": false,
19 "visual_output_content_moderation": false
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25 result = response.json()
26 print(json.dumps(result, indent=2))
27else:
28 print(f"Error: {response.status_code}")
29 print(response.text)API Endpoint
https://api.segmind.com/v1/bria-gen-fillParameters
imagerequiredstring | stringProvide the source image via URL or Base64. Use different formats to test input handling.
"https://segmind-resources.s3.amazonaws.com/input/84380902-5a75-4ae6-b499-4e8c08777792-6e2fc83c-b77b-4f89-869e-76fdbf746c81.jpeg"Option 1optionalstring (uri)Option 2optionalstringmaskrequiredstring (uri)Define the generation area with a mask. Test different regions by altering mask shape.
nullpromptrequiredstringEnter a prompt to guide object generation. Try creative or detailed prompts for varied outputs.
"Place a wooden bench on the grass"mask_typeoptionalstringSpecify if the mask is manual or automatic. Use 'manual' for custom, 'automatic' for algorithm-generated.
"manual""manual""automatic"negative_promptoptionalstringExclude elements from generation using this field. Use for undesired features or details.
"No skyscrapers or ground vehicles"preserve_alphaoptionalbooleanDecide if the alpha channel is retained. Keep true for transparency needs.
trueprompt_content_moderationoptionalbooleanModerate the prompt for safety. Enable for sensitive environments.
trueseedoptionalintegerSelect a seed for reproducibility. Use fixed seed for consistent results.
42visual_input_content_moderationoptionalbooleanEnable to check input images for inappropriate content. Useful for platform compliance.
falsevisual_output_content_moderationoptionalbooleanCheck output images for content issues. Activate for moderated environments.
falseResponse Type
Returns: Image
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out