Skip to navigation

Media · Image · Replace image background

View as Markdown

Replace ONLY the background behind the detected subject — with a solid color, another image, or transparency. Set replace_type to color (needs replace_color), image (needs replace_image), or transparent. To blur rather than replace use blurBackground; to cut the subject out entirely use removeBackground. Async — returns a task_id (auto-polled).

Authentication

AuthorizationApi-Key

Header authentication of the form Api-Key <token>

OR
AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
image_urlstringRequired
URL of the source image.
replace_typeenumRequired
What to replace the background with.
Allowed values:
replace_colorstringOptional

Hex color for replacement (required when replace_type=color).

replace_imagestringOptional

URL of background image (required when replace_type=image).

Response

Async task queued.
task_idstringOptional

Poll GET /api/v1/tasks/{task_id} until SUCCESS or FAILURE.