# POST Generate Advance

## Endpoint

<mark style="color:green;">`POST`</mark> `https://api.spacely.ai/api/v1/generate/advance`

This endpoint is used to advance generate

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| X-API-KEY<mark style="color:red;">\*</mark> | String |             |

#### Request Body

| Name                                           | Type   | Description                                                                                                                                                                                                                                                                                 |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| model<mark style="color:red;">\*</mark>        | String | <p>The model name of the project. </p><p>(e.g., "spacely-v1", "spacely-unfurnished-space", "spacely-style-transfer").</p>                                                                                                                                                                   |
| imageUrl<mark style="color:red;">\*</mark>     | String | <p>The URL of the image representing the room or space to be designed/renovated.</p><p>(e.g., "<a href="https://storage.googleapis.com/spacely/public/image/roomstyle3/bathroom-modern.jpg"><https://storage.googleapis.com/spacely/public/image/roomstyle3/bathroom-modern.jpg></a>").</p> |
| prompt                                         | String | This could be a parameter that serves as a prompt or instruction for the model, possibly related to the style or theme of the image processing task.                                                                                                                                        |
| nPrompt                                        | String | It seems to be an empty parameter, potentially used to provide additional instructions or information to the model.                                                                                                                                                                         |
| renovateType<mark style="color:red;">\*</mark> | String | The type of renovation, whether "**residential**" or "**commercial**"                                                                                                                                                                                                                       |

{% tabs %}
{% tab title="200: OK Response ref Id for pulling data" %}

```json
{
  "data": "63d17492-43d9-4161-0000-b067be1316dc"
}
```

{% endtab %}

{% tab title="400: Bad Request Not Found: Requested resource not found on the server." %}

{% endtab %}

{% tab title="401: Unauthorized The API key provided was invalid or missing." %}

{% endtab %}

{% tab title="500: Internal Server Error Unexpected condition on the server preventing request fulfillment." %}

{% endtab %}
{% endtabs %}

## Example

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

```sh
curl --location 'https://api.spacely.ai/api/v1/generate/advance' \
--header 'X-API-KEY: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
    "model": "spacely-v1",
    "imageUrl": IMAGE_URL,
    "prompt": "mid_century",
    "nPrompt": "",
    "renovateType": "residential"
}
'
```

{% endtab %}

{% tab title="JavaScript  " %}

```javascript
var myHeaders = new Headers();
myHeaders.append("X-API-KEY", YOUR_API_KEY);
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "model": "spacely-v1",
  "imageUrl": IMAGE_URL,
  "prompt": "mid_century",
  "nPrompt": "",
  "renovateType": "residential"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.spacely.ai/api/v1/generate/advance", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
```

{% endtab %}

{% tab title="NodeJs" %}

```javascript
const axios = require('axios');
let data = JSON.stringify({
  "model": "spacely-v1",
  "imageUrl": IMAGE_URL,
  "prompt": "mid_century",
  "nPrompt": "",
  "renovateType": "residential"
});

let config = {
  method: 'post',
  maxBodyLength: Infinity,
  url: 'https://api.spacely.ai/api/v1/generate/advance',
  headers: { 
    'X-API-KEY': YOUR_API_KEY, 
    'Content-Type': 'application/json'
  },
  data : data
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

{% endtab %}

{% tab title="Go" %}

```go
package main

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

func main() {

  url := "https://api.spacely.ai/api/v1/generate/advance"
  method := "POST"

  payload := strings.NewReader(`{
    "model": "spacely-v1",
    "imageUrl": IMAGE_URL,
    "prompt": "mid_century",
    "nPrompt": "",
    "renovateType": "residential"
}
`)

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

  if err != nil {
    fmt.Println(err)
    return
  }
  req.Header.Add("X-API-KEY", 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="Python" %}

```python
import requests
import json

url = "https://api.spacely.ai/api/v1/generate/advance"

payload = json.dumps({
  "model": "spacely-v1",
  "imageUrl": IMAGE_URL,
  "prompt": "mid_century",
  "nPrompt": "",
  "renovateType": "residential"
})
headers = {
  'X-API-KEY': YOUR_API_KEY,
  'Content-Type': 'application/json'
}

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

print(response.text)

```

{% endtab %}
{% endtabs %}
