# Delete messages api return "message": "Must provide either to\_contact or to\_channel parameter."

**URL:** <https://devforum.zoom.us/t/delete-messages-api-return-message-must-provide-either-to-contact-or-to-channel-parameter/38617>\
**Category:** API and Webhooks\
**Created:** [December 17, 2020, 8:02am UTC](https://devforum.zoom.us/t/delete-messages-api-return-message-must-provide-either-to-contact-or-to-channel-parameter/38617 "2020-12-17T08:02:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![maged.ahmedr](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maged.ahmedr/32/20269_2.png) [@maged.ahmedr](https://devforum.zoom.us/u/maged.ahmedr)\
**Post date:** [December 17, 2020, 8:02am UTC](https://devforum.zoom.us/t/delete-messages-api-return-message-must-provide-either-to-contact-or-to-channel-parameter/38617/1 "2020-12-17T08:02:32Z")

</div>

**Description**  
When i try to delete a message from a channel i get  
“message”: “Must provide either to\_contact or to\_channel parameter.”

i already provided  
to\_channel in the body of the request and still get the same error ! delete request body is totally ignored here!

**Error**  
“message”: “Must provide either to\_contact or to\_channel parameter.”

**Which App Type (OAuth / Chatbot / JWT / Webhook)?**  
Knowing the endpoint/s can help us to identify your issue faster. Please link the ones you need help/have a question with.  
OAuth

**Which Endpoint/s?**  
Knowing the API endpoint/s can help us to identify your issue faster. Please link the ones you need help/have a question with.  
DELETE /chat/users/{userId}/messages/{messageId}  
**How To Reproduce (If applicable)**  
Steps to reproduce the behavior:

1. Request URL / Headers (without credentials) / Body

# 

url : DELETE /chat/users/{userId}/messages/{messageId}  
body  
{  
“to\_channel” : “48a3349f-5f39-4116-a432-d7cdd0fbf3ab”  
}

**Screenshots (If applicable)**  
If applicable, add screenshots to help explain your problem.

**Additional context**  
Add any other context about the problem here.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [December 17, 2020, 6:46pm UTC](https://devforum.zoom.us/t/delete-messages-api-return-message-must-provide-either-to-contact-or-to-channel-parameter/38617/2 "2020-12-17T18:46:59Z")

</div>

Hi @maged.ahmedr,

Is it possible to share the full request URL including user and message IDs? This will help me to take a closer look. Please also double check that the user whose message you’re trying to delete is assigned with a role that has Edit permission for Chat Messages.

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![maged.ahmedr](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maged.ahmedr/32/20269_2.png) [@maged.ahmedr](https://devforum.zoom.us/u/maged.ahmedr)\
**Post date:** [December 18, 2020, 7:35pm UTC](https://devforum.zoom.us/t/delete-messages-api-return-message-must-provide-either-to-contact-or-to-channel-parameter/38617/3 "2020-12-18T19:35:27Z")

</div>

Hey will,

This is full URL including user and message ids  
`https://api.zoom.us/v2/chat/users/qAzlHSReTx6m9KQt4RyeQQ/messages/5b292599-b676-4909-8203-945c0e33ebdc`

request body

```auto
{
    "to_channel" : "48a3349f-5f39-4116-a432-d7cdd0fbf3ab"
}

```

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [December 18, 2020, 10:02pm UTC](https://devforum.zoom.us/t/delete-messages-api-return-message-must-provide-either-to-contact-or-to-channel-parameter/38617/4 "2020-12-18T22:02:46Z")

</div>

Hey @maged.ahmedr,

Thank you for providing additional information. Are you able to confirm that you are using an account-level OAuth app when making this request? Using a user-level, or not having the proper scopes, can cause the request to fail. If you’ve double-checked all of this, please let me know.

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![maged.ahmedr](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maged.ahmedr/32/20269_2.png) [@maged.ahmedr](https://devforum.zoom.us/u/maged.ahmedr)\
**Post date:** [December 19, 2020, 6:22am UTC](https://devforum.zoom.us/t/delete-messages-api-return-message-must-provide-either-to-contact-or-to-channel-parameter/38617/5 "2020-12-19T06:22:03Z")

</div>

Hey MaxM,

Yes i doubled checked, i’m using a account-level Oauth and having all scopes .

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [December 21, 2020, 10:21pm UTC](https://devforum.zoom.us/t/delete-messages-api-return-message-must-provide-either-to-contact-or-to-channel-parameter/38617/6 "2020-12-21T22:21:06Z")

</div>

Hey @maged.ahmedr,

Thank you for providing additional information. I double-checked our documentation on this and realized that this endpoint uses a query parameter instead of a request body. This is the case for most DELETE method endpoints.

My apologies for not catching that sooner, I hope that helps!

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [January 21, 2021, 8:21am UTC](https://devforum.zoom.us/t/delete-messages-api-return-message-must-provide-either-to-contact-or-to-channel-parameter/38617/7 "2021-01-21T08:21:07Z")

</div>

Closed on January 21, 2021, 8:21am UTC

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