# AI Image Enhancement

## Explanation

This API endpoint allows users to submit new orders within the `service-image-enhancement` service.

***

<mark style="color:green;">**`POST`**</mark> **`https://api.aihomedesign.com/v1/order`**

***

## Request Body

Ensure that your request body is in the <mark style="color:red;">**RAW-JSON**</mark> format.

The `service-image-enhancement` accepts `Enhancement Options` as an optional widget. To include a widget in the request body, specify the widget's ID in the `selected_widgets` as `id` and the selected widget item's ID as `item_id`.

```json
{
    "order_id": string,
    "space_name": string,
    "selected_widgets" : 
    [
        {
            "id" : string,
            "item_id" : string
        }
    ]
}
```

* **`order_id`**: This should match the `order_id` returned by the Image Upload API.
* **`space_name`**: Retrieve the `space_name` using the `service_name` from the [Get Spaces endpoint](https://doc.aihomedesign.com/api-endpoints/get-spaces).
* **`selected_widgets`**:
  * **`id`**: Retrieve the `id` for `selected_widgets` based on the `service_name` from the [Get Widgets and Items endpoint](https://doc.aihomedesign.com/api-endpoints/get-widgets-and-items).
  * **`item_id`**: Retrieve the `item_id` for each widget by using its `id` in `items` key from the [Get Widget and Items endpoint](https://doc.aihomedesign.com/api-endpoints/submit-order/broken-reference).

{% hint style="info" %}
**What is a Space?**

A **Space** refers to a specific area or room associated with the service you’re requesting. For certain services, such as Day to Dusk, the **space\_name** field is required to identify the room type (e.g., indoor, or outdoor).

Using the [**Get Spaces API**](https://doc.aihomedesign.com/api-endpoints/get-spaces), you can fetch all possible **spaces** based on the service.
{% endhint %}

> **In the Image Enhancement service, we offer two spaces: Indoor and outdoor, as shown in the picture below.**

<figure><img src="https://1694203522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fanw8A7ZZEFkicjKXkFik%2Fuploads%2FleavqpBNvorAXJ65KwzJ%2FIES.png?alt=media&#x26;token=bcfe25f4-403f-48e3-aee0-00faf257e582" alt=""><figcaption><p>Image Enhancement- Spaces<br><em>(Images shown in this documentation may not reflect the latest updates or design changes on the website.)</em></p></figcaption></figure>

{% hint style="info" %}
**What are Widgets and Items?**

**Widgets** are options that enhance your order. Depending on the service, widgets can either be optional or mandatory. For example, a widget might let you choose a design style or color or add specific enhancements to your image.

**Items** are the specific values or choices available for each widget. For instance, if a widget allows you to select a **style**, the widget items could be options like "Modern," "Contemporary," or "Scandinavian."

Use the [**Get Widgets and Items API**](https://doc.aihomedesign.com/api-endpoints/get-widgets-and-items) to see the available widgets and the items for each widget, ensuring your order is perfectly tailored to your needs.
{% endhint %}

> **In the Image Enhancement service, the Enhancement option is presented as a widget, with the toggles within it functioning as widget items.**

<figure><img src="https://1694203522-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fanw8A7ZZEFkicjKXkFik%2Fuploads%2FPpKxQLRyRVhL1gECvESY%2FIEO.png?alt=media&#x26;token=77741cf8-15e0-43a6-b4d8-a0f7d2cd5fb2" alt=""><figcaption><p>Image Enhancement -Enhancement Options Widget &#x26; Items<br><em>(Images shown in this documentation may not reflect the latest updates or design changes on the website.)</em></p></figcaption></figure>

## Headers

<table><thead><tr><th>Key</th><th>Value</th><th data-hidden>Description</th></tr></thead><tbody><tr><td>x-api-key<mark style="color:red;">*</mark></td><td>{your_api_key_here}</td><td>your API-Key</td></tr></tbody></table>

## Response

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

```json
{
   "order_id": string,
   "image_id": string,
   "eta": integer
}
```

{% endtab %}

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

```json
{
    "error": string,
    "key": string
}
```

{% endtab %}
{% endtabs %}
