Documentation

Ban/Unban API

You can ban / unban users via API

Endpoint https://chatbackend.watchers.io/external/ban

Request payload

ParameterTypeRequiredDescription
roomIdstringOptionalIf you want ban user in the room, please ptovide the roomid
or you can use empty roomId for IN_APP bans.
userIdstringYesId of user you want to ban.
With enabled encryption, you should use unencrypted user id.
valuebooleanYesshould be true if you want to ban user or false to unban
expiresstringOptionalfortmat: 2024-12-31 05:33:32
reasonNumber ENUMOptional0 - INSULTS 1 - PERSONAL 2 -FLOOD 3 -LINKS 4 - VIOLENCE 5 - FRAUD 6 - NICKNAME 7 - POLITICAL 8 - REPEATED null - no reason
descriptionstringOptionalAny text description
typeENUMYesIN_APP or IN_ROOM

CURL examples

Ban user

curl -X 'POST' \
  'https://chatbackend.watchers.io/external/ban' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: {Api key of project from admin panel}' \
  -H 'Authorization: Bearer {Bearer token from admin panel}' \
  -d '{
  "userId": "123",
  "value": true,
  "expires": "2024-12-31 05:33:32",
  "reason": 2,
  "description": "Some text",
  "type": "IN_APP"
}'

Unban user

curl -X 'POST' \
  'https://chatbackend.watchers.io/external/ban' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'x-api-key: {Api key of project from admin panel}' \
  -H 'Authorization: Bearer Bearer {Bearer token from admin panel}' \
  -d '{
  "userId": "123",
  "value": false,
  "type": "IN_APP"
}'