# Propper ban scope for /ban API, Getting a response error

**URL:** <https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265>\
**Category:** API\
**Created:** [September 10, 2023, 7:33pm UTC](https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265 "2023-09-10T19:33:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![242terk242](https://avatars.discourse-cdn.com/v4/letter/2/b487fb/32.png) [@242terk242](https://discuss.dev.twitch.com/u/242terk242)\
**Post date:** [September 10, 2023, 7:33pm UTC](https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265/1 "2023-09-10T19:33:56Z")

</div>

my bot token is scoped to:

```auto
"scopes": [
    "channel:manage:moderators",
    "channel:manage:polls",
    "channel:moderate",
    "channel:read:editors",
    "channel:read:polls",
    "chat:edit",
    "chat:read",
    "moderation:read",
    "moderator:manage:banned_users",
    "moderator:read:chatters",
    "user:edit"
]

```

My curl request with personal info removed:

```auto
curl -X POST 'https://api.twitch.tv/helix/moderation/bans?broadcaster_id=<NUMBER>?&moderator_id=<NUMBER>' \
-H 'Authorization: Bearer <TOKEN>' \
-H 'Client-Id: <CLIENT-ID>' \
-H 'Content-Type: application/json' \
-d '{"data": {"user_id":"<USER-ID>","duration":30,"reason":"no reason"}}'

```

response

```auto
{
  "error": "Forbidden",
  "status": 403,
  "message": "The user specified in the moderator_id query parameter doesn't have moderator privileges in the broadcaster's channel."
}

```

Broadcaster did approve the bot token in creation.

Not sure where I can look to trouble shoot.

Thanks for the review.

---

<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:** [September 10, 2023, 7:36pm UTC](https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265/2 "2023-09-10T19:36:35Z")

</div>

You have a token for `moderator_id`  
The user `moderator_id` isn’t a moderator for `broadcaster_id`

For example

I am `barrycarlyon` I am a moderator for `cohhcarnage` so if I auth myself to my client ID I can ban people via the API on `cohhcarnage`

I am `barrycarlyon` I am not a moderator for `ezekiel_iii` with that same token I cannot ban people `ezekiel_iii` channel as I am not a moderator

So you have the right scope but the user/bot is not a moderator on the broadcasters channel

---

<div class="post-metadata">

**Author:** ![242terk242](https://avatars.discourse-cdn.com/v4/letter/2/b487fb/32.png) [@242terk242](https://discuss.dev.twitch.com/u/242terk242)\
**Post date:** [September 10, 2023, 7:41pm UTC](https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265/3 "2023-09-10T19:41:10Z")

</div>

sorry should have added, yes, bot is a moderator in channel

![image](https://d2opxh93rbxzdn.cloudfront.net/original/3X/1/0/104309ce7addd37c082b714fa397e9b485d35a63.png)

this looks right for the bot moderation.

Something else to look at?

---

<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:** [September 10, 2023, 7:43pm UTC](https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265/4 "2023-09-10T19:43:07Z")

</div>

The API says you are not.

So check you have the correct user\_id’s in use (both moderator and channel)

---

<div class="post-metadata">

**Author:** ![242terk242](https://avatars.discourse-cdn.com/v4/letter/2/b487fb/32.png) [@242terk242](https://discuss.dev.twitch.com/u/242terk242)\
**Post date:** [September 10, 2023, 7:43pm UTC](https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265/5 "2023-09-10T19:43:36Z")

</div>

i do

triple checked

Any other information I can give publicly?

---

<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:** [September 10, 2023, 7:47pm UTC](https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265/6 "2023-09-10T19:47:06Z")

</div>

So what ID’s are you using?

based on your screenshot should be

| Field | user\_id | username |
| --- | --- | --- |
| broadcaster\_id | `238246433` | `b __b__ t` |
| moderator\_id | `948617137` | `bb __o__ t` |

---

<div class="post-metadata">

**Author:** ![242terk242](https://avatars.discourse-cdn.com/v4/letter/2/b487fb/32.png) [@242terk242](https://discuss.dev.twitch.com/u/242terk242)\
**Post date:** [September 10, 2023, 7:47pm UTC](https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265/7 "2023-09-10T19:47:38Z")

</div>

ok, yes those, are what I’m using

curl -X POST ‘[https://api.twitch.tv/helix/moderation/bans?broadcaster\_id=238246433?&moderator\_id=948617137](https://api.twitch.tv/helix/moderation/bans?broadcaster_id=238246433?&moderator_id=948617137)’ \

My token, not posting, has the scope at the start of thread

---

<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:** [September 10, 2023, 7:49pm UTC](https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265/8 "2023-09-10T19:49:57Z")

</div>

> [@242terk242](#):
>
> ```auto
> curl -X POST 'https://api.twitch.tv/helix/moderation/bans?broadcaster_id=<NUMBER>?&moderator_id=<NUMBER>' \
> 
> ```

ah I missed this. you have a `?` at the end of the `broadcaster_id` before the `&`

Should be

> [@242terk242](#):
>
> ```auto
> curl -X POST 'https://api.twitch.tv/helix/moderation/bans?broadcaster_id=<NUMBER>&moderator_id=<NUMBER>' \
> 
> ```

---

<div class="post-metadata">

**Author:** ![242terk242](https://avatars.discourse-cdn.com/v4/letter/2/b487fb/32.png) [@242terk242](https://discuss.dev.twitch.com/u/242terk242)\
**Post date:** [September 10, 2023, 7:51pm UTC](https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265/9 "2023-09-10T19:51:42Z")

</div>

I needed a pair of eyes. Thanks for the syntax review

---

<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:** [October 10, 2023, 7:52pm UTC](https://discuss.dev.twitch.com/t/propper-ban-scope-for-ban-api-getting-a-response-error/47265/10 "2023-10-10T19:52:24Z")

</div>

Closed on October 10, 2023, 7:52pm UTC

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