Vidu API
Dashboard
Docs
Sign in

Background Remover

POST https://api.vidu.com/ent/v2/remove-bg

Request Header

FieldValueDescription
Content-Typeapplication/jsonData Exchange Format
AuthorizationToken {your api key}Replace {} with your API key

Request Body

FieldTypeRequiredDescription
imageStringRequiredImage input parameter, used to generate the final product image output. Supported formats and requirements:
- Only one image can be uploaded
- Accepts image URL (must be publicly accessible) or Base64 format
- Supported formats: png, jpeg, jpg, webp
- Image width and height must each be at least 512 pixels
- Aspect ratio must be less than 2
- Image file size must not exceed 10 MB
- The length of the base64 decode must be under 10MB, and it must include an appropriate content type string. For instance,
data:image/png;base64,{base64_encode}
countIntRequiredNumber of output images.
Default is 4, acceptable range: 1–4
backgroundStringOptionalBackground preset parameter:
- Used to specify a predefined background
- Either background or custom_background must be provided; only one of them can be used at a time- - See full list of options: Background Enum doc
custom_backgroundStringOptionalCustom background parameter:
- Used to specify a background color in hexadecimal format, e.g. #ced2ce for a light gray background
- Only one of background or custom_background can be provided per request; they cannot be used simultaneously
callback_urlStringOptionalCallback
When creating a task, you need to actively set the callback_url with a POST request. When the video generation task changes its status, Vidu will send a callback request to this URL, containing the latest status of the task. The structure of the callback request content will be the same as the return body of the GET Generation API.
The “status” in the callback response includes the following states:
- processing: Task is being processed.
- success: Task is completed (if sending fails, it will retry the callback three times).
- failed: Task failed (if sending fails, it will retry the callback three times).
curl -X POST -H "Authorization: Token {your_api_key}" -H "Content-Type: application/json" -d '
{
"background": "white",
"image": "input_your_image_url",
"count": 4
}' https://api.vidu.com/ent/v2/remove-bg

Response Body

FieldTypeDescription
task_idStringTask ID
stateStringIt will be returned to a specific processing state:
- created created task successfully
- queueing task in queue
- processing processing
- success generation successful
- failedtask failed
imageStringThe image used for this call
countIntThe images count used for this call
backgroundStringThe background parameter used in this call
custom_backgroundStringThe custom background parameter used in this call
created_atStringTask creation time