Migration guide
Migrating from remove.bg's API.
remove.bg's API has moved to Leonardo.Ai. This page maps a remove.bg integration onto Maskyard's API, field by field, and says where Maskyard is the wrong choice. The main difference: Maskyard is asynchronous, so the call is rewritten, not just pointed at a new address.
- Checked
- 2 December 2026
- Covers
- remove.bg's self-serve API
- Trial
- 25 images, once per verified account, no card
What changed
On 16 November 2026 remove.bg's API page said: “Starting December 1, 2026, background removal moves to Leonardo.Ai, also part of Canva.” On 2 December 2026 that page redirected to Leonardo.Ai's documentation, and remove.bg's API reference to a Canva help page. Leonardo.Ai's announcement (updated 1 September 2026) and migration guide (updated 2 September 2026) say:
- remove.bg credentials don't carry over: you create a Leonardo.Ai account and a new API key. Enterprise customers go through their account manager.
- Most of remove.bg's parameters carry over, on a new synchronous endpoint and an asynchronous one with webhooks. Results are saved to your Leonardo.Ai library unless you set
ephemeral. - Background removal costs USD $0.10 an image. The standard rate limit is 100 images a minute, against remove.bg's 500.
Its bulk background removal page adds that it is “the same background removal model that previously powered remove.bg”, that pay-as-you-go credit “doesn't expire”, and that its custom plan has “model-based discounts”. We found no published volume price.
If you want a synchronous call that keeps most of remove.bg's parameters, Leonardo.Ai is the smaller change, and some providers accept remove.bg's request format as it is. Maskyard is built for different work: product catalogues processed in the background.
When Maskyard fits
It fits when
- You process catalogues. A batch takes up to 1,000 images on a paid plan, each with its SKU, checks every item on its own and sends one webhook when it ends.
- You want the mask as well as the cutout. Every job stores a transparent PNG and an 8-bit alpha-mask PNG at the source's dimensions.
- Retries have to be safe. Every submission carries an
Idempotency-Key, so a retried request is never processed or charged twice. - Your volume is steady. Standard is $49 for 5,000 images each monthly period.
It doesn't fit when
- You need the image back in the same request. Maskyard answers with a job id, and the work happens in the background.
- You use shadows, background images,
roi, the semi-transparency setting or 50 MP output. None of them exists here: outputs keep the source's size, up to 25 megapixels. - You rely on
typehints such aspersonorcar. Maskyard'ssubjecttakesauto,generalorjewellery, nothing else. - You need hundreds of images a minute. Maskyard sends up to 25 of an account's jobs to the GPUs at a time and queues the rest.
- You process fewer than 191 images a year. Below that, Leonardo.Ai costs less (see Prices).
Prices
| Images | Leonardo.Ai, list price | Maskyard |
|---|---|---|
| 1,000 | $104.70 | $20 as a prepaid pack, usable for 12 months |
| 5,000 a month | $523.50 | $49 on Standard; unused images expire at the end of the period |
- Below about 191 images, Leonardo.Ai costs less than our smallest purchase, the $20 pack. Below about 468 images a month, it costs less than Standard.
- Leonardo.Ai's credit doesn't expire; Standard's images expire with each period and the pack's after 12 months.
- Maskyard's prices are proposed launch prices. The trial gives 25 images, once per verified account, without a card.
Before and after
remove.bg's request, as Leonardo.Ai's migration guide quotes it, with our example image:
curl -H 'X-Api-Key: YOUR_KEY' \
-F 'image_url=https://example.com/product.jpg' \
-F 'size=auto' \
-f https://api.remove.bg/v1.0/removebg -o no-bg.png
The same image on Maskyard: submit it with an Idempotency-Key, poll until the job ends, and keep the cutout and the mask. A webhook can replace the polling. This suits single images; a catalogue goes in as one batch (below).
# Needs curl, jq and an API key in MASKYARD_API_KEY.
set -euo pipefail
# remove.bg answered with the image. Maskyard answers with a job at once.
JOB=$(curl -sS --fail-with-body -X POST "https://api.example.com/v1/images" \
-H "Authorization: Bearer $MASKYARD_API_KEY" \
-H "Idempotency-Key: sku-10442-v1" \
-H "Content-Type: application/json" \
--data '{"url": "https://example.com/product.jpg"}')
JOB_ID=$(jq -r .id <<<"$JOB")
# Poll until the job ends. A rerun with the same key returns the same job,
# charged once. For a catalogue, submit one batch and wait for its webhook.
while true; do
sleep 2
JOB=$(curl -sS --fail-with-body "https://api.example.com/v1/jobs/$JOB_ID" \
-H "Authorization: Bearer $MASKYARD_API_KEY")
case $(jq -r .state <<<"$JOB") in succeeded | failed | cancelled) break ;; esac
done
if [ "$(jq -r .state <<<"$JOB")" != succeeded ]; then
jq '{state, error}' <<<"$JOB"
exit 1
fi
# Keep both files now: the URLs expire after 15 minutes.
for TYPE in cutout mask; do
curl -sS --fail-with-body -o "product_$TYPE.png" \
"$(jq -r --arg type "$TYPE" '.results[] | select(.type == $type) | .url' <<<"$JOB")"
done
// Node.js 24 or later: node migrate.mts; the API key in MASKYARD_API_KEY.
import { writeFile } from "node:fs/promises";
const API = "https://api.example.com";
const auth = { Authorization: `Bearer ${process.env.MASKYARD_API_KEY}` };
// Errors are application/problem+json with a stable `code`.
async function json(response: Response) {
const body = await response.json();
if (!response.ok) {
throw new Error(`${response.status} ${body.code}: ${body.detail}`);
}
return body;
}
// remove.bg answered one call with the image; this submits a job and polls
// until it ends. A call with the same key returns the same job, charged once.
// It suits single images: for a catalogue, submit one batch and wait for its
// webhook.
async function removeBackground(imageUrl: string, key: string) {
const accepted = await json(
await fetch(`${API}/v1/images`, {
method: "POST",
headers: {
...auth,
"Idempotency-Key": key,
"Content-Type": "application/json",
},
body: JSON.stringify({ url: imageUrl }),
}),
);
let job;
do {
await new Promise((resolve) => setTimeout(resolve, 2000));
job = await json(
await fetch(`${API}/v1/jobs/${accepted.id}`, { headers: auth }),
);
} while (!["succeeded", "failed", "cancelled"].includes(job.state));
if (job.state !== "succeeded") {
throw new Error(`The job ${job.state}: ${job.error?.code}`);
}
// Download both now: the URLs expire after 15 minutes.
const files: Record<string, Buffer> = {};
for (const result of job.results) {
if (result.type === "cutout" || result.type === "mask") {
const file = await fetch(result.url);
files[result.type] = Buffer.from(await file.arrayBuffer());
}
}
return files;
}
const { cutout, mask } = await removeBackground(
"https://example.com/product.jpg",
"sku-10442-v1",
);
await writeFile("product_cutout.png", cutout);
await writeFile("product_mask.png", mask);
// .NET 10: dotnet run migrate.cs; the API key in MASKYARD_API_KEY.
// A file-based app compiles for native AOT, which turns reflection-based JSON
// off; this keeps it on. A project needs no such line.
#:property PublishAot=false
using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json;
using var http = new HttpClient { BaseAddress = new Uri("https://api.example.com/") };
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("MASKYARD_API_KEY"));
// Another client for downloads: storage must not receive the API key.
using var storage = new HttpClient();
var outputs = await RemoveBackground("https://example.com/product.jpg", "sku-10442-v1");
await File.WriteAllBytesAsync("product_cutout.png", outputs["cutout"]);
await File.WriteAllBytesAsync("product_mask.png", outputs["mask"]);
// remove.bg answered one call with the image; this submits a job and polls
// until it ends. A call with the same key returns the same job, charged once.
// It suits single images: for a catalogue, submit one batch and wait for its
// webhook.
async Task<Dictionary<string, byte[]>> RemoveBackground(string imageUrl, string key)
{
using var submit = new HttpRequestMessage(HttpMethod.Post, "v1/images");
submit.Headers.Add("Idempotency-Key", key);
submit.Content = JsonContent.Create(new { url = imageUrl });
var jobId = (await Read(await http.SendAsync(submit))).GetProperty("id").GetString();
JsonElement job;
string? state;
do
{
await Task.Delay(TimeSpan.FromSeconds(2));
job = await Read(await http.GetAsync($"v1/jobs/{jobId}"));
state = job.GetProperty("state").GetString();
}
while (state is not ("succeeded" or "failed" or "cancelled"));
if (state != "succeeded")
{
throw new InvalidOperationException($"The job {state}: {job.GetProperty("error")}");
}
// Download both now: the URLs expire after 15 minutes.
var files = new Dictionary<string, byte[]>();
foreach (var result in job.GetProperty("results").EnumerateArray())
{
var type = result.GetProperty("type").GetString();
if (type is "cutout" or "mask")
{
files[type] = await storage.GetByteArrayAsync(result.GetProperty("url").GetString());
}
}
return files;
}
// Errors are application/problem+json with a stable `code`.
static async Task<JsonElement> Read(HttpResponseMessage response)
{
var body = await response.Content.ReadFromJsonAsync<JsonElement>();
if (!response.IsSuccessStatusCode)
{
throw new HttpRequestException(
$"{(int)response.StatusCode} {body.GetProperty("code")}: {body.GetProperty("detail")}");
}
return body;
}
Request fields
Formatting that remove.bg did in the same call, such as cropping, placement and a background colour, is a separate export on Maskyard. It runs on the stored cutout and costs no credit.
| remove.bg | Maskyard |
|---|---|
| image_url | url on POST /v1/images: a public https URL on port 443, fetched by us. |
| image_file | POST /v1/uploads for a signed URL, a PUT of the bytes to it, then uploadId on POST /v1/images. Files up to 20 MB; remove.bg took up to 22 MB. |
| image_file_b64 | No base64 input: upload the bytes as for image_file. |
| size | None. Outputs keep the source's dimensions, up to 25 megapixels, and every job adds a preview within 320×320. |
| type, type_level | subject: auto (the default), general or jewellery. There are no hints for other kinds of image. |
| format | None on the job: it always stores a transparent PNG cutout and an 8-bit alpha-mask PNG. A PNG or WebP variant comes from an export (spec.format). |
| channels | None: rgba is the job's cutout, alpha its mask, and you get both. |
| crop, crop_margin | An export's spec.crop, its margin in pixels or percent. |
| scale, position | An export's spec.placement: a canvas size, scalePercent and anchor. |
| bg_color | An export's spec.background, as #RRGGBB. |
| bg_image_url, bg_image_file | None. |
| roi | None. |
| semitransparency | None. |
| shadow_type, shadow_opacity, add_shadow | None. |
Responses
| remove.bg | Maskyard |
|---|---|
| The image in the response body | 202 with a job id at once; the finished job lists its results, each with a url signed for 15 minutes and an assetId to keep. |
| X-Credits-Charged | One credit per image, reserved when the job is accepted and consumed once its outputs are stored. GET /v1/usage shows the balance. |
| X-Width, X-Height | width and height on each result. |
| X-Type | The job's subject.used: general or jewellery. |
| X-Foreground-Top, -Left, -Width, -Height | None. An export's spec.crop trims a variant to the product. |
Errors are application/problem+json with a stable code; the API documentation lists every one.
Moving a catalogue
Neither remove.bg's API page nor Leonardo.Ai's guide documents a batch endpoint. On Maskyard a catalogue goes in as one batch:
- Upload each file, or name its URL, and submit up to 1,000 items to
POST /v1/batches, each with itssku. - Each item is checked on its own: an invalid one is rejected by its index, and the others go ahead.
- When the batch ends,
batch.completedarrives at your webhook. Read the batch for its results. - Export it as ZIP parts with a CSV manifest, or read each item's files. Items that failed for a technical reason can be retried in one call.
The dashboard does the same from a CSV or a set of files, for people who don't call the API.
Checklist
- Create an API key in the dashboard and send it as
Authorization: Bearer, in place ofX-Api-Key. - Replace each call with a submission and a wait for the job, or a webhook.
- Take
Idempotency-Keyvalues from your own records, such assku-10442-v1. - Store asset ids, not URLs: a URL expires after 15 minutes and the files after 30 days.
- Move cropping, placement and background colours to an export, or keep them in your own pipeline.
- Try it on 25 of your own images: the trial needs no card.
remove.bg and Leonardo.Ai are both part of Canva. Maskyard is not affiliated with either. What this page says about them comes from their public pages on the dates given.