AI Background Remover
This endpoint uses a Machine Learning engine to detect the primary subject of an image and strip away the background, returning a transparent, high-quality PNG.
Endpoint
Section titled “Endpoint” POST
/api/v1/remove-bg Request Parameters
Section titled “Request Parameters”The following parameters are accepted in the request body:
| Field | Type | Required | Description | Example |
|---|---|---|---|---|
imageUrl | string | Yes | A direct HTTP/HTTPS link to the image you want processed. | https://example.com/photo.jpg |
Request Examples
Section titled “Request Examples”curl -X POST https://heavstal.com.ng/api/v1/remove-bg \-H "Content-Type: application/json" \-H "x-api-key: <YOUR_API_KEY>" \-d '{"imageUrl": "https://example.com/photo.jpg"}'const response = await fetch('https://heavstal.com.ng/api/v1/remove-bg', { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': '<YOUR_API_KEY>' }, body: JSON.stringify({ imageUrl: "https://example.com/photo.jpg" })});
const res = await response.json();console.log("Transparent Image:", res.data.url);import { ai } from '@heavstal/api';
const result = await ai.removeBg("https://example.com/photo.jpg");console.log("Transparent Image:", result.url);import requests
url = "https://heavstal.com.ng/api/v1/remove-bg"headers = { "Content-Type": "application/json", "x-api-key": "<YOUR_API_KEY>"}payload = { "imageUrl": "https://example.com/photo.jpg"}
response = requests.post(url, headers=headers, json=payload)print(response.json()["data"]["url"])Response Examples
Section titled “Response Examples”{ "status": "success", "creator": "HEAVSTAL TECH", "data": { "original_url": "https://example.com/photo.jpg", "url": "https://files.catbox.moe/transparent-bg.png" }}{ "error": "Failed to remove image background", "details": "A valid 'imageUrl' parameter is required.", "status": 400}