## Overview

<p align="justify">
Use this endpoint to delete an insight that was previously generated for a specific AOI. It is essential to provide the AOI ID and Insight ID in the URL path, along with the associated project ID as a query parameter. A valid authorization token is mandatory. This operation permanently removes the selected insight, so it should be executed with caution. On successful deletion, a 200 OK response is returned. Invalid inputs or unauthorized attempts will trigger appropriate error messages.

- Method: `DELETE`

- Endpoint: `/v0/aoi/{aoi_id}/insights/{insight_id}`

- Operation: Deletes a specified insight linked to an AOI

</p>

## Authorization
<p align="justify">
You need the **api key** which you can get from the **API** tab in **Workspace Settings**. The api key is required in almost all the commands

```json
Authorization: <YOUR_API_KEY>
```
</p>

## Path Parameters
<p align="justify">
Path parameters identify the specific AOI and the insight to be deleted. `aoi_id` targets the Area of Interest, while `insight_id` specifies the insight under that AOI. This ensures the request is precise and operates only on the intended resource.

| Name        | Type   | Required | Description                                 |
|-------------|--------|----------|---------------------------------------------|
| `aoi_id`      | `string` | Yes      | Unique ID of the AOI                        |
| `insight_id`  | `string` | Yes      | ID of the insight to delete under the AOI   |

</p>

## Query Parameters
<p align="justify">
The query parameter `project_id` is used to validate the project context in which the AOI and insight exist. This helps ensure that the insight deletion is executed in the correct project scope, especially in multi-project environments.

| Name       | Type   | Required | Description                             |
|------------|--------|----------|-----------------------------------------|
| `project_id` | `string` | Yes      | ID of the project to which AOI belongs  |

</p>

## Response
<p align="justify">
A **200 OK** response indicates the insight has been successfully deleted. No content is returned in the body. This confirms that the resource was found and removed.

A **400 Bad Request** is returned when the input parameters are missing or are invalid. A **403 Forbidden** is returned when the user is not authorized to delete the insight.

```json 400 403
{
  "error": {
    "code": "<string>",
    "details": "<any>",
    "message": "<string>"
  }
}

```
</p>

## How to use the endpoint
<p align="justify">

1. **Construct your Request:**  
    Ensure you have the required values:

   * The `aoi_id` (Area of Interest ID)
   * The `insight_id` (Insight ID to be deleted)
   * The `project_id` as a query parameter. Also, attach the authorization token in the header.

2. **Send the Request:**  
    After adding json body and path parameters make a DELETE request to `https://api.pixxel.space/v0/aoi/{aoi_id}/insights/{insight_id}`. Ensure the `Authorization` header is set properly.

3. **Examine the Response:**  
    If the deletion is successful, you'll receive a `200 OK` status with no content. If there's an issue (e.g., invalid ID or insufficient permissions), you’ll get a `400` or `403` response with a structured error message explaining the problem.

</p>