# How to use api or other to manage ban/unban

**URL:** <https://discuss.dev.twitch.com/t/how-to-use-api-or-other-to-manage-ban-unban/24843>\
**Category:** API\
**Created:** [April 7, 2020, 1:01pm UTC](https://discuss.dev.twitch.com/t/how-to-use-api-or-other-to-manage-ban-unban/24843 "2020-04-07T13:01:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sylvanus](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/sylvanus/32/8271_2.png) [@Sylvanus](https://discuss.dev.twitch.com/u/Sylvanus)\
**Post date:** [April 7, 2020, 1:01pm UTC](https://discuss.dev.twitch.com/t/how-to-use-api-or-other-to-manage-ban-unban/24843/1 "2020-04-07T13:01:50Z")

</div>

Hello,

I do not know if my topic will be in the right category but I put it here, thinking I am the most suitable place.

I have read and reread the different Twitch developer documentation. And I have not found any other way than IRC chat to be able to order ban and unban actions on a channel.

Is there a simpler way via API or IRC is really the only way to programmatically realize a ban or timeout?

NB: My initial need was to be able to timeout users as a personalized reward for chain points with the pub/sub event.

---

<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:** [April 7, 2020, 1:10pm UTC](https://discuss.dev.twitch.com/t/how-to-use-api-or-other-to-manage-ban-unban/24843/2 "2020-04-07T13:10:31Z")

</div>

> [@Sylvanus](#):
>
> I have read and reread the different Twitch developer documentation. And I have not found any other way than IRC chat to be able to order ban and unban actions on a channel.
> 
> Is there a simpler way via API or IRC is really the only way to programmatically realize a ban or timeout?

the only way to ban/unban a user is via a chat command.

---

<div class="post-metadata">

**Author:** ![Sylvanus](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/sylvanus/32/8271_2.png) [@Sylvanus](https://discuss.dev.twitch.com/u/Sylvanus)\
**Post date:** [April 7, 2020, 1:12pm UTC](https://discuss.dev.twitch.com/t/how-to-use-api-or-other-to-manage-ban-unban/24843/3 "2020-04-07T13:12:46Z")

</div>

So is via IRC no ? Or i miss something ?

---

<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:** [April 7, 2020, 1:13pm UTC](https://discuss.dev.twitch.com/t/how-to-use-api-or-other-to-manage-ban-unban/24843/4 "2020-04-07T13:13:47Z")

</div>

Chat is chat (TMI (Twitch Messaging Interface) is available as an IRC like interface over an IRC port or a Websocket port).

---

<div class="post-metadata">

**Author:** ![Sylvanus](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/sylvanus/32/8271_2.png) [@Sylvanus](https://discuss.dev.twitch.com/u/Sylvanus)\
**Post date:** [April 7, 2020, 1:14pm UTC](https://discuss.dev.twitch.com/t/how-to-use-api-or-other-to-manage-ban-unban/24843/5 "2020-04-07T13:14:31Z")

</div>

Bots like Streamelement are able to timeout or ban people automatically. Am I supposed to create a bot?

---

<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:** [April 7, 2020, 1:15pm UTC](https://discuss.dev.twitch.com/t/how-to-use-api-or-other-to-manage-ban-unban/24843/6 "2020-04-07T13:15:20Z")

</div>

> [@Sylvanus](#):
>
> Am I supposed to create a bot?

Correct. You need bot code to automate handling a timeout/ban if you intend to offer this is a channel points reward.

---

<div class="post-metadata">

**Author:** ![Sylvanus](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/sylvanus/32/8271_2.png) [@Sylvanus](https://discuss.dev.twitch.com/u/Sylvanus)\
**Post date:** [April 7, 2020, 1:45pm UTC](https://discuss.dev.twitch.com/t/how-to-use-api-or-other-to-manage-ban-unban/24843/7 "2020-04-07T13:45:34Z")

</div>

Ohhhh ok, justa last thing…

Can i use the access\_token used for pub/sub as a token for tmi authentification ?

---

<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:** [April 7, 2020, 1:48pm UTC](https://discuss.dev.twitch.com/t/how-to-use-api-or-other-to-manage-ban-unban/24843/8 "2020-04-07T13:48:12Z")

</div>

As long as it has the correct scopes needed to perform the relevant operations yes.

> **[Authentication](https://dev.twitch.tv/docs/authentication/#scopes)**
>
> Authentication

You’ll need a key/token with at least these scopes

- channel:moderate - to send ban/timeout
- channel:read:redemptions - to read the pubsub

---

<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:** [May 7, 2020, 1:48pm UTC](https://discuss.dev.twitch.com/t/how-to-use-api-or-other-to-manage-ban-unban/24843/9 "2020-05-07T13:48:14Z")

</div>

Closed on May 7, 2020, 1:48pm UTC

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