# Creative Redesign

**Creative Redesign** will redesign a room in a specific style. If the room is empty it won't add many furnitures, use the [Smart Staging v2](https://docs.gepettoapp.com/endpoints/smart-staging-v2) or [Furnish](https://docs.gepettoapp.com/endpoints/furnish) mode if you need to add furnitures first.

{% hint style="success" %}
This mode is fully automatic, no mask is required, and results tends to be more creative and smart than the default Redesign mode.
{% endhint %}

### Endpoint

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

#### Headers

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

#### Request Body

<table><thead><tr><th width="269">Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>url<mark style="color:red;">*</mark></td><td>String (Url)</td><td><p>Image URL of the room to be redesigned.</p><p>Ex: <a href="https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg">https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg</a></p></td></tr><tr><td>styleId<mark style="color:red;">*</mark></td><td>String</td><td>The style ID that can be fetched on the <a href="https://docs.gepettoapp.com/endpoints/get-styles">Get Styles </a>endpoint.</td></tr><tr><td>roomId<mark style="color:red;">*</mark></td><td>String</td><td>The room ID that can be fetched on the <a href="https://docs.gepettoapp.com/endpoints/get-rooms">Get Rooms</a> endpoint.</td></tr><tr><td>webhook</td><td>String</td><td>(optional) Webhook <strong>POST</strong> URL to send the result on completion.<br><br>If not provided, the request will wait for the result.</td></tr></tbody></table>

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

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

{% endtab %}

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

{% endtab %}

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

{% endtab %}

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

{% endtab %}

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

```json
{
  "status": "pending",
  "id": "xxxxxxxxxxxxxx", // You can use that id with Get Job
  "styleId": "your_style",
  "roomId": "your_room",
  "creativity": 14,
  "mode": "redesign"
}
```

{% endtab %}
{% endtabs %}

### Code Examples

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

```bash
curl --location 'https://europe-west1-gepettoai.cloudfunctions.net/v1/creative-redesign' \
--header 'Authorization: Bearer {{API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
  "url": "https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
  "styleId": "demeures",
  "roomId": "living_room"
}'
```

{% 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://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
    "styleId": "demeures",
    "roomId": "living_room"
  })
};

const response = await fetch("https://europe-west1-gepettoai.cloudfunctions.net/v1/creative-redesign", 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/creative-redesign"

payload = json.dumps({
  "url": "https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
  "styleId": "demeures",
  "roomId": "living_room"
})
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://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
  "styleId": "demeures",
  "roomId": "living_room"
}';
$request = new Request('POST', 'https://europe-west1-gepettoai.cloudfunctions.net/v1/creative-redesign', $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/creative-redesign"
  method := "POST"

  payload := strings.NewReader(`{
    "url": "https://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
    "styleId": "demeures",
    "roomId": "living_room"
}`)

  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/creative-redesign")

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://theneo-prod-public.s3.amazonaws.com/images-1695201150801.jpg",
  "styleId": "demeures",
  "roomId": "living_room"
})

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

```

{% endtab %}
{% endtabs %}

### Results To Expect

<figure><img src="https://3386250929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG6Nk007rm3iTJDH6P5EJ%2Fuploads%2F6C72KmS1N3ZNxAzXcVn2%2FGroup%20168.jpg?alt=media&#x26;token=3af1f7f7-55b9-464c-8f74-c71e89126e76" alt=""><figcaption><p>Living room in a Scandinave style (Upscaled)</p></figcaption></figure>

<figure><img src="https://3386250929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG6Nk007rm3iTJDH6P5EJ%2Fuploads%2F8fH0YCdD5dKG3SvYF5Hn%2FGroup%20172.jpg?alt=media&#x26;token=04774c2a-6bca-45f0-9100-853a2d8910af" alt=""><figcaption><p>Kitchen in a Provence style (Upscaled)</p></figcaption></figure>

<figure><img src="https://3386250929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG6Nk007rm3iTJDH6P5EJ%2Fuploads%2FyTj9STgDDvgtslXwHaXM%2FGroup%20169.jpg?alt=media&#x26;token=2a3ef22b-4a89-48fa-a0f1-0fc5447a1b44" alt=""><figcaption><p>Terrace with Pool in a Copenhagen Style (Upscaled)</p></figcaption></figure>

<figure><img src="https://3386250929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG6Nk007rm3iTJDH6P5EJ%2Fuploads%2FZLWwl83SlqiaYksWpxJw%2FGroup%20167.jpg?alt=media&#x26;token=e21e46f3-d178-41ff-9f2d-9bacc1b41651" alt=""><figcaption><p>Living room in a scandinave style (Upscaled)</p></figcaption></figure>

<figure><img src="https://3386250929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG6Nk007rm3iTJDH6P5EJ%2Fuploads%2FCRhNgm0psVLNfw0Eo7Qi%2FGroup%20171.jpg?alt=media&#x26;token=4dc967bc-9413-4a5e-aea0-1e109cda80d5" alt=""><figcaption><p>Bathroom in a Cap Ferret style (Upscaled)</p></figcaption></figure>

<figure><img src="https://3386250929-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FG6Nk007rm3iTJDH6P5EJ%2Fuploads%2F9v6MsJuY3MMzqPEPg9u5%2FGroup%20170.jpg?alt=media&#x26;token=f188654c-b8fa-4634-88f5-303ce63188cd" alt=""><figcaption><p>Terrace with pool in a provence style (Upscaled)</p></figcaption></figure>
