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.
curl -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.
Image source (exactly one)
| Field | Description |
|---|---|
image_file | The image as a file upload. JPG, PNG, WebP and other common formats, up to 22 MB. |
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
add_shadow=true, or shadow_type (drop, car, 3D) with shadow_opacity (0 to 100), globally or per subject type such as shadow_type[product]=drop. The drop shadow is drawn today; car and 3D shadows are accepted but not drawn yet.
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-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/account
Your balance. Free of charge.
{"data": {"attributes": {
"credits": {"total": 200.0, "subscription": 0.0, "payg": 200.0, "enterprise": 0.0},
"api": {"free_calls": 50, "sizes": "all"}}}}
Each account gets 50 free calls per calendar month, used before paid credits. Free calls cover previews only; full-size and 50 MP images always use credits.
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 |
| 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.