Car Background (Binary)#
https://api.withoutbg.com · Spec: openapi.jsonPut the car on a new background and return the result as a JPEG.
Cost: 1 credit on HTTP 200.
The biggest car in the photo is cut out and placed on background_preset, in the photo's own perspective. With match_photo_light (default) the new shadow follows the car's existing shadow; with frame (default) the output is recomposed around the car at frame_aspect.
For the matching transparent cutout, separate layers, and frame/light metadata, use the Base64 JSON sibling /v1.0/car-layers-base64. Response metadata is returned in X-Input-Dimensions, X-Processed-Dimensions, X-Was-Downscaled, X-Output-Dimensions, X-Background-Preset, X-Light-Azimuth, X-Light-Elevation, and X-Light-Softness.
Endpoint#
POST /v1.0/car-background
Base URL: https://api.withoutbg.com
Authentication#
Provide your API key in the request header:
API key header
X-API-Key: <your_api_key>Request#
Content-Type: multipart/form-data
Fields#
file(string, required) — Car image file (JPEG, PNG, WebP, AVIF, HEIC, TIFF, BMP, GIF). Maximum size: 20.0 MB.background_preset(string, optional) · default"white-seamless"— Backdrop the car is composited onto. Rendered procedurally in the photo's recovered camera, so perspective matches. Fine-tune it withscene_overrides. Previews: https://withoutbg.com/docs/pro-model/car-layers-base64#background_preset
Infinite white sweep, almost no direction.

Neutral grey cyc with a shaped pool, the catalogue look.

Dark grey room, pool carries the separation.

White wall over a graphite grey floor.

Warm walls over a darker floor.

Near-black room with a tight pool under the car.
frame(boolean, optional) · defaulttrue— When true (default), reframe the output: the car fills about 60% of the frame width with headroom above and floor below, its shadow kept in frame. When false, the output keeps the photo's framing and size.frame_aspect(string, optional) · default"4:3"— Output aspect ratio (width:height) whenframeis true.originalkeeps the photo's own ratio. Ignored whenframeis false. Shapes: https://withoutbg.com/docs/pro-model/car-layers-base64#frame_aspect4:3Landscape, the marketplace listing default.
3:2Landscape, matches most DSLR photos.
16:9Wide banner or website hero.
1:1Square, for social posts and thumbnails.
photo's ratioKeep the photo's own width:height ratio.
frame_grow(boolean, optional) · defaulttrue— When true (default) and the ideal frame reaches past the photo's edge, extend the rendered backdrop instead of cropping tighter. When false, the frame stays inside the photo: it keepsframe_aspectand may trim the car's front and rear when the car fills the photo.match_photo_light(boolean, optional) · defaulttrue— When true (default), detect the car's existing shadow in the photo and fit the light direction to it, so the new shadow falls the same way. Falls back to the default light when no usable shadow is found.reconstruct_windows(boolean, optional) · defaulttrue— When true (default), run car window reconstruction: opens glass interiors while keeping the car outline. Set false to skip and use the base silhouette alpha only.
Response#
Success Content-Type: image/jpeg
Response headers#
X-Input-Dimensions— Decoded input size as `width,height` (pixels).X-Processed-Dimensions— Size after server prep downscale (longest side / megapixel caps) as `width,height`. Not the model inference resolution (~1024 long side).X-Was-Downscaled— Whether the input was downscaled during server prep (`true`/`false`).X-Output-Dimensions— Size of the returned image as `width,height`: the frame box when `frame` is true, else the processed size.X-Background-Preset— Background preset that was rendered. Today the requested `background_preset`; read it from here, not from the request.X-Light-Azimuth— Light azimuth around the car, in degrees (as `light.azimuth_deg`).X-Light-Elevation— Light elevation above the ground, in degrees (as `light.elevation_deg`).X-Light-Softness— Light softness, 0 = hard to 1 = very soft (as `light.softness`).
Errors#
| Status | Description | Detail |
|---|---|---|
401 | Invalid API Key | Invalid API Key |
402 | Insufficient credit. Please top up API credits. | Insufficient credit. Please top up API credits. |
403 | Credits Expired. Please top up API credits. If you have existing credits, they will be reactivated. | Credits Expired. Please top up API credits. If you have existing credits, they will be reactivated. |
413 | File size too large. Maximum file size is 20.0 MB. | File size too large. Maximum file size is 20.0 MB |
415 | Unsupported Media Type. Supported formats are: JPEG, PNG, WebP, AVIF, HEIC, TIFF, BMP, GIF. | Unsupported Media Type. Supported formats are: JPEG, PNG, WebP, AVIF, HEIC, TIFF, BMP, GIF. |
422 | Validation Error | Validation Error |
429 | Rate limit exceeded (product policy: 30 requests/minute per API key). May be returned by the API gateway. Retry with exponential backoff. | {"error":"Too Many Requests","status":429,"message":"Rate limit exceeded. Please try again later"} |
500 | Internal Server Error | Internal Server Error. Please contact support: contact@withoutbg.com |
Example (cURL)#
cURL
curl -X POST \
-H "X-API-Key: $WITHOUTBG_API_KEY" \
-F "file=@/path/to/input.jpg" \
--output result.png \
"https://api.withoutbg.com/v1.0/car-background"Related endpoints#
- Car Background Removal (Binary) —
POST/v1.0/car-image-without-background - Car Layers (Base64) —
POST/v1.0/car-layers-base64
Contract sections are generated at build time from OpenAPI. Markdown mirror: /docs/pro-model/car-background-binary.md