Skip to main content
Use POST /image/remove-background or mynth.image.removeBackground() to get a transparent version of a single existing image. Mynth picks the model, so the request has no model field. The API creates an async task and returns a taskId. The SDK waits for completion by default; use removeBackgroundAsync() when you want to poll yourself.

Pricing

/image/remove-background costs $0.02 per image. You are charged only when the task completes successfully. The cost is reserved up front. If the task fails, the reserve is released. If your balance cannot cover the reserve, the request returns 422 INSUFFICIENT_BALANCE.

Remove a background with the SDK

Local files

Pass file instead of url when the image is local. The SDK uploads first, then calls /image/remove-background with the resulting URL. See Upload input images.

Output format

The result keeps the format the provider returned. Set output.format to always get png or webp. jpg is not accepted because it cannot store transparency.

Metadata, webhooks, and destinations

The request accepts the same metadata, webhook, and destination fields as image generation:
With a destination, image.url is the destination URL. If the upload fails, image.url is null and image.mynth_url still points at the Mynth CDN. See Use Destinations and Use webhooks.

Remove a background with REST

Response (201):
Poll /tasks/:id for the completed result. Full fields live in Image Remove Background Request.

Start now, wait later

Use removeBackgroundAsync() when you want to create the task now and wait later. The task carries a Public Access Token, so browser code can poll it without your API key:
Poll /tasks/:id/status and /tasks/:id, or listen for task.image.remove_background.completed / task.image.remove_background.failed webhooks. See Async and polling and Browser Polling.

Task failures

If the background cannot be removed, the task status is failed. The SDK’s wait() throws TaskAsyncTaskFailedError.

Constraints