Background Remover API

Automatically Remove Backgrounds from Any Image with AI.

hero banner

Code Examples in Popular Languages

Integrate our Background Remover API easily into your apps with comprehensive code examples in popular languages to get started quickly.

CURL Request
curl --location 'https://theonlineconverter.com/api/v1/background-remover' \
--header 'Content-Type: application/json' \
--header 'x-api-key: enter_your_api_key' \
--form 'file=@"/D:/data/Images/jpg/dummy.jpg"'
JavaScript Fetch
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "enter_your_api_key");

const formdata = new FormData();
formdata.append("file", fileInput.files[0], "/D:/data/Images/jpg/dummy.jpg");

const requestOptions = {
  method: "POST",
  headers: myHeaders,
  body: formdata,
  redirect: "follow"
};

fetch("https://theonlineconverter.com/api/v1/background-remover", requestOptions)
  .then((response) => response.text())
  .then((result) => console.log(result))
  .catch((error) => console.error(error));
Ruby Net::HTTP
import requests
import json

url = "https://theonlineconverter.com/api/v1/background-remover"

payload = {}
files=[
  ('file',('dummy.jpg',open('/D:/data/Images/jpg/dummy.jpg','rb'),'image/jpeg'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
Python Requests
import requests
import json

url = "https://theonlineconverter.com/api/v1/background-remover"

payload = {}
files=[
  ('file',('dummy.jpg',open('/D:/data/Images/jpg/dummy.jpg','rb'),'image/jpeg'))
]
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'enter_your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
PHP Guzzle
<?php
$client = new Client();
$headers = [
  'Content-Type' => 'application/json',
  'x-api-key' => 'enter_your_api_key'
];
$options = [
  'multipart' => [
    [
      'name' => 'file',
      'contents' => Utils::tryFopen('/D:/data/Images/jpg/dummy.jpg', 'r'),
      'filename' => '/D:/data/Images/jpg/dummy.jpg',
      'headers'  => [
        'Content-Type' => '<Content-type header>'
      ]
    ]
]];
$request = new Request('POST', 'https://theonlineconverter.com/api/v1/background-remover', $headers);
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
Java HttpURLConnection
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
  .addFormDataPart("file","/D:/data/Images/jpg/dummy.jpg",
    RequestBody.create(MediaType.parse("application/octet-stream"),
    new File("/D:/data/Images/jpg/dummy.jpg")))
  .build();
Request request = new Request.Builder()
  .url("https://theonlineconverter.com/api/v1/background-remover")
  .method("POST", body)
  .addHeader("Content-Type", "application/json")
  .addHeader("x-api-key", "enter_your_api_key")
  .build();
Response response = client.newCall(request).execute();
Go net/http
package main

import (
  "fmt"
  "bytes"
  "mime/multipart"
  "os"
  "path/filepath"
  "net/http"
  "io"
)

func main() {

  url := "https://theonlineconverter.com/api/v1/background-remover"
  method := "POST"

  payload := &bytes.Buffer{}
  writer := multipart.NewWriter(payload)
  file, errFile1 := os.Open("/D:/data/Images/jpg/dummy.jpg")
  defer file.Close()
  part1,
         errFile1 := writer.CreateFormFile("file",filepath.Base("/D:/data/Images/jpg/dummy.jpg"))
  _, errFile1 = io.Copy(part1, file)
  if errFile1 != nil {
    fmt.Println(errFile1)
    return
  }
  err := writer.Close()
  if err != nil {
    fmt.Println(err)
    return
  }


  client := &http.Client {
  }
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Content-Type", "application/json")
  req.Header.Add("x-api-key", "enter_your_api_key")

  req.Header.Set("Content-Type", writer.FormDataContentType())
  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := io.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
C# HttpClient
var options = new RestClientOptions("https://theonlineconverter.com")
{
  MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/api/v1/background-remover", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("x-api-key", "enter_your_api_key");
request.AlwaysMultipartFormData = true;
request.AddFile("file", "/D:/data/Images/jpg/dummy.jpg");
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);

Key Features & Capabilities

Our API is powered by a sophisticated AI model to deliver clean, professional-grade cutouts for any use case.

Simple User Interface

AI-Powered Subject Detection

Leverage a deep learning model trained to accurately identify the main subject—whether it's a person, product, or object—and separate it from the background.

Simple Data Format

High-Precision Edges

Achieve clean, smooth, and professional-looking cutouts. Our AI intelligently handles challenging areas to produce sharp edges on your subject.

Time

Handles Complex Details

The model is specifically trained to manage difficult details like hair, fur, and fine strands, providing a superior result compared to traditional methods.

Secure Data

Transparent PNG Output

The primary output is a high-quality PNG file with a transparent background (alpha channel), ready to be placed on any new design or backdrop.

Universal Access

E-commerce Ready

Perfect for creating clean, consistent product images for online stores, marketplaces, and catalogs, helping to increase conversion rates.

Freedom

Secure & Confidential

All images are processed over encrypted connections. We guarantee confidentiality with a strict data privacy policy and do not store your files.

Frequently Asked Questions

Find answers to common questions about our Background Remover API to understand how our AI achieves stunning results.

Our Artificial Intelligence has been trained on millions of images, learning to distinguish common foreground subjects (like people, products, animals, and cars) from their backgrounds. It analyzes the image to create a precise mask around the subject before removing the rest.

For the best cutouts, use images where the main subject is in clear focus. Good lighting and a reasonable contrast between the subject and the background also help the AI perform optimally.

Yes. This is one of the key strengths of our AI model. It is specifically trained to handle the complexity of hair and fur to create a realistic and clean cutout without the usual jagged edges.

The standard output is a PNG file. The PNG format supports alpha channel transparency, which means the background is truly transparent, not just white.

While the primary output is transparent, you could easily add a color background in a subsequent step. Some of our SDKs may include helper functions for this, or you can use any image processing library.

The process is very fast, typically taking only a few seconds per image, depending on the image resolution and current server load.

Absolutely. We use end-to-end TLS encryption for all data transfers. Your image files are processed securely and are permanently deleted from our servers immediately after the job is complete.