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
ParameterTypeDescription
image_filefilePNG, JPG or WEBP, max 12 MB (multipart)
image_file_b64stringBase64 image (JSON body alternative)
sizepreview | fullDefault 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 image
  • X-Credits-Remaining — your balance after this call
  • X-Job-Id — reference for support
  • X-RateLimit-Limit — requests allowed per minute

Errors

Errors return JSON: {"errors":[{"code":"...","title":"..."}]}

StatusCodeMeaning
400missing_image / invalid_size / bad_requestRequest is missing the image or has invalid parameters
401auth_missingNo X-Api-Key header
402insufficient_creditsNot enough credits — top up or enable auto refill
403auth_invalidKey is wrong or revoked
413file_too_largeImage is over 12 MB
415unsupported_type / unsupported_content_typeUse PNG, JPG or WEBP via multipart or JSON
429rate_limitedOver 60 requests per minute per key — see Retry-After
502engine_errorProcessing failed. You were not charged; retry later