Quickstart
Create an API key and remove your first image background.
Create an API key
Create an account, then open API keys in your dashboard. Create a key and store it in your server environment. The full key is shown only when you create it.
export OPENBG_API_KEY='your-api-key'
export OPENBG_API_URL='https://openbg-api.gantchevkaloyan.workers.dev'Never put an API key in browser code or commit it to a repository.
Send an image
Send the original image bytes. This request uses the default PNG output and saves it directly to a file.
curl --fail-with-body "$OPENBG_API_URL/api/v1/remove-background" \
-H "Authorization: Bearer $OPENBG_API_KEY" \
-H 'Content-Type: application/octet-stream' \
-H 'Accept: image/*' \
--data-binary @input.jpg \
--output cutout.pngA successful response has an image content type. Check the HTTP status before treating the output as an image; errors return JSON. A successful request uses one image credit.
Choose your next operation
Background removal supports masks, resizing, and output formats. Compression keeps the format and reduces size when possible. Conversion changes a static image, including HEIC, to JPEG, PNG, WebP, or AVIF.
Prefer a client library? Follow the source-installation instructions for Node.js or Python. You can also try the playground before writing code.