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

my bot token is scoped to:

"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:

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

{
  "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.

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

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

image

this looks right for the bot moderation.

Something else to look at?

The API says you are not.

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

i do

triple checked

Any other information I can give publicly?

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

ok, yes those, are what I’m using

curl -X POST ‘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

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

Should be

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

1 Like

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