Help

Make api call to remove.bg

Topic Labels: Scripting extentions
Solved
Jump to Solution
2181 4
cancel
Showing results for 
Search instead for 
Did you mean: 
RIck_Allen
6 - Interface Innovator
6 - Interface Innovator

Has anyone been able to make an api call to remove.bg from scripting or a script within an automation?

1 Solution

Accepted Solutions

Here’s how I use it: call the main “jobs” endpoint to create the job with a list of tasks (import file, convert, export new file), call the “wait” endpoint which will return when the job is finished, then retrieve the file in a final call.

See Solution in Thread

4 Replies 4

I haven’t tried that API yet. Have you had more success since first submitting your question? If not, would you be willing to share sample code that you’ve tried?

RIck_Allen
6 - Interface Innovator
6 - Interface Innovator

Yeah remove.bg is relatively straight forward in the end

//get the url of the attachment field
  let angle1Url = angle1[0].url
    console.log(angle1Url)
    let response = await remoteFetchAsync('https://api.remove.bg/v1.0/removebg',
      {
        method: 'POST',
        body: JSON.stringify({
          "image_url": angle1Url,
          "size": "full",
          "scale":"90%",
          "bg_color" : "white",
          "type": "tiff",
          "output": "angle1.tiff"
        }),
        headers: {
          'Content-Type': 'application/json',
          'X-Api-Key': yourAPI_Key,
          'accept': 'application/json'
        },
      });
   
    let theData = await response.json()
   
    let base64String = theData.data.result_b64

I’m now struggling with cloud convert, well I have that working except I cant parse the webhook it sends with Airtables limited parsing, but I guess I’ll have to loop the api calls until it returns the processed result.

Here’s how I use it: call the main “jobs” endpoint to create the job with a list of tasks (import file, convert, export new file), call the “wait” endpoint which will return when the job is finished, then retrieve the file in a final call.

Thank you Justin that was exactly the nudge I needed to get it working.