> For the complete documentation index, see [llms.txt](https://jamiemc.gitbook.io/autoenhance-ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jamiemc.gitbook.io/autoenhance-ai/advanced-enhancement/enhancing-hdrs.md).

# Enhancing HDRs

Start by uploading your HDR brackets to the enhancement endpoint. To tell our system that you are uploading brackets, you need to set **hdr: true** in the body.

When uploading HDR brackets, you can't specify the enhancement options when uploading the images. These need to be defined when you merge the images.

HDR images require an **order\_id** as we need to group all the images once they have been uploaded.

## Request signed S3 URL for uploading brackets.

<mark style="color:green;">`POST`</mark> `https://api.autoenhance.ai/v2/image`

#### Headers

| Name                                        | Type   | Description                                          |
| ------------------------------------------- | ------ | ---------------------------------------------------- |
| x-api-key<mark style="color:red;">\*</mark> | String | Provide your API key, found in the developer portal. |

#### Request Body

| Name                                            | Type   | Description                                                                                        |
| ----------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------- |
| image\_name<mark style="color:red;">\*</mark>   | String | Name of the image file (e.g. house.jpg).                                                           |
| content\_type<mark style="color:red;">\*</mark> | String | Mime file type (e.g. image/jpeg).                                                                  |
| order\_id<mark style="color:red;">\*</mark>     | String | UUID string to link a group of images under one order (e.g. b1aa3999-7908-45c9-9a99-82e25cf5de8e). |
| hdr<mark style="color:red;">\*</mark>           | Bool   | Default is false, set true to enable HDR.                                                          |

{% tabs %}
{% tab title="200: OK If you have made a successful request, you'll get a 200 status code and a response body similar to this with an s3PutObjectUrl." %}

```javascript
{
    order_id: "b1aa3999-7908-45c9-9a99-82e25cf5de8e",
    image_id: "0e53fb15-5ca2-4757-b631-14294cafd0ea",
    image_type: "jpeg",
    s3PutObjectUrl: "https://autoenhanceapi-prod.s3.eu-west-1.amazonaws.com/orderid/b1aa3999-7908-45c9-9a99-82e25cf5de8e/house.jpg"
}
```

{% endtab %}
{% endtabs %}

Like uploading a normal image, you will receive a signed S3 endpoint for uploading your image, called **"s3PutObjectURL"**.

To upload your bracket to our service, make a **PUT** request to **s3PutObjectURL** with the image as a buffer. You will receive a 200 success code and an empty body confirming that you’ve uploaded the image successfully.

## Upload image bracket to pre-signed S3 URL.

<mark style="color:orange;">`PUT`</mark> `https://autoenhanceapi-prod.s3.eu-west-1.amazonaws.com/orderid/b1aa3999-7908-45c9-9a99-82e25cf5de8e/house.jpg`

#### Headers

| Name                                           | Type   | Description                       |
| ---------------------------------------------- | ------ | --------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | Image mime type (e.g. image/jpeg) |

{% tabs %}
{% tab title="200: OK 200 code means the image has successful been uploaded to our system." %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

We require you to upload all brackets of all HDRs in an order to our system before we start processing. Once that is complete, we require you to hit our HDR merge endpoint, which will start processing the orders brackets into groups to start enhancement.

## Start bracket grouping

<mark style="color:green;">`POST`</mark> `https://api.autoenhance.ai/v2/order/:order_id/merge`

#### Path Parameters

| Name                                        | Type   | Description                                                             |
| ------------------------------------------- | ------ | ----------------------------------------------------------------------- |
| order\_id<mark style="color:red;">\*</mark> | String | Use the UUID order\_id defined when uploading images to **POST /image** |

#### Headers

| Name                                        | Type   | Description                                          |
| ------------------------------------------- | ------ | ---------------------------------------------------- |
| x-api-key<mark style="color:red;">\*</mark> | String | Provide your API key, found in the developer portal. |

#### Request Body

| Name                 | Type   | Description                                                                                          |
| -------------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| sky\_replacement     | Bool   | Enable/Disable sky replacement. By default, this is true.                                            |
| vertical\_correction | Bool   | Enable/Disable vertical correction. By default, this is true.                                        |
| sky\_type            | String | Set specific sky type. (Options: UK\_*SUMMER, UK\_WINTER or USA*\_*SUMMER). Default is UK\_SUMMER.*  |
| enhance\_type        | String | Type of image you want enhanced (e.g. property or food).                                             |
| cloud\_type          | String | Set specific cloud type. (Options: CLEA&#x52;*, LOW\_CLOUD or HIGH\_CLOUD). Default is HIGH*\_CLOUD. |
| contrast\_boost      | String | Set contrast boost level. (Options: NON&#x45;*, LOW, MEDIUM or HIGH). Default is LOW*.               |

Grouping can take between 10 seconds to 5 minutes, depending on the number of brackets that need grouping. During this time, no images will show up when you make a **GET** request to **/order/{order\_id}**.

Once a grouping has been completed all groups will show up with **GET /order/{order\_id}** and the AI will start to merge HDRs and enhance them.

## Check images have completed merging and starting to be enhanced.

<mark style="color:blue;">`GET`</mark> `https://api.autoenhance.ai/v2/order/:order_id`

Don't be concerend if this endpoint displays no images. Please wait 10 seconds to 5 minutes based on the number of images in your order, as it takes time for our system to group and sends brackets to be merged and enhanced.

This endpoint will also display the processing status once images start to merge and enhance.

#### Path Parameters

| Name                                        | Type   | Description                                                             |
| ------------------------------------------- | ------ | ----------------------------------------------------------------------- |
| order\_id<mark style="color:red;">\*</mark> | String | Use the UUID order\_id defined when uploading images to **POST /image** |

#### Headers

| Name                                        | Type   | Description                                          |
| ------------------------------------------- | ------ | ---------------------------------------------------- |
| x-api-key<mark style="color:red;">\*</mark> | String | Provide your API key, found in the developer portal. |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "order_id": uuid,
  "is_processing": boolean,
  "images": [
    {
      "image_id": uuid,
      "order_id": uuid,
      "image_name": string,
      "enhance_type": string,
      "image_type": string,
      "status": string,
      "sky_replacement": boolean,
      "vertical_correction": boolean,
      "room_type": string
    }
  ]
}
```

{% endtab %}
{% endtabs %}
