# Step-by-Step Guide

This roadmap will guide you through every step of the process, ensuring that you know exactly what to do, how to do it, and why each step matters. Each section includes step-by-step instructions, common issues to avoid, and helpful tips to make your experience seamless.

### **1. Get Your** [**API Key**](https://doc.aihomedesign.com/introduction/api-key) **& Set Up Your Webhook**

> **Goal**: Gain access to the system by obtaining your API key and configuring your webhook for real-time updates.

#### **Step-by-Step Instructions**

1. **Log in** to your account.
2. **Go to the**  [**API access**](https://aihomedesign.com/api-access) **Section**.
3. **Generate or Copy** your API key.
4. **Set Your Webhook URL** where you will receive updates and callbacks.

#### **Important Notes**

* **Security Tip**: Treat your API key like a password. Don’t expose it publicly or share it with others.
* **Webhook URL**: Make sure the URL is live, accessible, and ready to receive incoming requests.

#### **Common Issues**

* **Invalid API Key**: Double-check that you’ve copied the key correctly.
* **Webhook Not Triggering**: Ensure your server can receive POST requests and is not blocking unknown IPs.

***

### **2.** [**Authenticate**](https://doc.aihomedesign.com/introduction/how-to-use-the-api-key) **Your Requests**

> **Goal**: Use your API key to verify and authorize every request you send to the system.

**Add Your API Key** to the header of every request as:

```css
x-api-key : {Your_API_Key} 
```

#### **Important Notes**

* **API Key Regeneration**: If your key is compromised, regenerate it immediately.
* **Common Error**: “401 Unauthorized” — This means your API key might be missing or incorrect.

***

### **3. Upload Your Image**

> **Goal**: Upload images to the server's storage system in preparation for order submission.

#### **Step-by-Step Instructions**

1. **Access the** [**Upload Image**](https://doc.aihomedesign.com/api-endpoints/image-upload) **Section** of the API.
2. **Prepare the Image File** `JPG`,`PNG`,etc.
3. **Send a POST Request** to the API endpoint with the image file as form-data.
4. **Receive the Response**: The server will return a unique image identifier `image_id`.

#### **Important Notes**

* **File Size**: Ensure your image is within the file size limits.
* **Supported Formats**: Check which image formats are allowed  `JPG`,`PNG`, etc.

***

### **4. Submit an Order**

> **Goal**: Submit an order and specify the service, spaces, widgets, and other parameters required to fulfill the order.

#### **Step-by-Step Instructions**

1. **Retrieve Service Details**:\
   Get the list of available [spaces](https://doc.aihomedesign.com/api-endpoints/get-spaces), [widgets and items](https://doc.aihomedesign.com/api-endpoints/get-widgets-and-items) of each service via API endpoints.
2. **Prepare Order Data**:
   * Select the **service** you want to use.
   * Identify the **spaces**, **widgets and items** for the service.
   * Include the **image\_id** from the previous step.
3. **Submit the Order**:\
   Send a POST request to the [Submit Order](https://doc.aihomedesign.com/api-endpoints/submit-order) endpoint.
4. **Wait for the Webhook Callback**:\
   Once the order is processed, a [webhook](https://doc.aihomedesign.com/api-endpoints/generated-image-webhook) will send the result back to your specified URL.

#### **Important Notes**

* **Webhook URL**: Ensure your webhook is active, as the order status will be sent there.
* **Common Issues**:
  * **Missing Image ID**: Ensure you provide the correct image identifier `image_id`.
  * **Missing Service Data**: Make sure to retrieve and understand the correct spaces, widgets, and items before submitting.

***

### **5. Fetch Order Details**

> **Goal**: Retrieve detailed information on a submitted order to check its progress or result.

#### **Step-by-Step Instructions**

1. **Submit a GET Request**: Use the [Get Order Details](https://doc.aihomedesign.com/api-endpoints/get-order-details) endpoint.
2. **Review the Response**: The response will include the current status, progress, and final result.

#### **Important Notes**

* **Check Status**: Possible statuses may include **in-progress** or **idle**.
* **Order Tracking**: If an order is taking longer than expected, track it using this endpoint.
* **Polling vs Webhook**: Rely on the webhook for real-time updates, but you can also use this endpoint to manually check progress.
