# Enhanced

Enhanced images are the final processed output from the AI.\
\
By default this endpoint will return a preview image you can show to your customers before they purchase the image. When they decide they want to download the image simply send `?preview=false` to purchase and download the full sized image from Autoenhance.\
\
During development you can test this workflow without using your credits by utilizing development mode, simply set the `x-dev-mode` to `true`. You can learn more about the development mode [here](/images/downloading-images/enhanced.md#development-mode).\
\
In order to download enhanced images, you need to have a **paid subscription** or a **credit**, API key, and the image\_id.

{% hint style="info" %}
**Don't have any credits?**\
Subscribe for a monthly plan, or top up in our [web application](https://app.autoenhance.ai/settings?setting=subscription).
{% endhint %}

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

```javascript
const apiKey = "YOUR_API_KEY";
const imageId = "ID_OF_YOUR_IMAGE";

const downloadEnhancedImage = async (imageId, apiKey) => {
    const response = await fetch(
        `https://api.autoenhance.ai/v3/images/${imageId}/enhanced`,
        { 
            method: "GET",
            headers: {
                "x-api-key": apiKey,
            },
        }
    );
    const imageSource = await response.json()
    
    return imageSource
}
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_key = "YOUR_API_KEY"
image_id = "ID_OF_YOUR_IMAGE"

def download_enhanced_image(image_id, api_key):
    url = f'https://api.autoenhance.ai/v3/images/{image_id}/enhanced'
    headers = {
        'x-api-key': api_key
    }
    response = requests.get(url, headers=headers)
    image_source = response.json()
    
    return image_source
```

{% endtab %}

{% tab title="PHP" %}

```php
$image_id = "ID_OF_YOUR_IMAGE";
$api_key = "YOUR_API_KEY";

function download_enhanced_image($image_id, $api_key) {
    $url = "https://api.autoenhance.ai/v3/images/$image_id/enhanced";

    $options = array(
        'http' => array(
            'header'  => "Content-Type: application/json\r\n" .
                         "x-api-key: $api_key",
            'method'  => 'GET'
        )
    );

    $context = stream_context_create($options);
    $result = file_get_contents($url, false, $context);

    if ($result === FALSE) {
        return 'Error downloading image';
    }

    $image_source = json_decode($result, true);
    return $image_source;
}
```

{% endtab %}

{% tab title="cURL" %}

```
curl -X GET \
  "https://api.autoenhance.ai/v3/images/YOUR_IMAGE_ID/enhanced" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY"
```

{% endtab %}
{% endtabs %}

### Development mode

If you want to test downloading enhanced images without using your credits, you can include a request header `x-dev-mode` .

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

```javascript
const apiKey = "YOUR_API_KEY";
const imageId = "ID_OF_YOUR_IMAGE";

const downloadEnhancedImage = async (imageId, apiKey) => {
    const response = await fetch(
        `https://api.autoenhance.ai/v3/images/${imageId}/enhanced`,
        { 
            method: "GET",
            headers: {
                "x-api-key": apiKey,
                "x-dev-mode": true,
            },
        }
    );
    const imageSource = await response.json()
    
    return imageSource
}
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

api_key = "YOUR_API_KEY"
image_id = "ID_OF_YOUR_IMAGE"

def download_enhanced_image(image_id, api_key):
    url = f'https://api.autoenhance.ai/v3/images/{image_id}/enhanced'
    headers = {
        'x-api-key': api_key
        'x-dev-mode': True
    }
    response = requests.get(url, headers=headers)
    image_source = response.json()
    
    return image_source
```

{% endtab %}

{% tab title="PHP" %}

```php
$image_id = "ID_OF_YOUR_IMAGE";
$api_key = "YOUR_API_KEY";

function download_enhanced_image($image_id, $api_key) {
    $url = "https://api.autoenhance.ai/v3/images/$image_id/enhanced";

    $options = array(
        'http' => array(
            'header'  => "Content-Type: application/json\r\n" .
                         "x-api-key: $api_key\r\n" .
                         "x-dev-mode: true\r\n", 
            'method'  => 'GET'
        )
    );

    $context = stream_context_create($options);
    $result = file_get_contents($url, false, $context);

    if ($result === FALSE) {
        return 'Error downloading image';
    }

    $image_source = json_decode($result, true);
    return $image_source;
}
```

{% endtab %}

{% tab title="cURL" %}

```
curl "https://api.autoenhance.ai/v3/images/YOUR_IMAGE_ID/enhanced" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-dev-mode: true"
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
When this header is present, the API will return images with a development watermark.
{% endhint %}

Once you are satisfied with the results, simply remove the header to start downloading fully enhanced images without the watermark (credits will be consumed).

### Specification

## GET /v3/images/{id}/enhanced

> Download Enhanced Image

```json
{"openapi":"3.0.3","info":{"title":"Autoenhance API","version":"2026-06-02"},"tags":[{"name":"Images"}],"servers":[{"url":"https://api.autoenhance.ai"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"in":"header","name":"x-api-key","type":"apiKey"}},"schemas":{"HTTPError":{"properties":{"detail":{"type":"object"},"message":{"type":"string"}},"type":"object"},"ValidationError":{"properties":{"detail":{"properties":{"<location>":{"properties":{"<field_name>":{"items":{"type":"string"},"type":"array"}},"type":"object"}},"type":"object"},"message":{"type":"string"}},"type":"object"}}},"paths":{"/v3/images/{id}/enhanced":{"get":{"operationId":"download_enhanced_image","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"}},{"description":"DPI of the image, must at least be 72.","in":"query","name":"dpi","required":false,"schema":{"minimum":72,"type":"integer"}},{"description":"Quality of the image, must be between 1 and 90.","in":"query","name":"quality","required":false,"schema":{"maximum":90,"minimum":1,"type":"integer"}},{"description":"Format of the image, must be one of 'avif', 'png', 'jpeg', 'jxl', or 'webp'.","in":"query","name":"format","required":false,"schema":{"enum":["avif","png","jpeg","jxl","webp"],"type":"string"}},{"description":"Whether to show a lower quality preview version.","in":"query","name":"preview","required":false,"schema":{"type":"boolean"}},{"description":"Whether to apply a watermark to the image.","in":"query","name":"watermark","required":false,"schema":{"type":"boolean"}},{"description":"Whether to apply finetuning to the image.","in":"query","name":"finetuned","required":false,"schema":{"default":null,"nullable":true,"type":"boolean"}},{"description":"Whether to apply finetuning to the image. Deprecated: use 'finetuned' instead.","in":"query","name":"finetune","required":false,"schema":{"default":null,"nullable":true,"type":"boolean"}},{"description":"Whether to serve the restaged version of the image. Defaults to True (serve restaged if available). Set to False to serve the original enhanced image without restaging.","in":"query","name":"restaged","required":false,"schema":{"default":true,"type":"boolean"}},{"description":"Maximum width of the image in pixels. Must be a positive integer.","in":"query","name":"max_width","required":false,"schema":{"minimum":1,"type":"integer"}},{"description":"Scale factor for the image, must be between 0.0 and 1.0.","in":"query","name":"scale","required":false,"schema":{"maximum":1,"minimum":0,"type":"number"}}],"responses":{"200":{"content":{"image/jpeg":{"schema":{"format":"binary","type":"string"}}},"description":"Successful response"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPError"}}},"description":"Authentication error"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPError"}}},"description":"Not found"},"422":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}},"description":"Validation error"}},"summary":"Download Enhanced Image","tags":["Images"]}}}}
```


---

# Agent Instructions: 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:

```
GET https://docs.autoenhance.ai/images/downloading-images/enhanced.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
