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.

Quick Start Example
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.png

Free API Key

Sign up to get your free API key with 50 requests per month. No credit card required.

Get Free API Key

Authentication

All API requests require authentication using an API key sent in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Keep 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

POST/api/remove-background

Remove background from an image using AI models

Request

Send a multipart/form-data request with the following fields:

ParameterTypeRequiredDescription
imageFileImage file (PNG, JPG, JPEG, WebP)
modelTypeStringAI model to use (default: universal)
formatStringOutput format: png, jpg (default: png)
sizeStringOutput size: auto, preview, full (default: auto)

AI Models

Choose the best model for your use case:

Portrait

176MB

Optimized for people and portraits with excellent hair detail detection.

People Hair Details High Quality
-F "modelType=portrait"

Universal

176MB

General-purpose model for objects, animals, and various subjects.

Objects Animals Products
-F "model=universal"

Fast

4.7MB

Lightweight model for quick processing and real-time applications.

Fast Real-time Efficient
-F "model=fast"

BiRefNet

973MB

State-of-the-art model for highest quality with high-resolution support.

Best Quality High-res All Subjects
-F "model=birefnet"

BRIA

176MB

Balanced quality and speed for commercial use with general subjects.

Balanced Commercial Efficient
-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 previews
  • full - 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.