Ideogram 3 Replace Background Serverless API

Effortlessly replace backgrounds in images, enhancing visual storytelling and creativity with precision and speed.

~14.56s
$0.037 - $0.113 per generation
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/ideogram-3-replace-background"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "prompt": "Add a forest in the background",
12    "image": "https://segmind-resources.s3.amazonaws.com/output/085c3d6b-0ecd-4f79-9b41-823c451070f5-ideo-3.png",
13    "rendering_speed": "DEFAULT",
14    "magic_prompt": "AUTO",
15    "style_codes": [],
16    "style_reference_images": []
17}
18
19response = requests.post(url, headers=headers, json=data)
20
21if response.status_code == 200:
22    result = response.json()
23    print(json.dumps(result, indent=2))
24else:
25    print(f"Error: {response.status_code}")
26    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/ideogram-3-replace-background

Parameters

imagerequired
string (uri)

Upload the base image for editing. Ensure high resolution for best results.

promptrequired
string

Provides a description for the image creation. Use specific prompts for detailed or themed images.

Default: "Add a forest in the background"
color_paletteoptional
any | any

A color palette for generation

One of:
Preset Color Paletteoptional
any
namerequired
string
Custom Color Paletteoptional
any
membersrequired
object[]
magic_promptoptional
string

Enhance prompts automatically. Choose 'AUTO' for balanced enhancements.

Default: "AUTO"
Allowed values :
"AUTO""ON""OFF"
rendering_speedoptional
string

Adjust speed versus detail. Use 'QUALITY' for highly detailed images.

Default: "DEFAULT"
Allowed values :
"TURBO""DEFAULT""QUALITY"
seedoptional
integer

Sets a reproducible seed for consistency. Keep null for unique results each time.

Default: nullRange: 100 - 999999
style_codesoptional
string[]

Select specific styles to influence the output. Combine for unique aesthetics.

style_reference_imagesoptional
string[]

Use reference images for style influence. Best for specific visual styles.

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