Car Background Removal (Base64)#

Base URL: https://api.withoutbg.com · Spec: openapi.json

Remove background from a car photo; return Base64 RGBA PNG in JSON.

Cost: 1 credit on HTTP 200.

Uses the dedicated car pipeline: the biggest vehicle is detected and cropped before segmentation, then results are mapped back to the full frame. Window reconstruction and a baked cast shadow run by default (reconstruct_windows=true, shadow_type=ai). Set shadow_type=none to skip the shadow. No camera view sidecar (use /v1.0/car-layers-base64 for compositing layers plus that sidecar). No image-type sidecar (car photos are photographic). Binary sibling: /v1.0/car-image-without-background.

Endpoint#

POST /v1.0/car-image-without-background-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.
  • shadow_type (object, optional)Which renderer produces the cast shadow. Defaults to `ai`, the learned car-shadow model. `none` skips the shadow entirely. `geometric` (proxy fit) and `auto` (geometric, falling back to `ai`) are declared but not yet available and are rejected with 422; light direction is inferred from the photo, so no shadow type takes light parameters.
  • include_shadow (object, optional)Deprecated: use `shadow_type` instead (true maps to `ai`, false to `none`). When omitted, `shadow_type` decides. Setting both to contradictory values is rejected.
  • reconstruct_windows (boolean, optional)When true (default), run car window reconstruction: opens glass interiors while keeping the car outline. Cutout RGB stays the original photo unless a shadow is baked in. Set false to skip and use the base silhouette alpha only.

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.
  • shadow_type (string, required)Which renderer produces the cast shadow.
  • img_without_background_base64 (string, required)Car cutout as Base64 PNG (RGBA) with transparent background. Unless `shadow_type` was `none`, the soft cast shadow is already baked into this image. Prepend `data:image/png;base64,` to display in a browser.

Errors#

StatusDescriptionDetail
401Invalid API KeyInvalid API Key
402Insufficient credit. Please top up API credits.Insufficient credit. Please top up API credits.
403Credits 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.
422Validation error. Includes invalid Base64, non-image payloads, unsupported formats, and decoded size over 20.0 MB.[object Object]
429Rate 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"}
500Internal Server ErrorInternal 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-image-without-background-base64"

Contract sections are generated at build time from OpenAPI. Markdown mirror: /docs/pro-model/car-background-removal-base64.md