<aside> 💡 This page is deprecated. The official documentation is now hosted here https://docs.photoroom.com/docs/api
👋 Welcome to the PhotoRoom API documentation.
The PhotoRoom API allows you to automatically remove backgrounds on any images.
While used by millions via the PhotoRoom mobile app, our API is still in its early days. If you have any questions on how it works, how to use it, and our pricing, please reach out to [email protected] so we can help you out.
First, you need an API key to use this API. To do so:
Our background removal API is a web endpoint you can call from any programming language as long as it can send images as form data (just like with a regular form). The exact way to do so depends on the programming language of your choice.
x-api-key: your PhotoRoom API key. Get one here.
**image_file**: the image you want to remove background on, in its binary format
png) Format of the returned image. Can be png or jpg. (Note for jpg you must either have
rgba, a composed image is returned. If
alpha, a black and white images is returned, where white is the foreground and black is the background
**bg_color**: (default: empty). Can be a hex code (
#FF00FF) or a HTML color (
green, etc...). If set, set the background of the returned image to the specified color
size: (default full). Will resize the output to the specified size. Can be
hd(4 MP) or
full(36 MP, can be slower for large images). Useful for mobile apps that need smaller images.
previewsize use a 1/4 credit
true, the image returned is cropped to the cutout border. Transparent pixels are removed from the border