<aside> 💡 This page is deprecated. The official documentation is now hosted here https://docs.photoroom.com/
</aside>
👋 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 api-help@photoroom.com 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.
https://sdk.photoroom.com/v1/segment
x-api-key
: your PhotoRoom API key. Get one here.image_file
: the image you want to remove background on, in its binary formatformat
: (default: png
) Format of the returned image. Can be png or jpg. (Note for jpg you must either have bg_color
specified or channels=alpha
)channels
: (default: rgba
). If rgba
, a composed image is returned. If alpha
, a black and white images is returned, where white is the foreground and black is the backgroundbg_color
: (default: empty). Can be a hex code (#FF00FF
) or a HTML color (red
, green
, etc...). If set, set the background of the returned image to the specified colorsize
: (default full). Will resize the output to the specified size. Can be preview
(0.25 Megapixels), medium
(1.5 MP), hd
(4 MP) or full
(36 MP, can be slower for large images). Useful for mobile apps that need smaller images. preview
size use a 1/4 creditcrop
: (default: false
). If true
, the image returned is cropped to the cutout border. Transparent pixels are removed from the border