API For Remove Background
December 10, 2024Less than 1 minute
API For Remove Background
Remove Background Describe
Our advanced AI Remove Background quickly recognizes the subject and removes the background in seconds, providing you with a clean, transparent image. It’s simple, fast, and perfect for all your design and editing needs.
Considerations
- Before using the API, make sure you have obtained the API key. Refer to the link below for instructions on how to obtain it. API For API Key Settings
- All generated images will be automatically deleted after 24 hours. Please make sure to save the images you need to your local storage in a timely manner.
Credits Consumption
Each time consumes 2 credits.
Header Attributes
Parameter | Description |
---|---|
Authorization | Your API Key used for request authorization. |
Create Job
Request Url
--request POST https://developer.remaker.ai/api/remaker/v2/ai-remove-bg/create-job
Body Attributes
Parameter | Type | Required | Description |
---|---|---|---|
remove_image | file[binary] | true | 需要去除背景的图片 |
demo
import requests
url = "https://developer.remaker.ai/api/remaker/v2/ai-remove-bg/create-job"
headers = {
'accept': 'application/json',
'Authorization': 'your token',
}
files = {
'remove_image': open('demo.png', 'rb')
}
response = requests.request("POST", url, headers=headers, files=files)
print(response.text)
Response
{
"code": 100000,
"result": {
"job_id": "your-job-id"
},
"message": {
"en": "Request Success."
}
}
Fetch Job
Request Url
--request GET https://developer.remaker.ai/api/remaker/v2/ai-remove-bg/get-job/your-job-id
Body Attributes
Parameter | Description |
---|---|
job_id | job_id returned by create task |
demo
import requests
url = 'https://developer.remaker.ai/api/remaker/v2/ai-remove-bg/get-job/your-job-id'
headers = {
'accept': 'application/json',
'Authorization': 'your token',
}
response = requests.get(url, headers=headers)
print(response.json()) # Print the response content
Response
{
"code": 100000,
"result": {
"output": [
"https://image.remaker.ai/datarm7/ai_remove_bg/output/2024-12-25/your-output-image.png"
]
},
"message": {
"en": "Request Success."
}
}