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)

FieldDescription
image_fileThe image as a file upload. JPG, PNG, WebP and other common formats, up to 22 MB.
image_file_b64The image as a base64 string.
image_urlA public URL we download the image from. Private and local network addresses are refused.

Output

FieldValuesDescription
sizepreview (default), full, 50MP, autoPreview 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.
formatauto (default), png, jpg, webp, zipAuto 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.
channelsrgba (default), alphaAlpha returns the mask only.
semitransparencytrue (default), falseAccepted for compatibility.

Framing

FieldExampleDescription
croptrueCrops the result to the subject.
crop_margin30px, 10%, 10px 20pxMargin kept around the subject when cropping, one to four values like CSS.
scale80%, originalSize of the subject relative to the output.
positioncenter, original, 50% 30%Where the subject sits in the output.
roi0% 0% 100% 100%Region of interest (x1 y1 x2 y2): only a subject inside it is kept.

Background

FieldExampleDescription
bg_color81d4fa, red, 81d4fa77Fills the background with a colour: hex, hex with alpha, or a colour name.
bg_image_urlURLPuts an image behind the subject.
bg_image_filefile uploadSame, as an upload. Use one background source at most.

Subject type

FieldValuesDescription
typeauto (default), person, product, car, animal, graphic, transportationWith auto, a classifier detects the subject. The type selects the model: portraits and full-body people use different ones.
type_level1 (default), 2, latest, noneHow 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

HeaderDescription
X-Width, X-HeightSize of the returned image.
X-Credits-ChargedCredits taken for this call: 0 for a free call, 0.25 for a preview, 1 otherwise.
X-TypeDetected or requested subject type, per type_level.
X-Foreground-Top, -Left, -Width, -HeightBounding box of the subject in the returned image.
X-RateLimit-Limit, -Remaining, -ResetYour rate-limit window, in megapixel-images per minute.
Server-TimingTime 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.

StatusWhenExamples of code
400Invalid request or imagemissing_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
402Not enough credits for this sizetitle Insufficient credits
403Missing or wrong keytitles Missing API Key, API Key invalid
429Rate limit reachedtitle Rate limit exceeded, with Retry-After
503Temporary processing failure; safe to retrytitle 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.