/ Platform API
Platform API
    Chat Platform API v3
    Chat Platform API
    Chat Platform API
    Version 3

    Profanity filter

    Copy link

    The profanity filter is designed to detect and filter out profanity words or regular expressions contained in text and file messages according to your policies and criteria. By default, the profanity filter is only applied to the messages. If you'd like to apply profanity filter for nicknames, contact our sales team.

    HTTP request

    Copy link
    // To apply the settings application-wide.
    PUT https://api-{application_id}.sendbird.com/v3/applications/settings_global
    // To apply the filter to channels with a custom channel type.
    PUT https://api-{application_id}.sendbird.com/v3/applications/settings_by_channel_custom_type/{custom_type}


    Copy link

    The following table lists a parameter that this action supports.

    Parameter nameTypeDescription



    Specifies the custom channel type to apply a set of settings to a channel.

    Request body

    Copy link

    The following table lists the properties of an HTTP request that this action supports.



    nested object

    Specifies a profanity filter configuration to filter out certain words and patterns that match the character combinations specified in profanity_filter.keywords[].


    array of strings

    Specifies an array of words to detect. A keyword that starts with an asterisk filters all words that end with the keyword including the keyword itself. A keyword that ends with an asterisk filters all words that start with the keyword including the keyword itself.


    array of objects

    Specifies an array of regular expressions to detect. Each item in the array should be specified in {"regex": "a pattern in regular expression"} format. There are some restrictions on the regex syntax. Refer to this page to see which regex syntax is supported.



    Determines which filtering method to apply to messages and nicknames that contain the specified keywords or regular expressions. Acceptable values are the following:
    - 0 (none): takes no action on matching messages. This is the default value.
    - 1 (replace): detects and replaces words that match the keywords property with asterisks.
    - 2 (block): prevents users from sending messages that contain the keywords property or match the regex_filters property.



    Determines whether to apply the profanity filter of the application settings in addition to profanity_filter of the custom channel type. The default value of the property in the global settings is false. (Default: false)

    application widechannels with custom type
        "profanity_filter": {
            "keywords": "dumb,dummy",
            "regex_filters": [
                    "regex": "[^!@#$%^&*]*(damn|crap)[^!@#$%^&*]*"
                    "regex": "(http://|https://)?(casino|sex)+([-.]{1}[a-z0-9]+)*.[a-z]{2,5}(:[0-9]{1,5})?(/.*)?"
            "type": 2

    If you want to turn off the profanity filter, send a PUT request with a blank keywords property and regex_filters property as shown below:

    application widechannels with custom type
        "profanity_filter": {
            "keywords": "",
            "regex_filters": []


    Copy link

    If successful, this action returns the updated moderation settings or channels with a custom channel type in the response body.

    In the case of an error, an error object is returned. A detailed list of error codes is available here.