Comment on page
Troubleshooting
On this page, you will find some common questions or issues you might encounter when integrating the PhotoRoom API, along with their answer.
A: If your call is resulting in this error:
{"error":{"message":"Unauthorized"}}
Then it's likely that you either forgot to put your apiKey in the headers of your call or that your credit balance has reached zero.
Here's a sample code in JavaScript:
const removeBackground = async (base64Image) => {
const options = {
method: "POST",
headers: {
"x-api-key": YOUR_API_KEY,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({
image_file_b64: base64Image.split(",")[1],
}),
};
fetch("https://sdk.photoroom.com/v1/segment", options)
.then((response) => response.json())
.then((response) => {
console.log(response);
})
.catch((err) => console.error(err));
};
A: Calls to the PhotoRoom API will return a binary image in the body of the HTTP response.
In order to properly decode the image when using Axios to make the API call, you'll need to configure the call with the option
{ responseType: 'arraybuffer' }
:const url = /* create the URL for your API call */
const options = { responseType: 'arraybuffer' }
const result = await axios.get(url, options)
A: The PhotoRoom API is used by the PhotoRoom iOS, Android, and Web apps. Timeouts are unlikely to happen or would impact our own products in a critical way.
If PhotoRoom API has stopped working on your side, please check the following points:
- 1.Do you still have credits? Visit your dashboard and check your remaining credits, you can buy more credits directly from your dashboard if needed.
- 2.Is the API returning an error or an erroneous image? Report your technical bug or issue using the procedure explained in the following question.
A: We currently don't provide technical support for implementing the API over email.
In case of an integration issue or of a bug on PhotoRoom's side:
- 2.Share with us:
- A standalone code to reproduce the bug
- The original input image you used
- The output image returned by PhotoRoom API
- A detailed description or visual example of the expected image you would have liked to get
We will investigate the issue and come back to you shortly.
Last modified 4d ago