- வெளியிடப்பட்டது
Removebg API ஆவணங்கள்

விரைவு தொடக்கம்
curl --location 'https://removebg.one/api/v1/predict' \
--header 'Authorization: Bearer $API_KEY' \
--form 'file=@"test.png"'கோரிக்கை டொமைன்
https://removebg.oneகோரிக்கை இடம்
/api/v1/predictAPI கீ உருவாக்குதல்
API கீ பக்கம் இல் உங்கள் API கீ ஐ உருவாக்கவும் அல்லது மறுபரிசீலனை செய்யவும்.
கோரிக்கை பரிமாறிகள்
-
தற்பொழுது, File ஆவணங்களை மட்டும் formData வழியாக அனுப்ப முடியும், எனவே எப்போதும் Content-Type ஐ multipart/form-data என அமைக்கவும்.
-
API கீ பக்கம் இல் API கீ ஐ உருவாக்கிய பின், அந்த கீ மதிப்பை Authorization கோரிக்கை தலைப்பில் அமைக்கவும்.
Content-Type: multipart/form-data
Authorization: Bearer $API_KEY$API_KEY ஐ உங்கள் உண்மையான API கீ க்கு மாற்றம் செய்ய வேண்டி உள்ளது என்பதை நினைவில் வைக்கவும்.
பதிலளிப்பு பரிமாறிகள்
ஒரு 0 மதிப்புள்ள திரும்பக்கூடிய குறியீடு என்பது API அழைப்பு வெற்றிகரமாக இருந்ததைக் குறிக்கிறது. மற்ற எந்த குறியீடு தான் தோல்வியை குறிக்கின்றது, அதற்கான தனிப்பட்ட தோல்வி காரணம் செய்தி பகுதியில் தரப்பட்டுள்ளது.
- வெற்றிகரமான பதில்
{
"code": 0,
"data": {
"cutoutUrl": "https://r.removebg.one/static/8d062cc4-7d1d-4390-b958-a88e3a714e68.png?signature=...",
"maskUrl": "https://r.removebg.one/static/acd1904f-e7b6-4e20-92cc-29f19659caf8.png?signature=..."
}
}- தோல்வி பதில்
{
"code": 400,
"message": "Invalid request parameters."
}தயவுசெய்து கவனியுங்கள்: வெற்றி பெறப்பட்டபின் திரும்பப்பெறும் படத்தை URL 1 மணிநேரத்திற்கு மட்டுமே செல்லுபடியாக இருக்கும். அதை பாதுகாக்க அல்லது உங்கள் பயன்பாட்டின் அடிப்படையில் பயனருக்கு நேரத்தில் அறிவிக்கவும்.
குறியீட்டு உதாரணங்கள்
Fetch
const formData = new FormData()
formData.append('file', File)
fetch('https://removebg.one/api/v1/predict', {
method: 'POST',
body: formData,
headers: {
Authorization: 'Bearer $API_KEY',
},
})Java
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.util.EntityUtils;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.io.File;
public class RemoveBgApiRequest {
public static void main(String[] args) throws Exception {
String apiKey = "YOUR_API_KEY"; // Replace with your API key
String filePath = "test.png"; // Replace with your file path
String url = "https://removebg.one/api/v1/predict";
File file = new File(filePath);
// Create HTTP client
try (CloseableHttpClient client = HttpClients.createDefault()) {
HttpPost post = new HttpPost(url);
post.setHeader("Authorization", "Bearer " + apiKey);
// Build multipart form data
FileBody fileBody = new FileBody(file);
HttpEntity entity = MultipartEntityBuilder.create()
.addPart("file", fileBody)
.build();
post.setEntity(entity);
// Execute request
String response = EntityUtils.toString(client.execute(post).getEntity());
// Parse the JSON response
JsonObject jsonResponse = JsonParser.parseString(response).getAsJsonObject();
int code = jsonResponse.get("code").getAsInt();
if (code == 0) {
// Success
System.out.println("Success: Response data = " + jsonResponse.getAsJsonObject("data"));
} else {
// Failure
String message = jsonResponse.has("message") ? jsonResponse.get("message").getAsString() : "Unknown error";
System.out.println("Failure: " + message);
}
}
}
}Python
import requests
# Replace with your actual API key
api_key = 'your_api_key_here'
url = 'https://removebg.one/api/v1/predict'
# Path to the image file
file_path = 'test.png'
# Set up the headers with Authorization
headers = {
'Authorization': f'Bearer {api_key}'
}
# Open the image file in binary mode
with open(file_path, 'rb') as image_file:
# Send the POST request with the file
response = requests.post(url, headers=headers, files={'file': image_file})
# Check the response status
if response.code == 0:
print('Request successful')
# You can save or process the response content as needed
with open('output.png', 'wb') as output_file:
output_file.write(response.content)
else:
print(f'Error: {response.code}')
இறுதிக் குறிப்புகள்
என்றாலும் ஏதேனும் கேள்விகள் இருந்தால், எங்களை [email protected] இல் மின்னஞ்சல் செய்யவும்.
- ஆசிரியர்கள்

- பெயர்
- அதிகாரப்பூர்வ
- இணையதளம்
- ரிமூவ்பிஜி