> 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/sunshine.md).

# Sunshine ☀️

### 💵 Credit Cost

You have two options:

* [**Enhanced sunshine**](#enhanced-mode-true) : **2 credits**
  * Ultra realistic sky with surroundings modification
  * Works for outdoor and indoor photos
* [**Regular sunshine**](#enhance-mode-false): **1 credit** <mark style="color:red;">(retired now, the sunshine mode will default to enhanced starting december 10th 2025)</mark>
  * Basic sky modification and do not affect the surroundings
  * Only works for outdoor photos

{% hint style="success" %}
For best results, we highly suggest the **Enhanced** option. It will deliver the best quality and the best accuracy. [See examples](#enhanced-mode-true)
{% endhint %}

### Endpoint

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

#### 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 of the outdoor to be sunshined.</p><p>Ex: <br><a href="https://img.freepik.com/premium-photo/abandoned-dilapidated-house-gloomy-sky_419341-152622.jpg"><https://img.freepik.com/premium-photo/abandoned-dilapidated-house-gloomy-sky_419341-152622.jpg></a></p><p></p> |
| skyId<mark style="color:red;">\*</mark> | String         | <p>The sky ID that can be fetched on the <a href="https://docs.gepettoapp.com/endpoints/get-skies">Get Skies </a>endpoint.<br><code>sunny, sunrise, sunset, sunset\_rose</code></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>                                                                                                                                 |
| enhanced                                | (True / False) | <p>(recommended)</p><p></p><p>Default to false.</p><p><br>Will use to enhanced mode to deliver an ultra realistic sky modification with advanced effects on the environment. (works for both indoors and outdoors photos)<br><br><a href="#credit-cost">Cost: 2 credits</a></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

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

```bash
curl --location 'https://europe-west1-gepettoai.cloudfunctions.net/v1/sunshine' \
--header 'Authorization: Bearer {{API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
  "url": "https://img.freepik.com/premium-photo/abandoned-dilapidated-house-gloomy-sky_419341-152622.jpg",
  "skyId": "sunny",
  "enhanced": true
}'
```

{% 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://img.freepik.com/premium-photo/abandoned-dilapidated-house-gloomy-sky_419341-152622.jpg",
    "skyId": "sunny",
    "enhanced": true
  })
};

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

payload = json.dumps({
  "url": "https://img.freepik.com/premium-photo/abandoned-dilapidated-house-gloomy-sky_419341-152622.jpg",
  "skyId": "demeures",
  "enhanced": True
})
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://img.freepik.com/premium-photo/abandoned-dilapidated-house-gloomy-sky_419341-152622.jpg",
  "skyId": "sunny",
  "enhanced": True
}';
$request = new Request('POST', 'https://europe-west1-gepettoai.cloudfunctions.net/v1/sunshine', $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/sunshine"
  method := "POST"

  payload := strings.NewReader(`{
    "url": "https://img.freepik.com/premium-photo/abandoned-dilapidated-house-gloomy-sky_419341-152622.jpg",
    "styleId": "sunny",
    "enhanced": true
}`)

  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/sunshine")

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://img.freepik.com/premium-photo/abandoned-dilapidated-house-gloomy-sky_419341-152622.jpg",
  "skyId": "sunny",
  "enhanced": true
})

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

```

{% endtab %}
{% endtabs %}

### Results

#### Enhanced mode "true"

<figure><img src="/files/zXgQcYR0xmd3ISk8mkEf" alt=""><figcaption><p>Original photo</p></figcaption></figure>

<figure><img src="/files/Bllj5EGrV2aCP2S3cFMK" alt=""><figcaption><p>Sunny (enhanced) + Upscale</p></figcaption></figure>

<figure><img src="/files/0z56WXEMrVkdQNOLQMAQ" alt=""><figcaption><p>Sunset (enhanced) + Upscale</p></figcaption></figure>

<figure><img src="/files/J5KozQO262dKSfYfAOKj" alt=""><figcaption><p>Sunrise (enhanced) + Upscale</p></figcaption></figure>

<div><figure><img src="/files/iQAvKH3sE9AILBCmafeu" alt=""><figcaption><p>Original photo</p></figcaption></figure> <figure><img src="/files/z4HTGkxiinsTBfq3IokY" alt=""><figcaption><p>Sunset (enhanced) + Upscale</p></figcaption></figure></div>

#### Enhance mode "false"

<figure><img src="/files/iXHynEMe36iwsM0agpIm" alt=""><figcaption><p>BEFORE</p></figcaption></figure>

<figure><img src="/files/nZjZc8oF1EKtP6DiVvc7" alt=""><figcaption><p>AFTER SUNRISE + UPSCALE</p></figcaption></figure>

<figure><img src="/files/cAv1P6TwTv5Qh5D7Yh4N" alt=""><figcaption><p>BEFORE</p></figcaption></figure>

<figure><img src="/files/zxjoRqSIWyG52il4M62e" alt=""><figcaption><p>AFTER SUNNY + UPSCALE</p></figcaption></figure>

<figure><img src="/files/qukviOSF1iSWNML70B9E" alt=""><figcaption><p>BEFORE</p></figcaption></figure>

<figure><img src="/files/626llonQ57O6ghv2YRh8" alt=""><figcaption><p>AFTER SUNNY + UPSCALE</p></figcaption></figure>
