Remove Background API
The Remix API is an application programming interface that generates product images naturally based on a given reference image and prompt. With this API, users can seamlessly create product photos that align with their desired specifications.
Authentication
header
X-Photio-Key : {PHOTIO_API_KEY}
Do you not have an API key yet?
To call the API, you first need to obtain a Photio API key. To get your API key, go to the API Dashboard. After registering your card, you can use the issued API key.
Request Body
Variable | Type | Require | Default | Description |
---|---|---|---|---|
image | string | ✓ | - | This can be either a image in base64 format or an image URL. Input image for background removal. |
- Shell
- Python
- Java
- JS
curl --request POST
--url https://api.photio.io/v1/inference/removebg
--header 'X-Photio-Key: {X-Photio-Key}'
--header 'Content-Type: application/json'
--data '{ "image": "https://d2yiwnckkg6ukk.cloudfront.net/example/perfume_on_the_beach_output.png"}'
import requests
import json
data = {
"image": "https://d2yiwnckkg6ukk.cloudfront.net/example/perfume_on_the_beach_output.png"
}
body_data = json.dumps(data)
# Set the necessary headers
headers = {
'X-Photio-Key': '{X-Photio-Key}',
'Content-Type': 'application/json'
}
response = requests.post('https://api.photio.io/v1/inference/removebg', headers=headers, data=body_data)
class Generate {
public void remix() {
URL url = new URL("https://api.photio.io/v1/inference/removebg");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("X-Photio-Key", "${PHOTIO_API_KEY}");
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
JSONObject data = new JSONObject();
data.put("image", "https://d2yiwnckkg6ukk.cloudfront.net/example/perfume_on_the_beach_output.png");
String bodyData = data.toString();
try (OutputStream os = conn.getOutputStream()) {
byte[] input = bodyData.getBytes("utf-8");
os.write(input, 0, input.length);
}
int responseCode = conn.getResponseCode();
System.out.println("Response Code : " + responseCode);
conn.disconnect();
}
}
const data = {
image: "https://d2yiwnckkg6ukk.cloudfront.net/example/perfume_on_the_beach_output.png",
};
const bodyData = JSON.stringify(data);
// Set the necessary headers
const headers = {
'X-Photio-Key': '{X-Photio-Key}',
'Content-Type': 'application/json'
};
fetch('https://api.photio.io/v1/inference/removebg', {
method: 'POST',
headers: headers,
body: bodyData
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Response
Variable | Type | Description |
---|---|---|
status_code | int | In the response, you can find a status value to check the status of the request. A normal response is indicated by 200, authentication issues by 401, and API status problems by a 500 error. |
body | string | The result image data is output as a Base64-encoded string. |
Response Example
{
"status_code": Int,
"body": Base64 String
}
Output Example