Car Layers (Base64)#
https://api.withoutbg.com · Spec: openapi.jsonRemove background from a car photo and return the RGBA cutout and a soft cast-shadow mask as separate Base64 PNGs, plus camera view and ground-contact touch sidecars.
Cost: 1 credit on HTTP 200.
The cutout does not bake the shadow in; use shadow_base64 to composite or edit on the client. Window reconstruction and touch points are on by default (reconstruct_windows=true, include_touch_points=true); set either to false to skip. For a single RGBA with baked shadow, use /v1.0/car-image-without-background-base64. No binary sibling. No image-type sidecar.
Endpoint#
POST /v1.0/car-layers-base64
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: application/json
Fields#
image_base64(string, required) — Input image as a raw Base64 string (no `data:` URI prefix). Supported formats: JPEG, PNG, WebP, AVIF, HEIC, TIFF, BMP, GIF. Maximum decoded size: 20.0 MB. Invalid Base64, non-image data, unsupported formats, or oversize payloads fail with HTTP 422.reconstruct_windows(boolean, optional) — When true (default), run car window reconstruction on the cutout: opens glass interiors while keeping the car outline. Shadow is predicted from the BiRefNet silhouette regardless. Set false to skip window reconstruction.include_touch_points(boolean, optional) — When true (default), detect up to 4 unordered ground-contact points on the car (processed-image pixels: x, y, heatmap score). Set false to skip and omit `touch` from the response.
Response#
Success Content-Type: application/json
Body fields#
input_dimensions(array<integer>, required) — Decoded input size as `[width, height]` (pixels).processed_dimensions(array<integer>, required) — Size after server prep downscale (longest-side / megapixel caps) as `[width, height]`. Distinct from model inference resolution (~1024 long side).was_downscaled(boolean, required) — True when the input was downscaled during server prep.view(object, optional) — Estimated camera orbit around the car. Omitted if the orientation head is not loaded. Azimuth 0° = front of the car, increasing counterclockwise from above. Elevation 0° = level look-at (mid-body height); positive = camera above the car.touch(object, optional) — Ground-contact keypoints. Present only when `include_touch_points` is true. Coordinates are in processed-image pixels (same space as the returned PNG). Up to 4 unordered points.img_without_background_base64(string, required) — Car cutout as Base64 PNG (RGBA) with transparent background. Shadow is not baked in; use `shadow_base64` to composite yourself. Prepend `data:image/png;base64,` to display in a browser.shadow_base64(string, required) — Soft cast-shadow mask as Base64 grayscale PNG (0 = no shadow, 255 = full shadow). Not composited into the cutout; for client-side editing/compositing. Prepend `data:image/png;base64,` to display in a browser.
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. |
422 | Validation error. Includes invalid Base64, non-image payloads, unsupported formats, and decoded size over 20.0 MB. | [object Object] |
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" \
-H "Content-Type: application/json" \
-d '{"image_base64":"<raw_base64>"}' \
"https://api.withoutbg.com/v1.0/car-layers-base64"Contract sections are generated at build time from OpenAPI. Markdown mirror: /docs/pro-model/car-layers-base64.md