# Can't delete a document using the API Documentation

**URL:** <https://discuss.elastic.co/t/cant-delete-a-document-using-the-api-documentation/253876>\
**Category:** Elastic Search\
**Created:** [October 31, 2020, 12:03am UTC](https://discuss.elastic.co/t/cant-delete-a-document-using-the-api-documentation/253876 "2020-10-31T00:03:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fabricioisma](https://avatars.discourse-cdn.com/v4/letter/f/df705f/32.png) [@fabricioisma](https://discuss.elastic.co/u/fabricioisma)\
**Post date:** [October 31, 2020, 12:03am UTC](https://discuss.elastic.co/t/cant-delete-a-document-using-the-api-documentation/253876/1 "2020-10-31T00:03:46Z")

</div>

I want to delete a document using the API, I used post and patch methods and work very well, but I got a problem deleting any document.

I'm following this documentation:

> **[Documents | Elastic App Search Documentation \[7.9\] | Elastic](https://www.elastic.co/guide/en/app-search/current/documents.html#documents-delete)**

When I make the request I got this response:

```
data: { error: 'You need to sign in before continuing.' }

```

I don't know why I got this response because I use my Bearer and it works terrific creating or updating documents.

Kind regards,

---

<div class="post-metadata">

**Author:** ![constancecchen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/constancecchen/32/71762_2.png) [@constancecchen](https://discuss.elastic.co/u/constancecchen)\
**Post date:** [November 2, 2020, 4:08pm UTC](https://discuss.elastic.co/t/cant-delete-a-document-using-the-api-documentation/253876/2 "2020-11-02T16:08:32Z")

</div>

Hey Fabricio! I believe this is an actually an issue on our end with DELETE endpoints not accepting Bearer tokens when they should. It _should_ be fixed soon in 7.10. In the meanwhile, you should be able to work around this by using a private API token instead of a Bearer token.

Thanks so much for bearing (unintentional pun, sorry!) with us!

Constance

---

<div class="post-metadata">

**Author:** ![fabricioisma](https://avatars.discourse-cdn.com/v4/letter/f/df705f/32.png) [@fabricioisma](https://discuss.elastic.co/u/fabricioisma)\
**Post date:** [November 6, 2020, 2:22am UTC](https://discuss.elastic.co/t/cant-delete-a-document-using-the-api-documentation/253876/3 "2020-11-06T02:22:59Z")

</div>

Thanks a lot Contance 😃

---

<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:** [November 4, 2022, 8:16am UTC](https://discuss.elastic.co/t/cant-delete-a-document-using-the-api-documentation/253876/4 "2022-11-04T08:16:40Z")

</div>

Closed on November 4, 2022, 8:16am UTC


