Remove Background (Upload)
POST/api/v1/assets/file/addons/bg_remove
Remove background from an uploaded image (no asset ID in path). Use image as the multipart-form field name for the uploaded file.
Behaviour and response type are controlled by the mode and disposition query parameters.
Mode
| Value | Meaning |
|---|---|
get_image | Return the processed PNG only. No save. disposition is ignored. |
save_image | Save the result only. Response is JSON (no PNG). Requires disposition. |
get_image_and_save | Return the PNG and also save in the background. Requires disposition. |
Disposition
| Value | Meaning |
|---|---|
add_conversion | Save the result as a named conversion on an existing asset. Requires asset_id query parameter. conversion_name controls the conversion key. |
add_new_asset | Save the result as a new asset. Optional: metadata=inherit with asset_id query to copy source custom data and set lineage. |
Validation Rules
- If mode is
save_imageorget_image_and_save, disposition is required. - If disposition is
add_conversion, asset_id query parameter is required and conversion_name must match^[a-zA-Z0-9_-]{1,30}$. - metadata is only allowed when disposition is
add_new_asset. Allowed value:inherit. - If metadata is
inherit, asset_id query parameter is required.
Response
- mode =
get_image(default):Content-Type: image/png— PNG bytes in body. - mode =
get_image_and_save:Content-Type: image/png— PNG bytes in body (save happens in background). - mode =
save_image, disposition =add_conversion:\{ "status": "ok", "mode": "save_image", "disposition": "add_conversion", "asset_id": "<id>", "conversion_name": "<name>" \} - mode =
save_image, disposition =add_new_asset:(\{ "status": "ok", "mode": "save_image", "disposition": "add_new_asset", "source_asset_id": "<id>", "metadata": "inherit", "new_asset_id": "<id>" \}source_asset_idandmetadataonly present when provided;new_asset_idwhen save succeeds.)
Request
Responses
- 200
- 400
- 401
- 403
- 500
Successful operation. Response depends on mode:
get_imageorget_image_and_save: PNG image bytes withContent-Type: image/png.save_image: JSON object with save details.
Bad request — invalid mode/disposition/conversion_name; missing asset_id when required; metadata used with non-add_new_asset disposition.
Unauthorized - Invalid or missing authentication
Forbidden - Insufficient permissions
Internal server error - Processing or save failure