# Replacing IRC /ban and /unban with API

**URL:** <https://discuss.dev.twitch.com/t/replacing-irc-ban-and-unban-with-api/43329>\
**Category:** API\
**Created:** [February 4, 2023, 12:54pm UTC](https://discuss.dev.twitch.com/t/replacing-irc-ban-and-unban-with-api/43329 "2023-02-04T12:54:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tewl](https://avatars.discourse-cdn.com/v4/letter/t/f07891/32.png) [@Tewl](https://discuss.dev.twitch.com/u/Tewl)\
**Post date:** [February 4, 2023, 12:54pm UTC](https://discuss.dev.twitch.com/t/replacing-irc-ban-and-unban-with-api/43329/1 "2023-02-04T12:54:54Z")

</div>

Hello! This is more of a request than a question.

I have been using the /ban and /unban commands via IRC to moderate chat at times but with the upcoming removal I am swapping to using the API calls instead; which is fine. I notice the ban user end point in the API requires the user\_id which if for whatever reason i only have the username i have to make another call to the get users end point to get the id. My question/request would it be possible to have an end point that takes the login name for banning and unbanning a user so as not to have to make 2 calls.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [February 4, 2023, 12:59pm UTC](https://discuss.dev.twitch.com/t/replacing-irc-ban-and-unban-with-api/43329/2 "2023-02-04T12:59:03Z")

</div>

You would need a uservoice.

But logically you should already have the userID’s since the userID’s for the target are in the IRCv3 tags of chat.

So you don’t need to do an API call to convert a username to a userID as it’s already presented in the chat messages “meta data”.

See `user-id` tag in [Twitch IRC Tags | Twitch Developers](https://dev.twitch.tv/docs/irc/tags/#privmsg-tags)

---

<div class="post-metadata">

**Author:** ![Tewl](https://avatars.discourse-cdn.com/v4/letter/t/f07891/32.png) [@Tewl](https://discuss.dev.twitch.com/u/Tewl)\
**Post date:** [February 4, 2023, 1:10pm UTC](https://discuss.dev.twitch.com/t/replacing-irc-ban-and-unban-with-api/43329/3 "2023-02-04T13:10:03Z")

</div>

Yes, I know it exists in the tags, but say I wanted to ban a user who wasnt in the chat or wanted to unban a user i would still need to get the user\_id.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [February 4, 2023, 1:19pm UTC](https://discuss.dev.twitch.com/t/replacing-irc-ban-and-unban-with-api/43329/4 "2023-02-04T13:19:42Z")

</div>

Then in that scenario yes you would need to do a username to userID lookup first via get users yeah.

If a uservoice was created asking for a username query param I doubt that would be accepted or processed since that would be twitch doing the lookup instead of you doing the lookup, since the functionality already exists.

---

<div class="post-metadata">

**Author:** ![Tewl](https://avatars.discourse-cdn.com/v4/letter/t/f07891/32.png) [@Tewl](https://discuss.dev.twitch.com/u/Tewl)\
**Post date:** [February 4, 2023, 1:28pm UTC](https://discuss.dev.twitch.com/t/replacing-irc-ban-and-unban-with-api/43329/5 "2023-02-04T13:28:22Z")

</div>

I was unfamiliar with the uservoice. I did find this suggestion on it though, not many votes but it does say under consideration.

> **[Extend the "ban user" endpoint to accept "login" as an alternative to the...](https://twitch.uservoice.com/forums/310213-developers/suggestions/45765133-extend-the-ban-user-endpoint-to-accept-login-a)**
>
> Today when you're using chat you can just enter \`/ban user\` and the user will be banned, and the same is true for the IRC command, you can ban just by their username. It would be good if the ban endpoint would follow the same pattern.
> 
> The use case...

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [March 6, 2023, 1:29pm UTC](https://discuss.dev.twitch.com/t/replacing-irc-ban-and-unban-with-api/43329/6 "2023-03-06T13:29:11Z")

</div>

Closed on March 6, 2023, 1:29pm UTC

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