logo
Video Call
Server API
Stream Mixing and Transcoding APIs
On this page

SetForbidUserRule

GET

https://rtc-api.zego.im/

Sets up user ban rules to ban specific users. After successful setup, you can query user ban rules or delete user ban rules.

Setting up user ban rules will not interrupt the user's ongoing Stream publishing, and will only take effect on the user's next Stream publishing request. To immediately ban the user's ongoing Stream publishing, you need to separately use set audio/video Stream ban rules, rather than user ban rules.

Rate Limit
For all Rooms under the same AppID: 10 times/second.
Parameter Configuration Examples
  • Assuming the user to be banned is user1, and not logged in to Room room1:

    • When RuleType is 1 and DisabledPrivilege[] is 1, it indicates that the user corresponding to this IP address cannot log in to any Room.
    • When RuleType is 2 and DisabledPrivilege[] is 1, it indicates that no user can log in to room1.
    • When RuleType is 3 and DisabledPrivilege[] is 2, it indicates that user1 can log in to any Room normally, but cannot publish Streams in any Room.
    • When RuleType is 4 and DisabledPrivilege[] is 2, it indicates that user1 can log in to room1 normally, but cannot publish Streams in room1.
  • Assuming the user to be banned is user1, and already logged in to Room room1, regardless of the RuleType value:

    • When DisabledPrivilege[] is 1 or 1&2, user1 is still in room1 but cannot publish Streams normally, and you need to call the kick Room user out interface to kick the user out.
    • When DisabledPrivilege[] is 2, user1 cannot publish Streams in room1.

Request

Query Parameters

    Action stringrequired

    Possible values: [SetForbidUserRule]

    Interface prototype parameters

    https://rtc-api.zego.im?Action=SetForbidUserRule

    AppId uint32required

    💡Public parameter. Application ID, assigned by ZEGOCLOUD. Get it from the ZEGOCLOUD Admin Console.

    SignatureNonce stringrequired

    💡Common parameter. A 16-character hexadecimal random string (hex-encoded 8-byte random number). For the generation algorithm, refer to the signature example.

    Timestamp int64required

    💡Common parameter. Current Unix timestamp in seconds. For the generation algorithm, refer to the signature example. A maximum deviation of 10 minutes is allowed.

    Signature stringrequired

    💡Common parameter. Signature used to verify the legitimacy of the request. Please refer to the signature mechanism to generate it.

    SignatureVersion stringrequired

    Possible values: [2.0]

    Default value: 2.0

    💡Public parameter. Signature version number.

    RuleType int32required

    Possible values: [1, 2, 3, 4]

    Ban rule type:

    • 1: Ban users by IP address, up to 100 rules can be set;
    • 2: Ban users by RoomId, up to 200 rules can be set;
    • 3: Ban users by UserId, up to 200 rules can be set;
    • 4: Ban users by RoomId and UserId, up to 200 rules can be set.

    The maximum number of rules that can be set refers to the number of rules that are valid at the same time, excluding expired rules.

    If you do not need certain rules, please call the delete user ban rules interface in time to clean them up.

    IP string

    IP address. Required when RuleType is 1.

    RoomId string

    Room ID. Required when RuleType is 2 or 4.

    UserId string

    User ID. Required when RuleType is 3 or 4.

    DisabledPrivilege int32[]required

    Possible values: [1, 2], >= 1

    Functions that banned users can use. 1: Login. 2: Publish Stream.

    EffectiveTime int64required

    Possible values: >= 1 and <= 86400

    Valid duration of the ban rule, unit: seconds, value range 1 ~ 86400 (1 day).

Responses

Operation successful
Schema
    Code int32

    Return code. The following only lists some return codes related to the interface business logic. For complete return codes, please refer to global return codes.

    Return CodeDescriptionSuggested Action
    0Request successful.-
    1Request failed.Please contact ZEGOCLOUD technical support for assistance.
    2Input parameter error.-
    9Permission to use the current interface is not enabled.Please contact ZEGOCLOUD technical support for assistance.
    206App request QPS is too high and is limited.Reduce request frequency, or contact ZEGOCLOUD technical support to increase the QPS limit threshold.
    50123The number of ban rules currently within the validity period exceeds the limit.Please reduce the number of rules.
    Message string

    Description of operation result.

    RequestId string

    Request ID.

    Data object
    ExpireTime int64

    Expiration time of the ban rule, Unix timestamp, unit: seconds.

Previous

Overview

Next

DescribeForbidUserRules

On this page

Back to top