Getting Started

To remove background from api, you will need an api key.

We are currently in beta, contact support@erasebg.org to get your free api key.

 

# POST REQUEST
https://api.erasebg.org/v1/remove-background/upload/?api_key={YourApiKey}

 

You will need to send the following parameters in POST request in the above URL.

task_group Your unique uuidv4 key to track the processing task
original_image Binary image file
# Request sample

{
  "task_group": "5b097982-cd39-45a9-a7fe-b923ea9eb588",  # Generate your uuidv4 string (Warning: Don't use this same UUID)
  "original_image": "Your image file"
}

 

How to get background removed image?

You can make a websocket connection to the Erase BG server to watch the processing task.

 

let webSocket = new WebSocket("wss://api.erasebg.org/ws/remove-background/{Your task group}/");

webSocket.onmessage = (event) => {
    console.log(event.data)
}

webSocket.onopen = () => {
     webSocket.send(JSON.stringify({
        "key":  "{Image key received after uploading the image}"
    }))
};