The Background Remover uploads a base64-encoded image to ImageKit via the server-side Node SDK, then applies ImageKit’sDocumentation 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.
bgremove AI transformation to cleanly erase the background. The uploaded original is stored in the minor-project folder on your ImageKit media library, and the transformed URL — with background removal applied as a URL parameter — is returned to the client for display and download.
How to use
Upload an image
Click the upload zone (or drag and drop) to select a PNG, JPG, or GIF file up to 10 MB in size. A preview of your original image will appear immediately.
Remove the background
Click Remove Background. A skeleton loader is shown while your image is uploaded to ImageKit and the AI transformation is applied.
How it works
The tool follows a five-step pipeline between the browser and ImageKit:- Client encodes the image — the browser reads the selected file with
FileReaderand produces a base64 data URL. - Client calls the API — the pure base64 string (data URL prefix stripped) is sent in the request body to
/api/utilities/background-remover. - Server uploads to ImageKit — the route handler calls
imagekit.upload()withfolder: 'minor-project'and a timestamped file name. - Server builds the transformation URL —
imagekit.url()appends thebgremoveeffect as a URL transformation parameter to the uploaded image’s URL. - Client receives and renders the result — the response contains the original upload URL, and the
<IKImage>component appliesaiRemoveBackground: trueas a client-side transformation when rendering.
API integration
Convert your file to base64 first, then call the endpoint:url is the ImageKit CDN URL of the original uploaded image. Background removal is applied by appending ImageKit’s bgremove transformation parameter — either via imagekit.url() on the server or the <IKImage> component’s transformation prop on the client.
Request & Response
POST /api/utilities/background-remover
Request body
| Field | Type | Required | Description |
|---|---|---|---|
file | string | ✅ Yes | Base64-encoded image string (data URL or raw base64). |
| Field | Type | Description |
|---|---|---|
url | string | ImageKit CDN URL of the uploaded original image. Apply bgremove transformation to display the background-removed version. |
| Status | Condition |
|---|---|
400 | file field is missing from the request body. |
500 | ImageKit upload or URL generation failed. |
Required environment variables
| Variable | Description |
|---|---|
NEXT_PUBLIC_IMAGEKIT_PUBLIC_KEY | Your ImageKit public API key (safe to expose client-side). |
IMAGEKIT_PRIVATE_KEY | Your ImageKit private API key (server-side only — keep secret). |
NEXT_PUBLIC_IMAGEKIT_URL_ENDPOINT | Your ImageKit URL endpoint. |
The URL endpoint follows the format
https://ik.imagekit.io/your_imagekit_id. You can find all three values in the Developer section of your ImageKit dashboard. Never expose IMAGEKIT_PRIVATE_KEY to the client — it is only used in server-side API routes.Upload authentication endpoint
AI360 also exposes a
GET /api/upload-auth endpoint that generates short-lived signed upload credentials — token, expire, and signature — for direct client-side uploads to ImageKit. It uses getUploadAuthParams from @imagekit/next/server and returns the credentials alongside your public key. This allows browser code to upload files directly to ImageKit without routing the binary data through your Next.js server.