API documentation
One endpoint. Send an image, get a transparent PNG back. Same credits and prices as the web app.
1. Get an API key
Create a key under API keys in your account. The key is shown once — store it on your server, never in a browser or mobile app.
2. Send a request
POST https://dropthebg.com/api/v1/dropthebg
curl -X POST https://dropthebg.com/api/v1/dropthebg \
-H "X-Api-Key: dtb_live_xxxxxxxx" \
-F "image_file=@product.jpg" \
-F "size=full" \
-o product-no-bg.png| Parameter | Type | Description |
|---|---|---|
| image_file | file | PNG, JPG or WEBP, max 12 MB (multipart) |
| image_file_b64 | string | Base64 image (JSON body alternative) |
| size | preview | full | Default full. Preview ≤ 0.25 MP, full ≤ 25 MP |
JSON alternative
POST /api/v1/dropthebg
Content-Type: application/json
X-Api-Key: dtb_live_xxxxxxxx
{ "image_file_b64": "iVBORw0KGgo...", "size": "full" }Node.js
const form = new FormData();
form.append("image_file", fs.createReadStream("product.jpg") /* or a Blob */);
form.append("size", "preview");
const res = await fetch("https://dropthebg.com/api/v1/dropthebg", {
method: "POST",
headers: { "X-Api-Key": process.env.DROPTHEBG_API_KEY },
body: form,
});
if (!res.ok) throw new Error((await res.json()).errors[0].title);
console.log("Credits left:", res.headers.get("X-Credits-Remaining"));3. Response
200 OK with the PNG image as the body, plus these headers:
X-Credits-Charged— credits used for this imageX-Credits-Remaining— your balance after this callX-Job-Id— reference for supportX-RateLimit-Limit— requests allowed per minute
Errors
Errors return JSON: {"errors":[{"code":"...","title":"..."}]}
| Status | Code | Meaning |
|---|---|---|
| 400 | missing_image / invalid_size / bad_request | Request is missing the image or has invalid parameters |
| 401 | auth_missing | No X-Api-Key header |
| 402 | insufficient_credits | Not enough credits — top up or enable auto refill |
| 403 | auth_invalid | Key is wrong or revoked |
| 413 | file_too_large | Image is over 12 MB |
| 415 | unsupported_type / unsupported_content_type | Use PNG, JPG or WEBP via multipart or JSON |
| 429 | rate_limited | Over 60 requests per minute per key — see Retry-After |
| 502 | engine_error | Processing failed. You were not charged; retry later |