bgeraser API: Add Background Removal to Your App in 5 Minutes
Getting Your API Key
Sign up at bgeraser.ink and navigate to your Dashboard. In the API section, click 'Generate API Key' to create your first key. Each key is scoped to your account's credit balance — the same credits used in the web editor are consumed by API calls. Store this key securely; treat it like a password.
Your free tier includes 15 credits per month, each API call consuming 1 credit regardless of the tool used. For production applications, upgrade to a paid plan for higher limits and priority processing. All plans include the same API endpoints and response quality — the only difference is volume.
Your First API Call
The simplest integration is a single cURL command. Send a multipart POST request with your image file and API key to receive the processed result. Here's background removal in one line: curl -X POST https://bgeraser.ink/api/tools/bg-removal -H 'Authorization: Bearer YOUR_API_KEY' -F '[email protected]'. The response is JSON containing a URL to the processed image, dimensions, and processing metadata.
For Node.js applications, install the fetch API (built into Node 18+) or use any HTTP client. Create a FormData instance, append your image buffer or file stream, and POST to the endpoint with your API key in the Authorization header. The response JSON includes: imageUrl (the processed result), width, height, format, and processingTimeMs.
Every tool follows the same pattern — only the endpoint path changes. Replace /bg-removal with /upscale, /generative-fill, /generative-expand, /magic-select, /crop, or /brush. Tools that accept parameters (like upscale factor or crop dimensions) take additional form fields documented in the API reference.
Response Format and Error Handling
Successful responses return HTTP 200 with a JSON body: { "success": true, "data": { "imageUrl": "https://...", "width": 1920, "height": 1080, "format": "png", "processingTimeMs": 1450 } }. The imageUrl is a signed URL valid for 24 hours — download and store the result in your own infrastructure for permanent access.
Errors follow a consistent structure: { "success": false, "error": { "code": "INSUFFICIENT_CREDITS", "message": "..." } }. Common error codes include INVALID_API_KEY (401), INSUFFICIENT_CREDITS (402), FILE_TOO_LARGE (413, max 25 MB), UNSUPPORTED_FORMAT (415), and RATE_LIMITED (429). Implement exponential backoff for 429 responses — the Retry-After header indicates when to retry.
For production reliability, always validate the image URL is accessible after receiving the response. Implement a timeout of 30 seconds for the API call itself (processing rarely exceeds 5 seconds, but network conditions vary). Log the processingTimeMs field to monitor performance trends in your integration.
Production Patterns
For high-volume applications, implement a worker queue pattern. Enqueue image processing jobs, have workers call the bgeraser API with concurrency limited to your plan's rate limit (10 concurrent for standard, 50 for business), and store results in your object storage (S3, GCS, R2). This decouples your user-facing latency from image processing time.
Webhook support is coming soon for async processing of large batches. In the meantime, the synchronous API handles most production loads effectively — our p95 response time is under 3 seconds for background removal and under 8 seconds for generative operations. Monitor the X-RateLimit-Remaining response header to proactively manage your request flow.
If you're building a user-facing feature where customers upload images, consider processing in the background and notifying users when complete. This avoids holding HTTP connections open and provides a better user experience for operations that may take a few seconds. The API is stateless — you can safely retry failed requests without risk of duplicate processing charges.
Try bgeraser Tools
Related Posts
Introducing bgeraser: 7 AI Image Editing Tools in One Platform
We built bgeraser because image editing shouldn't require five different apps, three subscriptions, and a design degree. Today we're launching 7 AI-powered tools in a single platform with a generous free tier.
How to Remove Backgrounds from Product Photos (Complete Guide)
Clean product photos on white or transparent backgrounds convert better on every marketplace. This guide covers the complete workflow — from shooting photos that cut out cleanly to batch-processing your entire catalog via API.