The Background Remover endpoint accepts a base64-encoded image, uploads it to ImageKit (under theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nayalsaurav/ai360/llms.txt
Use this file to discover all available pages before exploring further.
minor-project folder), and returns the resulting CDN URL. Background removal is applied by appending ImageKit’s effect=bgremove URL transformation parameter to the returned URL — no additional server processing is required after the upload.
This design means the raw upload URL is returned from the API; your frontend applies the bgremove transformation at render time by constructing the ImageKit transformation URL.
Request
The image to process, encoded as a base64 string. Common formats (PNG,
JPEG, WebP) are all accepted by ImageKit. Do not include a data URL prefix
(e.g.
data:image/png;base64,) — pass the raw base64 content only, unless
your ImageKit SDK version handles it transparently.Response
A successful request returns HTTP 200 with the following body:The ImageKit CDN URL of the uploaded image. To display the image with its
background removed, append the
?tr=bgremove query parameter (or use
ImageKit’s SDK transformation: [{ effect: "bgremove" }]) when constructing
the final <img> src.The ImageKit processes the transformation on the fly and caches the result on
its CDN.
url returned is the original upload URL. To render the
background-removed version, append ?tr=bgremove to the URL:Error Responses
| Status | Body | Cause |
|---|---|---|
400 | { "error": "Missing image file" } | The file field was absent or empty in the request body. |
500 | { "error": "Failed to remove background" } | ImageKit upload failed or an unexpected server error occurred. |
Environment Variables
| Variable | Description |
|---|---|
NEXT_PUBLIC_IMAGEKIT_PUBLIC_KEY | Your ImageKit public API key. |
IMAGEKIT_PRIVATE_KEY | Your ImageKit private API key (server-side only). |
NEXT_PUBLIC_IMAGEKIT_URL_ENDPOINT | Your ImageKit URL endpoint (e.g. https://ik.imagekit.io/your_id). |