> For the complete documentation index, see [llms.txt](https://docs.gepettoapp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gepettoapp.com/endpoints/declutter.md).

# Declutter 🧹

### 💵 Credit Cost

You have two options:

* **Automatic declutter** (no mask provided): **2 credits**
* **Manual declutter** (user provides a mask): **1 credit**

{% hint style="success" %}
For best results if you need to empty a room, we highly suggest the **Automatic Declutter**. It will deliver the best quality and the best accuracy.
{% endhint %}

### Endpoint

<mark style="color:green;">`POST`</mark> `https://europe-west1-gepettoai.cloudfunctions.net/v1/declutter`

#### Headers

| Name                                            | Type   | Description         |
| ----------------------------------------------- | ------ | ------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer {{API\_KEY}} |

#### Request Body

| Name                                  | Type   | Description                                                                                                                                                                                                                                        |
| ------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| url<mark style="color:red;">\*</mark> | String | <p>Image URL.</p><p><a href="https://firebasestorage.googleapis.com/v0/b/gepettoai.appspot.com/o/raw-images%2F49d4311f-2d8e-459b-97c0-5543c544a2f0.jpeg?alt=media&#x26;token=6761e09c-bf49-4b34-9606-bc4ee9909d87">Example here</a></p>            |
| mask                                  | String | <p>(optional) The mask image URL.<br><a href="https://firebasestorage.googleapis.com/v0/b/gepettoai.appspot.com/o/mask%2F268179cb-b5c7-46e3-81e8-4453a7aec8b8.jpeg?alt=media&#x26;token=f4faa70d-83a7-447d-802d-29b016ef3027">Example here</a></p> |
| webhook                               | String | <p>(optional) Webhook <strong>POST</strong> URL to send the result on completion.<br><br>If not provided, the request will wait for the result.</p>                                                                                                |

{% tabs %}
{% tab title="200: OK If webhook is not set" %}

```json
{
  "base64": "<base64 encoded image>",
  "status": "success"
}
```

{% endtab %}

{% tab title="200: OK If webhook is provided" %}

```json
{
  "status": "pending",
  "id": "xxxxxxxxxxxxxx", // You can use that id with Get Job
  "skyId": "your_style"
  "mode": "sunshine"
}
```

{% endtab %}

{% tab title="400: Bad Request " %}

{% endtab %}

{% tab title="401: Unauthorized " %}

{% endtab %}

{% tab title="500: Internal Server Error " %}

{% endtab %}
{% endtabs %}

### Code Examples (automatic declutter)

{% tabs %}
{% tab title="CURL" %}

```bash
curl --location 'https://europe-west1-gepettoai.cloudfunctions.net/v1/decluter' \
--header 'Authorization: Bearer {{API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
  "url": "https://firebasestorage.googleapis.com/v0/b/gepettoai.appspot.com/o/raw-images%2F49d4311f-2d8e-459b-97c0-5543c544a2f0.jpeg?alt=media&token=6761e09c-bf49-4b34-9606-bc4ee9909d87"
}'
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
var myHeaders = new Headers();
myHeaders.append("Authorization", "Bearer {{API_KEY}}");
myHeaders.append("Content-Type", "application/json");

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: JSON.stringify({
    "url": "https://firebasestorage.googleapis.com/v0/b/gepettoai.appspot.com/o/raw-images%2F49d4311f-2d8e-459b-97c0-5543c544a2f0.jpeg?alt=media&token=6761e09c-bf49-4b34-9606-bc4ee9909d87"
  })
};

const response = await fetch("https://europe-west1-gepettoai.cloudfunctions.net/v1/declutter", requestOptions)
const body = await reponse.json();
console.log(body)
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = "https://europe-west1-gepettoai.cloudfunctions.net/v1/declutter"

payload = json.dumps({
  "url": "https://firebasestorage.googleapis.com/v0/b/gepettoai.appspot.com/o/raw-images%2F49d4311f-2d8e-459b-97c0-5543c544a2f0.jpeg?alt=media&token=6761e09c-bf49-4b34-9606-bc4ee9909d87"
})
headers = {
  'Authorization': 'Bearer {{API_KEY}}',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php
$client = new Client();
$headers = [
  'Authorization' => 'Bearer {{API_KEY}}',
  'Content-Type' => 'application/json'
];
$body = '{
  "url": "https://firebasestorage.googleapis.com/v0/b/gepettoai.appspot.com/o/raw-images%2F49d4311f-2d8e-459b-97c0-5543c544a2f0.jpeg?alt=media&token=6761e09c-bf49-4b34-9606-bc4ee9909d87"
}';
$request = new Request('POST', 'https://europe-west1-gepettoai.cloudfunctions.net/v1/declutter', $headers, $body);
$res = $client->sendAsync($request)->wait();
echo $res->getBody();

```

{% endtab %}

{% tab title="GO" %}

```go
package main

import (
  "fmt"
  "strings"
  "net/http"
  "io/ioutil"
)

func main() {

  url := "https://europe-west1-gepettoai.cloudfunctions.net/v1/declutter"
  method := "POST"

  payload := strings.NewReader(`{
    "url": "https://firebasestorage.googleapis.com/v0/b/gepettoai.appspot.com/o/raw-images%2F49d4311f-2d8e-459b-97c0-5543c544a2f0.jpeg?alt=media&token=6761e09c-bf49-4b34-9606-bc4ee9909d87"
}`)

  client := &http.Client {}
  req, err := http.NewRequest(method, url, payload)

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("Authorization", "Bearer {{API_KEY}}")
  req.Header.Add("Content-Type", "application/json")

  res, err := client.Do(req)
  if err != nil {
    fmt.Println(err)
    return
  }
  defer res.Body.Close()

  body, err := ioutil.ReadAll(res.Body)
  if err != nil {
    fmt.Println(err)
    return
  }
  fmt.Println(string(body))
}
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require "uri"
require "json"
require "net/http"

url = URI("https://europe-west1-gepettoai.cloudfunctions.net/v1/declutter")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer {{API_KEY}}"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "url": "https://firebasestorage.googleapis.com/v0/b/gepettoai.appspot.com/o/raw-images%2F49d4311f-2d8e-459b-97c0-5543c544a2f0.jpeg?alt=media&token=6761e09c-bf49-4b34-9606-bc4ee9909d87"
})

response = https.request(request)
puts response.read_body

```

{% endtab %}
{% endtabs %}

### Results

#### Automatic Decluttering

<figure><img src="/files/CYe7DMgIlTxK0CS4i3af" alt=""><figcaption><p>Automatic declutter of living room</p></figcaption></figure>

<figure><img src="/files/ZusKT9pwWwqskm4TYYct" alt=""><figcaption><p>Automatic declutter + upscale</p></figcaption></figure>

#### Manual decluttering (with a mask)

<figure><img src="https://firebasestorage.googleapis.com/v0/b/gepettoai.appspot.com/o/raw-images%2F49d4311f-2d8e-459b-97c0-5543c544a2f0.jpeg?alt=media&#x26;token=6761e09c-bf49-4b34-9606-bc4ee9909d87" alt=""><figcaption><p>BEFORE</p></figcaption></figure>

<figure><img src="https://firebasestorage.googleapis.com/v0/b/gepettoai.appspot.com/o/mask%2F268179cb-b5c7-46e3-81e8-4453a7aec8b8.jpeg?alt=media&#x26;token=f4faa70d-83a7-447d-802d-29b016ef3027" alt=""><figcaption><p>MASK OF THE ELEMENTS TO REMOVE</p></figcaption></figure>

<figure><img src="https://assets.gepettoapp.com/r/9ebe1d3f-5dec-454f-b430-d7655f544540.png" alt=""><figcaption><p>AFTER DECLUTTER (with mask)</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gepettoapp.com/endpoints/declutter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
