# Delete Alert Webhook

### **Authentication**

* Include your **`Access-Token`** in the header of your requests.
* Include your **`x-api-key`** The API key provided by GenLogs. This header must be included in the request.

### Permissions

The `external-api-delete-alert-webhook-endpoint` permission is required to access this endpoint.

### **Endpoint**

* **URL:**  `https://api.genlogs.io/alerts/webhook/{webhook_id}`
* **Method:** `DELETE`

### **Headers**

* **Access-Token**:  (string, required): Access token obtained from the "Create Access Token" endpoint.
* **X-Api-Key** (string, required): The API key provided by GenLogs.

### Path Params

* **webhook\_id** (string, UUID format,  required): Existent webhook ID, to be deleted.

### Request Example:

```shell
curl --location --request DELETE 'https://api.genlogs.io/alerts/webhook/{webhook_id}' \
--header 'access-token: <your-api-access-token>' \
--header 'x-api-key: <your-x-api-key>' \
```

### **Response:**

* **200 OK:** A JSON object containing the information of the deleted alert webhook.
* **400 Bad Request:** If webhook id is malformed or missing.
* **401 Unauthorized:** If the authentication credentials (Access-Token) is missing or incorrect.
* **403 Forbidden**: If the permission has not been added to your user.
* **404 Not Found**: If the provided `webhook_id` doesn't exist or not belongs to the customer.
* **500 Internal Server Error:** If there is an issue on the server that prevents processing the request.

### **Response Body:**

200 OK – Webhook Deleted Successfully

```json
{
    "id": "0a7f4670-aeed-491a-91ae-af7e88b397b3",
    "webhook_url": "https://example.domain/webhooks/genlogs-alerts",
    "description": "test-to-be-deleted",
    "created_at": "2026-02-20T18:58:19.132530",
    "deleted": true
}
```

400 Bad Request

Returned when:

* The provided webhook id is malformed or missing

```json
{
    "message": "Invalid webhook ID format.",
    "error_code": "VALIDATION_ERROR"
}
```

401 Unauthorized

* When access-token is missing or expired

```json
{
    "detail": "Token is missing!"
}
```

```json
{
    "detail": "Token is expired!"
}
```

403 Forbidden

```json
{
    "detail": "User not allowed to access this endpoint"
}
```

404 Not Found

* When the webhook is is not found or does not belong to customer

```json
{
    "message": "Webhook 0a7f4670-aeed-491a-91ae-af7e88b397b3 not found or does not belong to customer",
    "error_type": "WebhookNotFoundError",
    "error_code": "WEBHOOK_NOT_FOUND"
}
```

## Delete alert webhook

> Delete an alert webhook by ID. Requires ownership for the authenticated customer. Returns the deleted webhook data (id, webhook\_url, description, created\_at). Requires admin or external-api-delete-alert-webhook-endpoint.<br>

```json
{"openapi":"3.0.3","info":{"title":"Alert API - Delete Webhook","version":"1.0.0"},"paths":{"/alerts/webhook/{webhook_id}":{"delete":{"summary":"Delete alert webhook","description":"Delete an alert webhook by ID. Requires ownership for the authenticated customer. Returns the deleted webhook data (id, webhook_url, description, created_at). Requires admin or external-api-delete-alert-webhook-endpoint.\n","operationId":"deleteAlertWebhook","parameters":[{"in":"header","name":"Access-Token","required":true,"schema":{"type":"string"},"description":"JWT access token for authentication"},{"in":"header","name":"X-API-Key","required":true,"schema":{"type":"string"},"description":"API key for authentication"},{"in":"path","name":"webhook_id","required":true,"schema":{"type":"string","format":"uuid"},"description":"UUID of the webhook to delete"}],"responses":{"200":{"description":"Webhook deleted successfully; returns deleted webhook data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletedWebhookResponse"}}}},"400":{"description":"Bad Request – invalid webhook ID format","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Unauthorized – missing or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden – insufficient permissions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Not Found – webhook does not exist or does not belong to customer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"DeletedWebhookResponse":{"type":"object","description":"Deleted webhook data returned on successful DELETE (secret and enabled excluded)","properties":{"id":{"type":"string","format":"uuid"},"webhook_url":{"type":"string","format":"uri"},"description":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"},"deleted":{"type":"boolean","description":"Always true for delete response"}},"required":["id","webhook_url","created_at","deleted"]},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"error_code":{"type":"string","description":"Machine-readable error code"}},"required":["message"]}}}}
```
