Create and protect an API key
Sign up, create an API key in the dashboard, and store it in a server-side secret manager. Do not embed a live key in browser code, public repositories, or logs.
Send an image request
The endpoint is POST https://api.bgfree.app/v1.0/removebg. Authenticate with X-Api-Key and send multipart image_file (or image), image_url, or image_base64. Optional supported fields include size, format, and bg_color. The response is binary image data on success and a JSON error object on failure.
Handle failures and inspect output
Check HTTP status before treating the body as an image. Handle authentication, insufficient image balance, invalid input, rate limits, and processing failures. Keep request IDs for support and avoid logging image bytes or secrets.