Web Integration
Last updated
Last updated
In this tutorial, I will show you how you can integrate the PhotoRoom API into a JavaScript or TypeScript codebase in just a few minutes.
The first thing you need to do is get your API key. Here are the steps you'll need to follow:
Visit PhotoRoom’s GitHub to find a sample code that's ready to use.
Simply copy and paste the code into your project, and update the placeholder with your own API key.
Warning: Please be aware that this will make your API key accessible to anyone browsing your website. If your website is public, we recommend calling our API through a proxy that you control (Firebase / Google functions, AWS lambda).
Now it's time to call the API in your code! Just use the function removeBackground() and pass in the file your user has selected.
The function will return a Blob containing a new image with the background removed.
That's it! With just these three easy steps, you can integrate the PhotoRoom Background Removal API into your web app and provide your users with high-quality images with clean backgrounds.
According to resellers who use the PhotoRoom app, this feature can increase sales by 20 up to 100%.
If you want to learn more about the PhotoRoom API and get your API key, visit https://www.photoroom.com/api.