Bria Erase Foreground Serverless API
Seamlessly removes foreground subjects and regenerates backgrounds for flawless image editing.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/bria-erase-foreground"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "preserve_alpha": true,
12 "visual_input_content_moderation": false,
13 "visual_output_content_moderation": false
14}
15
16response = requests.post(url, headers=headers, json=data)
17
18if response.status_code == 200:
19 result = response.json()
20 print(json.dumps(result, indent=2))
21else:
22 print(f"Error: {response.status_code}")
23 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/bria-erase-foreground"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "preserve_alpha": true,
12 "visual_input_content_moderation": false,
13 "visual_output_content_moderation": false
14}
15
16response = requests.post(url, headers=headers, json=data)
17
18if response.status_code == 200:
19 result = response.json()
20 print(json.dumps(result, indent=2))
21else:
22 print(f"Error: {response.status_code}")
23 print(response.text)API Endpoint
https://api.segmind.com/v1/bria-erase-foregroundParameters
imagerequiredstring | stringProvide a source image through a URL or Base64 string. Use a URL for faster processing.
Option 1optionalstring (uri)Option 2optionalstringpreserve_alphaoptionalbooleanChoose to retain the image's alpha channel. Set to false for opaque outputs.
truevisual_input_content_moderationoptionalbooleanEnable to filter inappropriate content. Use for sensitive image handling.
falsevisual_output_content_moderationoptionalbooleanApply moderation on the output image. Ideal for public display verification.
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