# How to delete revoked Fleet enrolment tokens

**URL:** <https://discuss.elastic.co/t/how-to-delete-revoked-fleet-enrolment-tokens/324026>\
**Category:** Elastic Agent\
**Tags:** fleet\
**Created:** [January 26, 2023, 1:11pm UTC](https://discuss.elastic.co/t/how-to-delete-revoked-fleet-enrolment-tokens/324026 "2023-01-26T13:11:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![djkprojects](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@djkprojects](https://discuss.elastic.co/u/djkprojects)\
**Post date:** [January 26, 2023, 1:11pm UTC](https://discuss.elastic.co/t/how-to-delete-revoked-fleet-enrolment-tokens/324026/1 "2023-01-26T13:11:22Z")

</div>

Hi,

Is there a way to delete revoked Fleet enrolment tokens?

Thank you

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [January 27, 2023, 12:19am UTC](https://discuss.elastic.co/t/how-to-delete-revoked-fleet-enrolment-tokens/324026/2 "2023-01-27T00:19:46Z")

</div>

Hi @djkprojects Perhaps Read this...

> [@Enrollment Token deletion](https://discuss.elastic.co/t/enrollment-token-deletion/320335/11):
>
> Yup I see the same thing... I learned more slight_smile Yes Open a ticket BUT... I suspect support is going to tell you this about the API Kibana Fleet APIs This functionality is in technical preview and may be changed or removed in a future release. Elastic will apply best effort to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. But I would submit it anyways so it shows up as a Bug. And only Revoke is supported in the UI tod…

---

<div class="post-metadata">

**Author:** ![Cristina\_Amico](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cristina\_Amico](https://discuss.elastic.co/u/Cristina_Amico)\
**Post date:** [January 30, 2023, 10:32am UTC](https://discuss.elastic.co/t/how-to-delete-revoked-fleet-enrolment-tokens/324026/3 "2023-01-30T10:32:48Z")

</div>

Hi @dkprojects,

Currently the delete enrollment tokens endpoints only allows to invalidate them, not to delete. It basically works as a soft delete.

What's your use case for deleting them?

Thanks,  
Cristina

---

<div class="post-metadata">

**Author:** ![djkprojects](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@djkprojects](https://discuss.elastic.co/u/djkprojects)\
**Post date:** [January 30, 2023, 10:45am UTC](https://discuss.elastic.co/t/how-to-delete-revoked-fleet-enrolment-tokens/324026/4 "2023-01-30T10:45:48Z")

</div>

Hi,

The reason for deleting is simple. We have too many tokens that are not being used and they are cluttering the list making it hard to manage.

Thanks

---

<div class="post-metadata">

**Author:** ![Cristina\_Amico](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Cristina\_Amico](https://discuss.elastic.co/u/Cristina_Amico)\
**Post date:** [January 30, 2023, 11:11am UTC](https://discuss.elastic.co/t/how-to-delete-revoked-fleet-enrolment-tokens/324026/5 "2023-01-30T11:11:39Z")

</div>

If you need a way to delete the inactive enrollment keys, you can use this workaround. First create a user with the `system_indices superuser` role, e.g.

 ![superuser](https://us1.discourse-cdn.com/elastic/original/3X/2/6/26deed2b68a051317364c01deafbadd5a74b9684.png)

Then, via Kibana dev tools in a session for the user with the above role, run the following `delete_by_query` operation

```auto
POST .fleet-enrollment-api-keys/_delete_by_query
{
  "query": {
    "match": { 
      "active": false
    }
  }
}

```

You could also simply filter the inactive enrollment keys out in the UI by adding `active: false` to the KQL search bar on the enrollment keys page.

--

Thanks,  
Cristina

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 27, 2023, 11:12am UTC](https://discuss.elastic.co/t/how-to-delete-revoked-fleet-enrolment-tokens/324026/6 "2023-02-27T11:12:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
