LassoCut background removal API reference
LassoCut is a background removal API compatible with the remove.bg API: the same request shape, the same X-Api-Key header, and the same JSON error format. Point an existing integration at a new base URL and key, or start from the examples below. This page documents every request field, response header, error code and limit.
Moving from remove.bg? See the migration guide.
Basics
Base URL: https://api.lassocut.com/v1.0. Every request carries your key in the X-Api-Key header. Requests are multipart/form-data, application/x-www-form-urlencoded or application/json. The API follows the remove.bg API: if your code already calls it, see the migration guide. To try every request without writing code, open the LassoCut collection in Postman.
curl --fail-with-body -H "X-Api-Key: $LASSOCUT_API_KEY" -F "image_file=@photo.jpg" -o out.png \
https://api.lassocut.com/v1.0/removebg
POST/removebg
Removes the background of one image. A successful call returns the image bytes with the headers listed below. Send Accept: application/json to get {"data": {"result_b64": "…", "foreground_top": …, …}} instead.
Code examples
The curl and Python examples were run against the production API on 27 September 2026 and returned a PNG.
Full walkthroughs, with options and common errors for each language: curl, Python, Node.js, PHP.
curl
curl --fail-with-body -H "X-Api-Key: $LASSOCUT_API_KEY" \
-F "image_file=@photo.jpg" \
-F "size=auto" \
-o no-bg.png \
https://api.lassocut.com/v1.0/removebg
Python (official package)
lassocut on PyPI: Python 3.10 or later, no dependencies, retries on temporary errors. Source and full options: GitHub.
pip install lassocut
from lassocut import LassoCut
client = LassoCut() # reads LASSOCUT_API_KEY
result = client.remove_background("photo.jpg", size="preview")
result.save("no-bg.png")
print("credits charged:", result.credits_charged)
Python (requests)
import os, requests
r = requests.post(
"https://api.lassocut.com/v1.0/removebg",
headers={"X-Api-Key": os.environ["LASSOCUT_API_KEY"]},
files={"image_file": open("photo.jpg", "rb")},
data={"size": "auto"},
)
r.raise_for_status()
open("no-bg.png", "wb").write(r.content)
print("credits charged:", r.headers["X-Credits-Charged"])
Node.js (18 or later, fetch)
import { readFile, writeFile } from "node:fs/promises";
const form = new FormData();
form.append("image_file", new Blob([await readFile("photo.jpg")]), "photo.jpg");
form.append("size", "auto");
const res = await fetch("https://api.lassocut.com/v1.0/removebg", {
method: "POST",
headers: { "X-Api-Key": process.env.LASSOCUT_API_KEY },
body: form,
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
await writeFile("no-bg.png", Buffer.from(await res.arrayBuffer()));
PHP (cURL)
<?php
$ch = curl_init("https://api.lassocut.com/v1.0/removebg");
curl_setopt_array($ch, [
CURLOPT_HTTPHEADER => ["X-Api-Key: " . getenv("LASSOCUT_API_KEY")],
CURLOPT_POSTFIELDS => ["image_file" => new CURLFile("photo.jpg"), "size" => "auto"],
CURLOPT_RETURNTRANSFER => true,
]);
$png = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) === 200) {
file_put_contents("no-bg.png", $png);
} else {
echo $png;
}
Image source (exactly one)
| Field | Description |
|---|---|
image_file | The image as a file upload: JPG, PNG or WebP, up to 22 MB. Other formats (HEIC, TIFF, GIF, BMP, PSD, PDF…) are refused with invalid_file_type. |
image_file_b64 | The image as a base64 string. |
image_url | A public URL we download the image from. Private and local network addresses are refused. |
Output
| Field | Values | Description |
|---|---|---|
size | preview (default), full, 50MP, auto | Preview is up to 0.25 megapixels and costs 0.25 credit. Full keeps the original resolution up to 25 MP, 50MP up to 50 MP; both cost 1 credit. Auto picks the largest size your balance allows. Legacy values small, regular, medium, hd and 4k are accepted. |
format | auto (default), png, jpg, webp, zip | Auto returns PNG when the result has transparency, JPG otherwise. PNG output is capped at 10 MP. ZIP holds a JPG colour image and a PNG alpha mask. |
channels | rgba (default), alpha | Alpha returns the mask only. |
semitransparency | true (default), false | Accepted for compatibility. |
Framing
| Field | Example | Description |
|---|---|---|
crop | true | Crops the result to the subject. |
crop_margin | 30px, 10%, 10px 20px | Margin kept around the subject when cropping, one to four values like CSS. |
scale | 80%, original | Size of the subject relative to the output. |
position | center, original, 50% 30% | Where the subject sits in the output. |
roi | 0% 0% 100% 100% | Region of interest (x1 y1 x2 y2): only a subject inside it is kept. |
Background
| Field | Example | Description |
|---|---|---|
bg_color | 81d4fa, red, 81d4fa77 | Fills the background with a colour: hex, hex with alpha, or a colour name. |
bg_image_url | URL | Puts an image behind the subject. |
bg_image_file | file upload | Same, as an upload. Use one background source at most. |
Subject type
| Field | Values | Description |
|---|---|---|
type | auto (default), person, product, car, animal, graphic, transportation | With auto, a classifier detects the subject. The type selects the model: portraits and full-body people use different ones. |
type_level | 1 (default), 2, latest, none | How detailed X-Type is. Level 1 returns person, product, animal, car or other; level 2 adds transportation and graphics; none omits the header. |
Shadows
| Field | Values | Description |
|---|---|---|
shadow_type | drop, cast, 3D, car, auto | drop is a soft shadow under the subject. cast projects the subject's silhouette on the ground, sharp near the base and softer further away. 3D now draws the cast shadow, and auto gives 3D to people and transportation subjects, as remove.bg did (cars keep the car style, not drawn yet). car is accepted but not drawn yet. Can be set per subject type, such as shadow_type[product]=cast; auto is only valid as the global shadow_type, not per subject type. |
shadow_opacity | 0 to 100 | Strength of the shadow. |
shadow_angle | integer from -90 to 90, default 45 | Cast shadow only. Where the light comes from: positive means the light is on the left, so the shadow falls to the right; negative is the opposite. |
shadow_length | short, medium (default), long | Cast shadow only. How far the shadow stretches. |
add_shadow=true (the older remove.bg flag) is accepted for compatibility; it asks for the car shadow, so it draws nothing today: use shadow_type=cast or drop. Invalid values return invalid_shadow_angle or invalid_shadow_length.
curl --fail-with-body -H "X-Api-Key: $LASSOCUT_API_KEY" \
-F "image_file=@product.jpg" \
-F "bg_color=ffffff" \
-F "shadow_type=cast" -F "shadow_angle=45" -F "shadow_length=medium" \
-o product-shadow.jpg \
https://api.lassocut.com/v1.0/removebg
Marketplace presets
One field, preset, frames the cut-out to a marketplace's image rules: canvas size, white background, how much of the canvas the product fills, file format and file-size cap. Values: amazon, ebay, etsy, shopify, zalando, instagram, or none (default). Anything else returns invalid_preset. The values of each preset are listed by GET /presets and explained on the marketplace presets page.
curl --fail-with-body -H "X-Api-Key: $LASSOCUT_API_KEY" \
-F "image_file=@product.jpg" \
-F "preset=amazon" \
-D headers.txt -o amazon.jpg \
https://api.lassocut.com/v1.0/removebg
grep -i "^x-preset\|^x-compliance" headers.txt
- With a preset,
crop,crop_margin,scaleandpositionare ignored; the ones you sent are listed in theX-Preset-Ignoredheader. - The preset picks the output format when
formatisauto. An explicitformatorbg_coloroverrides the preset and makes the result non-compliant (X-Compliance: fail). channels=alphawith a preset returnspreset_needs_rgba.- A shadow is allowed on every preset except
zalando;shadow_typeand its options work as in Shadows. With a cast or 3D shadow,ebay,etsy,shopifyandinstagramleave more room around the product (it fills 70% on eBay and Shopify, 65% on Etsy and Instagram) and move it slightly away from the shadow, so the shadow stays visible;amazonkeeps its 85% rule, with a shorter shadow. - If the product had to be enlarged above its source size to fill the canvas, the response carries
X-Upscaled: true.
Compliant means compliant with the image rules LassoCut checks: a marketplace can still refuse a photo for other reasons (text, props, watermarks). Rules as published on 19 October 2026.
Availability: the API, the web tool, the batch tool, the Shopify app, the WordPress plugin (1.2.0), n8n (0.2.0), Zapier (1.2.0), Make, the command line (1.2.0), AI assistants through MCP (1.1.0), Figma and Photoshop (1.2.0) support presets today; GIMP supports the cast shadow only (no preset, its result is a layer).
Response headers
| Header | Description |
|---|---|
X-Width, X-Height | Size of the returned image. |
X-Credits-Charged | Credits taken for this call: 0 for a free call, 0.25 for a preview, 1 otherwise. |
X-Preset | The preset that was applied (only with preset). |
X-Compliance | With a preset: ok, or fail; reasons=… listing what is not met among background, fill, ratio, size, format, file_size, shadow. |
X-Preset-Ignored | With a preset: the framing fields you sent that were ignored (crop, crop_margin, scale, position). |
X-Upscaled | true when the subject was enlarged above its source size to fill the preset's canvas. |
X-Type | Detected or requested subject type, per type_level. |
X-Foreground-Top, -Left, -Width, -Height | Bounding box of the subject in the returned image. |
X-RateLimit-Limit, -Remaining, -Reset | Your rate-limit window, in megapixel-images per minute. |
Server-Timing | Time spent in each step of the request, in milliseconds. |
GET/presets
The marketplace presets and their rules. Public: no API key needed. The response is cached for one hour.
curl https://api.lassocut.com/v1.0/presets
{"data": [{"id": "amazon",
"names": {"en": "Amazon", "fr": "Amazon", "es": "Amazon", "pt": "Amazon", "de": "Amazon"},
"rule": {"en": "Pure white background, product fills 85% of a square image, 2000 px", "fr": "…", "es": "…", "pt": "…", "de": "…"},
"canvas": [2000, 2000], "background": [255, 255, 255], "fill": 0.85,
"fill_min": 0.85, "fill_shadow": 0.85,
"format": "jpg", "max_bytes": 10485760, "shadow_allowed": true, "shadow_default": false}, …]}
fill is how much of the canvas the product fills, fill_shadow the same with a cast or 3D shadow, and fill_min the marketplace's own minimum where it has one (null otherwise). Rules as published on 19 October 2026. Sources: the Shopify help centre, the eBay picture policy, Zalando's partner pages and Google Merchant Center's image guidelines; Amazon (Seller Central), Etsy and Instagram publish theirs behind a sign-in. A few values are conservative defaults pending confirmation on the official page (Amazon fill and file size, Etsy file size, Zalando background): see the presets page.
POST/compose
Frames, shadows and colours a cut-out you already have. It does not remove any background: image_file must be a PNG with transparency (for example a result from /removebg). It takes the same preset, shadow_type, shadow_angle, shadow_length, shadow_opacity, bg_color and format fields, and returns the same response headers. Nothing is stored.
curl --fail-with-body -H "X-Api-Key: $LASSOCUT_API_KEY" \
-F "image_file=@cutout.png" \
-F "preset=amazon" \
-F "shadow_type=cast" \
-D headers.txt -o amazon.jpg \
https://api.lassocut.com/v1.0/compose
- Never charged: every result carries
X-Credits-Charged: 0, and an error costs nothing either. - Rate limit: counted on the larger of the image and the preset's canvas. Without a key, each visitor has a much smaller budget than an account.
- With an API key: up to full size. Without a key: up to 0.25 megapixels and 10 MB.
bg_image_urlandbg_image_fileare not supported (compose_bg_image_unsupported).- An image without transparency returns
compose_needs_cutout; a size above the anonymous limit without a key returnscompose_needs_account.
GET/account
Your balance. Free of charge.
{"data": {"attributes": {
"credits": {"total": 200.0, "subscription": 0.0, "payg": 200.0, "enterprise": 0.0},
"api": {"free_calls": 10, "sizes": "all"}}}}
Each account gets 50 free calls per calendar month, up to 10 a day, used before paid credits. Free calls cover previews only; full-size and 50 MP images always use credits. free_calls is the free previews you can use now: at most 10 today and what is left of the 50 this month.
POST/improve
Sends us an image the API got wrong, so the models can learn from it. Fields: image_file, image_file_b64 or image_url, plus optional image_filename and tag. Free of charge. Images sent here are kept; images sent to /removebg are not.
Errors
Errors return JSON: {"errors": [{"code": "…", "title": "…", "detail": "…"}]}. Nothing is charged on an error.
| Status | When | Examples of code |
|---|---|---|
| 400 | Invalid request or image | missing_source, multiple_sources, invalid_image_url, failed_image_download, file_too_large, invalid_file_type, failed_to_read_image, resolution_too_high, unknown_foreground, invalid_size, invalid_format, invalid_bg_color, roi_exceeds_bounds, invalid_preset, invalid_shadow_angle, invalid_shadow_length, preset_needs_rgba, compose_needs_cutout, compose_needs_account, compose_bg_image_unsupported |
| 402 | Not enough credits for this size | title Insufficient credits |
| 403 | Missing or wrong key | titles Missing API Key, API Key invalid |
| 429 | Rate limit reached | title Rate limit exceeded, with Retry-After |
| 503 | Temporary processing failure; safe to retry | title Background removal is temporarily unavailable, please retry |
Limits
- Upload size: 22 MB.
- Output resolution: up to 25 MP (
full) or 50 MP (50MP); PNG output up to 10 MP. - Rate limit: 500 megapixel-images per minute per account. An image counts as its size in megapixels, rounded up, with a minimum of 1.
- The first call after a quiet period can take several seconds longer while a GPU starts.