API Documentation
Remove backgrounds programmatically. Simple REST API with predictable responses.
Quick Start
curl
curl -X POST https://nobg.app/api/v1/remove \
-H "X-API-Key: your_api_key" \
-F "image=@photo.jpg" \
-F "mode=common" Response:
{
"url": "https://cdn.nobg.app/results/abc123.png",
"mode": "common",
"usage": { "used": 1, "limit": 100, "remaining": 99 }
} Authentication
All API requests require an API key sent via the X-API-Key header.
X-API-Key: nobg_live_abc123def456 You can generate API keys from your dashboard. All paid plans include API access.
Endpoints
POST
/api/v1/remove Remove the background from an image. Accepts multipart/form-data.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
image | File | Yes | Image file (JPEG, PNG, WebP). Max 10MB. |
mode | String | No | AI mode: common (default), body, product, food, clothing |
AI Modes
| Mode | Best For |
|---|---|
common | General purpose. Auto-upgrades to HD for large images. |
body | Portraits and people. Auto-upgrades to HD for large images. |
product | E-commerce products. |
food | Food photography. |
clothing | Fashion and apparel. |
Response
{
"url": "https://cdn.nobg.app/results/abc123.png",
"mode": "product",
"usage": {
"used": 42,
"limit": 100,
"remaining": 58
}
} Response Headers
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests per hour (100) |
X-RateLimit-Remaining | Remaining requests in current window |
Error Codes
| Status | Code | Meaning |
|---|---|---|
401 | Missing or invalid API key | Check your X-API-Key header |
429 | Rate limit exceeded | 100 requests/hour per key. Retry after Retry-After seconds |
422 | Invalid input | Missing image, unsupported format, or file too large |
500 | Server error | AI processing failed. Retry the request. |
Rate Limits
- 100 requests per hour per API key
- Rate limit info in
X-RateLimit-*response headers - On 429, check
Retry-Afterheader for cooldown seconds - Result URLs are valid for 24 hours
Code Examples
Python
import requests
response = requests.post(
"https://nobg.app/api/v1/remove",
headers={"X-API-Key": "your_api_key"},
files={"image": open("photo.jpg", "rb")},
data={"mode": "product"},
)
result = response.json()
print(result["url"]) # https://cdn.nobg.app/results/abc123.png JavaScript
const formData = new FormData();
formData.append("image", fileInput.files[0]);
formData.append("mode", "common");
const res = await fetch("https://nobg.app/api/v1/remove", {
method: "POST",
headers: { "X-API-Key": "your_api_key" },
body: formData,
});
const { url, usage } = await res.json();
console.log(url); // https://cdn.nobg.app/results/abc123.png
console.log(usage); // { used: 1, limit: 100, remaining: 99 } cURL
curl -X POST https://nobg.app/api/v1/remove \
-H "X-API-Key: your_api_key" \
-F "image=@photo.jpg" \
-F "mode=body" Need help? Go to NoBG.app