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
- The application identifier is a fixed constant: send it in the
X-App-Keyheader (Monitor fieldApplication.apiKey). When you are signed in, the samples below pick it up from your profile asappKey. - For billed calls, create or copy an end-user API key in the Console and send it as
X-Api-Key. - POST
multipart/form-datawith a single fieldimage: binary file, or text (http(s) URL, raw base64, ordata: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
| Name | In | Description |
|---|---|---|
| X-App-Key | Header | Required. Application API key (Application.apiKey). |
| X-Api-Key | Header | Optional. End-user API key for authenticated billing (must belong to that application and be active). |
| image | Multipart | Single 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
| Item | Description |
|---|---|
| Body | Raw image bytes from the configured upstream (often PNG with alpha). |
| Content-Type | Set by upstream (e.g. image/png). |
| 200 | Success. |
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.pngHTTP errors
| Status | Typical cause |
|---|---|
| 400 | Missing X-App-Key, invalid multipart, conflicting `image` file+text, or empty/invalid `image` content. |
| 401 | Invalid X-Api-Key, or key does not match the application from X-App-Key. |
| 403 | Insufficient credits for authenticated usage. |
| 404 | No Monitor application matches the X-App-Key value. |
| 429 | Anonymous daily limit or throttling. |
| 503 | ClearBG integration disabled or not configured. |
| 502 | Upstream provider error or unreachable. |