ClearBG.ai

API Documentation

Call the ClearBG Monitor API with a single HTTP POST. Use your application API key and (for billed usage) an end-user API key from the Console.

Getting started

  1. The application identifier is a fixed constant: send it in the X-App-Key header (Monitor field Application.apiKey). When you are signed in, the samples below pick it up from your profile as appKey.
  2. For billed calls, create or copy an end-user API key in the Console and send it as X-Api-Key.
  3. POST multipart/form-data with a single field image: binary file, or text (http(s) URL, raw base64, or data:image/...;base64,...) — the server detects the format automatically.

Endpoint

Replace {MONITOR_URL} with your Monitor deployment origin (no trailing slash; the path already includes /api).

POSThttps://clearbgapi.testlucy.com/api/v1/clearbg

Request

NameInDescription
X-App-KeyHeaderRequired. Application API key (Application.apiKey).
X-Api-KeyHeaderOptional. End-user API key for authenticated billing (must belong to that application and be active).
imageMultipartSingle field: file (≤ 25 MB) or text — http(s) URL, base64, or data URL; format is auto-detected.

Without X-Api-Key, the request may be treated as anonymous and subject to deployment-specific limits.

Response

ItemDescription
BodyRaw image bytes from the configured upstream (often PNG with alpha).
Content-TypeSet by upstream (e.g. image/png).
200Success.

Sample code

Examples use https://clearbgapi.testlucy.com as the Monitor base URL.

Input
Sample code
curl -X POST \
  -H 'X-App-Key: INSERT_YOUR_APPLICATION_API_KEY' \
  -H 'X-Api-Key: INSERT_YOUR_USER_API_KEY' \
  -F 'image=@/path/to/file.jpg' \
  -f 'https://clearbgapi.testlucy.com/api/v1/clearbg' \
  -o result.png

HTTP errors

StatusTypical cause
400Missing X-App-Key, invalid multipart, conflicting `image` file+text, or empty/invalid `image` content.
401Invalid X-Api-Key, or key does not match the application from X-App-Key.
403Insufficient credits for authenticated usage.
404No Monitor application matches the X-App-Key value.
429Anonymous daily limit or throttling.
503ClearBG integration disabled or not configured.
502Upstream provider error or unreachable.