Bria Eraser Serverless API

AI object removal with seamless context-aware inpainting.

~13.58s
$0.04 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/bria-eraser"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "mask": "https://segmind-resources.s3.amazonaws.com/examples/sample-mask-img.jpg",
12    "mask_type": "manual",
13    "visual_input_content_moderation": true,
14    "visual_output_content_moderation": true
15}
16
17response = requests.post(url, headers=headers, json=data)
18
19if response.status_code == 200:
20    result = response.json()
21    print(json.dumps(result, indent=2))
22else:
23    print(f"Error: {response.status_code}")
24    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/bria-eraser

Parameters

imagerequired
string | string

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

Default: "https://segmind-resources.s3.amazonaws.com/input/eb8b89ca-9506-4e67-8356-6214f5f6162e-4d423914-87ba-4e92-8f28-21538c9c6154.jpeg"
Exactly one of:
Option 1optional
string (uri)
Option 2optional
string
maskrequired
string (uri)

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

Default: "https://segmind-resources.s3.amazonaws.com/examples/sample-mask-img.jpg"
mask_typeoptional
string

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

Default: "manual"
Allowed values :
"manual""automatic"
visual_input_content_moderationoptional
boolean

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

Default: true
visual_output_content_moderationoptional
boolean

Screens output image before return. Enable for public or regulated deliveries.

Default: true

Response Type

Returns: Image

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out