Delete Event
Soft-delete an event definition.
Endpoint
DELETE /events/{id}
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The event ID |
Events in use cannot be deleted
If any active automation flow is triggered by this event, the request fails with 409 conflict. Remove the trigger from those flows first, then delete the event.
Response
{
"message": "Event deleted"
}
Examples
- cURL
- JavaScript
- Python
- C#
- PHP
curl -X DELETE "https://api.arsel.sa/v1/events/01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a" \
-H "Authorization: Bearer be_your_api_key"
const id = "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a";
const response = await fetch(`https://api.arsel.sa/v1/events/${id}`, {
method: "DELETE",
headers: { Authorization: "Bearer be_your_api_key" },
});
console.log(await response.json());
import requests
event_id = "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a"
response = requests.delete(
f"https://api.arsel.sa/v1/events/{event_id}",
headers={"Authorization": "Bearer be_your_api_key"},
)
print(response.json())
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer be_your_api_key");
var id = "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a";
var response = await client.DeleteAsync($"https://api.arsel.sa/v1/events/{id}");
Console.WriteLine(await response.Content.ReadAsStringAsync());
<?php
$id = "01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a";
$ch = curl_init("https://api.arsel.sa/v1/events/$id");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer be_your_api_key"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
$response = curl_exec($ch);
echo $response;
curl_close($ch);
Error Responses
- 409 In Use
- 404 Not Found
- 401 Unauthorized
{
"status_code": 409,
"name": "conflict",
"message": "Event \"order.completed\" is used by 2 active flow(s). Remove the trigger from those flows first."
}
{
"status_code": 404,
"name": "not_found",
"message": "Event 01957e3a-4b5c-7d8e-9f0a-1b2c3d4e5f6a not found"
}
{
"status_code": 401,
"name": "unauthorized",
"message": "Invalid or missing API key"
}