Alphelo

Background removal API

Documentation. Create a free key in your account.

Open beta. The API is live and free to try: create an account, make a key and send your first image in a minute. Details may still change as we learn from your feedback.

What it is

A simple HTTP API: you send an image, you get back the same image with the background removed, as a transparent PNG. It uses the same Alpha 1 model as this site, and it is designed so that you can swap it into code you already have with small changes.

  • Free to start. Every account includes 100 images per month, shared by all its keys. Need more? Write to us: paid plans are not set yet.
  • The website needs no account. The tool on the home page stays free and private. The API is a separate service for apps, shops and teams that process images from their own software.
  • Privacy first. Each image is processed in memory and not stored. See “Your images” below.

A first call

Create a key in your account, then send one request and get one image back.

curl -X POST https://api.alphelo.com/v1/remove \
  -H "X-Api-Key: YOUR_API_KEY" \
  -F "[email protected]" \
  -o photo-without-background.png

Request

POST https://api.alphelo.com/v1/remove

Send your key in the X-Api-Key header. Create your keys in your account. Never put a key in code that runs in a web page or an app that others can read: call the API from your own server.

FieldTypeDescription
image_filefileThe image to process, sent as multipart/form-data. JPG, PNG or WebP. Send this or image_url.
image_urltextA public http or https address of the image, if you prefer not to upload the file yourself. We download it from our server, only from public addresses. Send this or image_file.
formattextpng (default, with transparency), webp or jpg. A JPG cannot be transparent, so without bg_color it gets a white background.
bg_colortextOptional. A colour to put behind the subject, as a hex code such as ffffff. Without it the background is transparent.
sizetextauto or full (default): the size of your image, up to 16 megapixels (larger photos are scaled down). preview, small or regular: the longer side is at most 1024 px. medium, hd and 4k: up to 1.5, 4 and 10 megapixels.
croptexttrue trims the result to the subject. Default false.

Limits: files up to 25 MB and 50 megapixels. Each key can send up to 30 requests per minute, and each account has 100 images per month for all its keys (it resets on the 1st, UTC). Send one request at a time per key: a photo takes about 4 seconds.

Response

On success the status is 200 and the body is the image itself, with the matching Content-Type (image/png, image/webp or image/jpeg). There is no JSON wrapper to unpack: save the bytes as a file. The headers X-Width and X-Height give the size of the result, and X-Model: alpha-1 tells you which model made it. Only a finished result counts against your monthly limit.

Errors

When something goes wrong, the status tells you what and the body is JSON like this. The same message is also repeated as errors[0].title, so code that reads errors from a list keeps working.

{
  "error": {
    "code": "image_too_large",
    "message": "The image is larger than 25 MB."
  },
  "errors": [{ "title": "The image is larger than 25 MB.", "code": "image_too_large" }]
}
StatusCodeWhen
400invalid_requestA field is missing, repeated or has a value we do not accept, or the file is not a readable image.
401invalid_keyThe key is missing, wrong or has been revoked.
402no_creditThe monthly limit of the account has been used. It resets on the 1st of the month, UTC.
413image_too_largeThe file is above 25 MB or the image has more than 50 megapixels.
415unsupported_typeThe file is not a JPG, PNG or WebP image.
400no_foregroundNo subject was found in the image.
429rate_limitedToo many requests, or the service is busy. Wait for the number of seconds in the Retry-After header.
500server_errorSomething went wrong on our side. It is safe to try again.

Examples

Python

import requests

with open("photo.jpg", "rb") as f:
    r = requests.post(
        "https://api.alphelo.com/v1/remove",
        headers={"X-Api-Key": "YOUR_API_KEY"},
        files={"image_file": f},
        data={"format": "png"},
        timeout=60,
    )

if r.ok:
    open("photo-without-background.png", "wb").write(r.content)
else:
    print(r.status_code, r.json()["error"]["message"])

JavaScript (Node.js)

// Node.js 18 or later
import { readFile, writeFile } from "node:fs/promises";

const form = new FormData();
form.append("image_file", new Blob([await readFile("photo.jpg")]), "photo.jpg");
form.append("format", "png");

const res = await fetch("https://api.alphelo.com/v1/remove", {
  method: "POST",
  headers: { "X-Api-Key": "YOUR_API_KEY" },
  body: form,
});

if (res.ok) {
  await writeFile("photo-without-background.png", Buffer.from(await res.arrayBuffer()));
} else {
  console.error(res.status, (await res.json()).error.message);
}

Your images

Each image is processed in memory and is gone when the response is sent: nothing is written to disk and nothing is used to train models. Our logs keep only technical details (time, name of the key, status and sizes), never the image or its address. See the privacy policy for how we handle your account email.

Moving existing code

If your code already sends an image and a key to a background removal service, switching to Alphelo usually means changing the address and the key, and in some cases a field name. We will publish a short migration note soon.

Create a key

Sign in with Google in your account, create up to 5 keys and follow your usage. We keep only your email address; you can delete your account and all your data at any time.

Open my account

Where we are

The API is in open beta: it works, but we have not set prices and we may change details. Tell us what you need at hello@alphelo.com.

The free tool stays free

Nothing changes for the tool on the home page: it stays free, with no account and no watermark, and your photos stay on your device.