Background Removal API Documentation
Complete guide to integrating the NOBG.LINK background removal API into your applications with code examples and best practices.
Getting Started
The NoBG.link API provides fast and accurate background removal powered by state-of-the-art AI models. Get started in minutes with our simple REST API.
curl -X POST https://www.nobg.link/api/remove-background \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "image=@photo.jpg" \
-F "modelType=portrait" \
-F "format=png" \
-o result.pngFree API Key
Sign up to get your free API key with 50 requests per month. No credit card required.
Get Free API KeyAuthentication
All API requests require authentication using an API key sent in the Authorization header:
Authorization: Bearer YOUR_API_KEYKeep Your API Key Secure
Never expose your API key in client-side code or public repositories. Use environment variables or secure key management systems.
API Endpoints
Remove background from an image using AI models
Request
Send a multipart/form-data request with the following fields:
| Parameter | Type | Required | Description |
|---|---|---|---|
image | File | Image file (PNG, JPG, JPEG, WebP) | |
modelType | String | ✗ | AI model to use (default: universal) |
format | String | ✗ | Output format: png, jpg (default: png) |
size | String | ✗ | Output size: auto, preview, full (default: auto) |
AI Models
Choose the best model for your use case:
Portrait
176MBOptimized for people and portraits with excellent hair detail detection.
-F "modelType=portrait"Universal
176MBGeneral-purpose model for objects, animals, and various subjects.
-F "model=universal"Fast
4.7MBLightweight model for quick processing and real-time applications.
-F "model=fast"BiRefNet
973MBState-of-the-art model for highest quality with high-resolution support.
-F "model=birefnet"BRIA
176MBBalanced quality and speed for commercial use with general subjects.
-F "model=bria"Parameters
Image Parameter
- Supported formats: PNG, JPG, JPEG, WebP
- Maximum file size: 25MB
- Maximum dimensions: 10,000 x 10,000 pixels
Model Parameter
Available values:portrait,universal,fast,birefnet,bria
Format Parameter
png- Transparent background (default)jpg- White background, smaller file size
Size Parameter
auto- Original image size (default)preview- 625x400px for previewsfull- Full resolution
Error Handling
The API uses conventional HTTP response codes:
400 - Bad Request
Invalid request parameters or missing required fields
{
"error": "invalid_request",
"message": "Missing required parameter: image"
}401 - Unauthorized
Invalid or missing API key
{
"error": "unauthorized",
"message": "Invalid API key"
}429 - Too Many Requests
Rate limit exceeded
{
"error": "rate_limit_exceeded",
"message": "Rate limit exceeded. Try again in 60 seconds",
"retry_after": 60
}SDKs & Libraries
Official SDKs and community libraries for popular programming languages:
JavaScript/Node.js
npm install removebg-api
import RemoveBG from 'removebg-api';
const api = new RemoveBG('YOUR_API_KEY');
const result = await api.remove('image.jpg');Python
pip install removebg-python
from removebg import RemoveBG
api = RemoveBG('YOUR_API_KEY')
result = api.remove('image.jpg')PHP
composer require removebg/php-sdk
use RemoveBG\RemoveBG;
$api = new RemoveBG('YOUR_API_KEY');
$result = $api->remove('image.jpg');Ruby
gem install removebg
require 'removebg'
api = RemoveBG::API.new('YOUR_API_KEY')
result = api.remove('image.jpg')Community SDKs
Looking for other languages? Check our community SDKs repository for Go, Java, C#, and more.