# Event definitions cannot be deleted

**URL:** <https://community.hubspot.com/t/event-definitions-cannot-be-deleted/107261>\
**Category:** APIs & Integrations\
**Tags:** timeline-and-extensions-apis\
**Created:** [May 15, 2024, 10:32pm UTC](https://community.hubspot.com/t/event-definitions-cannot-be-deleted/107261 "2024-05-15T22:32:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![MDrapeau](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@MDrapeau](https://community.hubspot.com/u/MDrapeau)\
**Post date:** [May 15, 2024, 10:32pm UTC](https://community.hubspot.com/t/event-definitions-cannot-be-deleted/107261/1 "2024-05-15T22:32:46Z")

</div>

With the API endpoint when you create a previously defined event definition that was deleted, we get this error: OBJECT\_ALREADY\_EXISTS even if the definition is not listed (either when looking at the web UI OR using the event definition query API).

I realised that the web UI append a \_v2, \_v3 and so on to the event definition names.

So how can it ever by possible to use the API to completely delete an event definition or verify if the name has already been taken in the past? This behaviour makes impossible to use the API in the context of stand alone applications!

---

<div class="post-metadata">

**Author:** ![GRajput](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/grajput/32/102020_2.png) [@GRajput](https://community.hubspot.com/u/GRajput)\
**Post date:** [May 16, 2024, 12:24pm UTC](https://community.hubspot.com/t/event-definitions-cannot-be-deleted/107261/2 "2024-05-16T12:24:49Z")

</div>

Hi @MDrapeau

Please share the API endpoint that you are using and also share the screenshot of the error you are facing.

Thanks!

---

<div class="post-metadata">

**Author:** ![MDrapeau](https://avatars.discourse-cdn.com/v4/letter/m/f14d63/32.png) [@MDrapeau](https://community.hubspot.com/u/MDrapeau)\
**Post date:** [May 16, 2024, 10:12pm UTC](https://community.hubspot.com/t/event-definitions-cannot-be-deleted/107261/3 "2024-05-16T22:12:27Z")

</div>

Very simple, just do those curl commands:

1) Create definition:

curl --request POST --url [https://api.hubapi.com/events/v3/event-definitions](https://api.hubapi.com/events/v3/event-definitions) --header ‘authorization: Bearer PRIVATE\_APP\_TOKEN’ --header ‘content-type: application/json’ --data ‘{“label”: “labela1”, “primaryObject”: “CONTACT”}’

2) Delete definition:

curl --request DELETE --url [https://api.hubapi.com/events/v3/event-definitions/labela1](https://api.hubapi.com/events/v3/event-definitions/labela1) --header ‘authorization: Bearer PRIVATE\_APP\_TOKEN’

3) List definition, nothing returned:

curl --request GET \  
--url [https://api.hubapi.com/events/v3/event-definitions](https://api.hubapi.com/events/v3/event-definitions) \  
--header ‘authorization: Bearer PRIVATE\_APP\_TOKEN’

4) Repeat #1 to re-create the definition and you get this error:

{“status”:“error”,

“message”:“pe44007092\_labela1 already exists”,

“correlationId”:“bf4755ce-9740-4411-a5ce-61c2a0a3892c”,

“context”:{“name”:[“pe44007092\_labela1”]},

“category”:“OBJECT\_ALREADY\_EXISTS”,

“subCategory”: “InboundDbObjectTypeError.OBJECT\_TYPE\_ALREADY\_EXIST”}
